A modular Discord bot. To give Tonbot some functionality, enable plugins in the config.
To enable these plugins, run Tonbot once so that it generates config file ~/.tonbot/tonbot.config
. Then add any of the plugin names below to the plugins
list.
net.tonbot.net.tonbot.plugin.music.MusicPlugin
Plays music in a voice channel. (YouTube API Key and Spotify API key optional, but recommended.)
net.tonbot.plugin.ifplayer.IfPlayerPlugin
Plays text adventure games. Many games in Z-code format (except .z6) work.
net.tonbot.plugin.tmdb.TMDbPlugin
Looks up Movie and TV info from TMDb. (TMDb API Key Required)
net.tonbot.plugin.wa.WolframAlphaPlugin
Queries Wolfram Alpha to answer questions (Wolfram Alpha API Key Required)
net.tonbot.plugin.decisionmaker.DecisionMakerPlugin
Flips coins, shuffles items, picks a random number. Only for the most important decisions.
- Install Oracle JDK 8 in your environment. Yes, it must be Oracle JDK, not OpenJDK.
- Create a Discord Bot App (and therefore a Bot Token) from https://discordapp.com/developers/applications/me. Take note of your Client ID (public) and Token (keep secret).
- Decide on what plugins above you're going to enable and get the API keys for those services, if any.
- Clone the repository by running
git clone https://github.com/lijamez/Tonbot.git
in a directory of your choice. This will create a newTonbot
directory. - Go into that directory with
cd Tonbot
and run./gradlew run
. The first run will generate a.tonbot
directory in your home directory. - Edit the
~/.tonbot/tonbot.config
file. You need to fill in thediscordBotToken
, and a list of plugin names that you intend to enable. - Run
./gradlew run
again. This time, the bot should go online. However, your plugins may need further configuration, so stop the Tonbot process. - Go to
~/.tonbot/plugin_config
and edit the configs of each plugin that you enabled. Check the GitHub page of the plugint that you are enabling for instructions. (TODO: This step may not work yet, since some plugins currently don't generate their own barebones config.) - Once the plugin configs are set up, run
./gradlew run
again. If all is well, the plugins should initialize properly.
NOTE: At this time, I can't guarantee that future commits will be backwards compatible.
- Go to the
Tonbot
directory and rungit pull
. - There is no step 2.
Go to https://discordapp.com/oauth2/authorize?client_id={YOUR BOT CLIENT ID HERE}&scope=bot&permissions=0
The following command shows the available commands based on the plugins you have loaded.
t, help
You can get more information about a command by supplying some arguments. For example, to get more information about the t, music play
command, say:
t, help music play
Maybe you don't want everyone to be able to access all commands. You can set up permission controls right from the server.
TODO
Tonbot reacts to messages that:
- Start with the configured prefix
- Contain a valid route to an existing activity
To run an activity, a message sent to a channel must be structured like so:
{PREFIX}{ROUTE} {ARGS}
Example: t, music play sound of silence
Where:
- PREFIX ==
t,
- ROUTE ==
music play
- ARGS ==
sound of silence
Every Activity has a canonical route to activate them. If you feel that the canonical route is too long and therefore cumbersome to type out, consider setting up an alias (see below).
The prefix that Tonbot will watch out for.
Your Discord app's token. Must be set or else you literally cannot connect to Discord. Make sure that this is kept secret.
The RGB value of accents. This field is required.
A list of fully qualified plugin names to be loaded.
Example:
"plugins" : [
"net.tonbot.plugin.decisionmaker.DecisionMakerPlugin",
"net.tonbot.plugin.music.MusicPlugin"
]
Aliases are basically shortcuts to activities. For example, if "music play" is a route and you feel it's too long to type out, then you can set up an alias "p". Instead of having to type out t, music play hello adele
you can just type t, p hello adele
.
Aliases must be a struct with the alias as the field names and the canonical actvitiy route name as the value.
Example:
"aliases" : {
"p" : "music play",
"j" : "music join",
"np" : "music nowplaying",
"l" : "music list",
"q" : "music list",
"s" : "music skip",
"seek" : "music seek"
}
- Built with Discord4J