Skip to content

sbrstrkkdwmdr/sbrbot

Repository files navigation

website
CodeFactor license stars lastcommit

discordjs typescript sequelize nodejs chartjs

install/setup

install nodejs (v16) here

install rust here

install all dependencies with npm i in the main directory

in the ./config/ folder rename tempconfig.json to config.json

config.json should look like this:

{
    "important": {
        "token": "create app and get token here => https://discord.com/developers/applications",
        "dbd_license": "ignore this",
        "redirect_uri": "http://localhost/discord/callback",
        "client_secret": "ignore this",
        "client_id": "ignore this"
    },
    "prefix": "string",
    "osuClientID": "create client here => https://osu.ppy.sh/home/account/edit#oauth",
    "osuClientSecret": "create client here => https://osu.ppy.sh/home/account/edit#oauth",
    "osuApiKey": "get api key here => https://osu.ppy.sh/home/account/edit#legacy-api",
    "ownerusers": [
        "user id",
        "user id 2"
    ],
    "google": {
        "apiKey": "tutorial below",
        "engineId": "tutorial below"
    },
    "useScreenshotParse": false,
    "LogApiCalls": true,
    "LogApiCallsToFile": true,
    "enableTracking": true,
    "storeCommandLogs": true
    "useEmojis": {
        "gamemodes": true,
        "scoreGrades": true,
        "mods": false
    }
}

change the values in config.json
rename TEMPLATE.sqlite to database.sqlite
check src/consts/emojis.ts and src/consts/buttons.ts and change the emojis that are formatted as <:name:ID:> (reupload* to a private server that the bot is in)
emoji images are found under ./files/img/emojis/ to get the emoji id, type the emoji then put a \ in front of it
to compile the bot the bot run tsc or npm run build
to run the compiled code run npm run run

image search setup

go to https://cse.google.com/cse/all or https://programmablesearchengine.google.com/controlpanel/all
press "Add"
in "what to search" enter "www.google.com/imghp"
in search settings, set enable "image search" and "search entire web"
press customise
copy the search engine id and paste it in the google.engineId field
scroll down and press "Get Started" on "Custom Search JSON API" (limited)
press "Get a Key" and create a new project
copy the key and paste it into the google.apiKey field

required permissions

disabling these permissions will disable the commands listed

Permission Usage Affected Commands
EmbedLinks Most commands display information via the use of embeds All commands
AddReactions The poll/vote command requires reactions for voting poll
ManageMessages To bulk delete messages purge
Administrator To access certain data checkperms, get, userinfo

credits n stuff

Usage URL
Discord API Wrapper Discord.js
Performance/SR calculations rosu-pp
Image to text parser tesseract.js
Youtube search yt-search
Database Sequelize
Mod calculations osumodcalculator
Graph/chart generator chartjs-to-image
osu!api osu! api v2
Api caller Axios
Api caller node-fetch
osr handler osureplayparser
Weather API open-meteo
Tropical Weather API tidetech
Country API REST Countries

art credits

Usage Source
grades Road Rage font by Youssef Habchi
details_default button Page select by Icons Bazaar from Noun Project (CC BY 3.0)
page select button Search by Oksana Latysheva from Noun Project (CC BY 3.0)
random button Dice by Arthur Shlain from Noun Project (CC BY 3.0)
map button Map by Adrien Coquet from Noun Project (CC BY 3.0)
graph button Graph by Setyo Ari Wilbowo from Noun Project (CC BY 3.0)
leaderboard button leaderboard by Royyan Wijaya from Noun Project (CC BY 3.0)
time button clock by Dong Gyu Yang from Noun Project (CC BY 3.0)
weather button cloud by Selot Lo from Noun Project (CC BY 3.0)
osu! map icons length bpm circles sliders spinners
world map Equirectangular Projection SW (2011-08-15) by Daniel R. Strebe wikimedia commons License
osu! modes xxx

config properties

"useEmojis": { "gamemodes": true, "scoreGrades": true, "mods": false }

Property Type Description Default
important object see below {}
prefix string a string at the start of each message to detect if a message is a command. ie ! => !ping would ping the bot and ?ping or ping wouldn't. sbr-
osuClientID string the client id of an osu! api v2 app null
osuClientSecret string the secret/token of an osu! api v2 app null
osuApiKey string the api key used for osu api v1 (only currently used for maplb with mods) null
ownerusers string[] an array of user ids stored as strings. users with these ids can use any command []
google object see below {}
useScreenshotParse boolean enables/disables the detection of maps in screenshots. Can cause crashes due to high CPU and memory usage false
LogApiCalls boolean enables/disables logging output to the console true
LogApiCallsToFile boolean enables/disable console output being logged to logs/console.log. Still saves logs even if LogApiCalls is false false
enableTracking boolean enables/disables osutrack. Users can still be added/removed but scores won't be updated. false
storeCommandLogs boolean enables/disables logs being stored locally false
useEmojis object see below {}

important

Property Type Description Default
token string application token for bot to connect to discords API.
go to https://discord.com/developers/applications, create a new app, and create a new bot under the bot section. copy the token from there
N/A
dbd_license string ignore this property null
redirect_uri string ignore this property null
client_secret string ignore this property null
client_id string ignore this property null

google

Property Type Description Default
apiKey string the api key of a google programmable search engine null
engineId string the search engine id of a google programmable search engine null

useEmojis

Property Type Description Default
gamemodes boolean enables/disables gamemodes being shown as emojis instead of text true
scoreGrades boolean enables/disables rank letters shown as emojis instead of text true
mods boolean enables/disables mods shown as emojis instead of text false