A simple Discord selfbot written in Node.JS.
docker run -d -e SCORD_TOKEN='token' -e SCORD_PREFIX='prefix' lodig/scord
- How to retrieve your token here.
- Linux, macOS (probably works with others OS - not tested)
- Node.JS >= v7.5.0 (probably works with older versions - not tested)
- npm >= v5.0.0 (probably works with older versions - not tested)
git clone https://github.com/lodi-g/scord
cd scord && npm install
cp config/config.example.json config/config.json
- Edit the
config/config.json
with your Discord token and wanted prefix.
node app.js
=> This will use the configuration file located inconfig/config.json
. An example is available in theconfig/config.example.json
file.node app.js token prefix
=> This won't use any configuration file and instead will load the token and prefix from command line.
- With scord, there is a small static core and everything else is a module (reload, help etc).
- To write your own modules you just need to add a file in the
modules/
folder. - The file must be a valid JavaScript file.
- scord uses the
discord.js
module. - You may
require('../app')
, that gives you an object with the commands manager (in the variablemanager
) and the bot's user (variableuser
).
- This file must export at least two things: a
cmd
(typeString
), and arun
(type:function
). Thecmd
field describes the command that will run therun
function. - You may as well export a
help
field (type:String
) that will be used by thehelp
command. - You may as well export an
args
field (type:Number
). It will be used to verify the number of arguments is perfectly valid. If you expect a variadic number of arguments, it won't be useful.
- The
run
function is the function called when you will type${prefix}${cmd}
. - The
run
function accepts two parameters: amsg
(an instance of theMessage
class fromdiscord.js
), representing the sent message, and anargs
(type:Array
) representing the arguments.
- You may need to access current registered commands (as I did to write the
reload
andhelp
modules). require('../app').manager
is the only thing needed to access these.app.js
exports an instance of theCommandsManager
class. Its definition is trivial and can be read in thecommands.js
file.
- You may need to access the current bot's user (as I did to write the
game
module). require('../app').user
is the only thing needed to access it.app.js
exports an instance of theClientUser
class (adiscord.js
class). Though be aware that the export is valid only when the bot has logged in. Before that,user
isnull
.- I suggest taking a look at the
modules/game.js
to fully understand.
- All current modules can be used as examples. They use all the feature described above and each file is less than 50 lines of code.
- Core:
- Logging with different levels of verbosity
- Modules:
- Translate
- Google Search
- Quote
- Game API?
- Regional indicator comments
- And also thanks to LazyShpee for helping me countless times.
- WTFPL