Launching The Bot¶
This page assumes you’ve completed Creating a Simple Hello World Module. If not, check the previous pages.
We’ve written our first module, and now we’re going to test it to see if it works or not.
Before running anything, there are a couple thing we need to do.
What is config.py
?¶
config.py
is the global configuration of the bot. It
contains the Discord token
,
multiple server support switch
and stuff like that. It won’t have any module-specific configuration, as there’s a much
better way of storing module configuration (support for different configurations for
different servers and the like).
For now though, we’re only opening it to add our token in, so open the file and add your token to the following line:
# Bot token from https://discordapp.com/developers/applications/me
TOKEN = ""
Running The Bot¶
Note
The way our module works, I’d recommend you add the bot to your server before running the bot.
From The Command Line (recommended)¶
To start the bot from the command line, all you have to do is:
$ monium run
and the bot will start up.
From a Python Launcher Script¶
While launching from the command line is always the best option, there can be reasons for wanting a launcher script (debuggers, for example).
Here is a example launcher script:
from monium import monium
if __name__ == "__main__":
exit(monium.run([])) # list of command line arguments, unused for now
That’s The Basics!¶
The bot should’ve said Hello, world!
on all the channels it could. (I hope you were
running it on a test server, as now you have to clean those messages up.)
And that’s the basics. We created a module that did a thing. Now go forth, and create another module for each new feature you want to add! (Seriously. That’s probably the biggest reason Monium exists at all.)
The rest of the tutorials will cover Monium’s extra APIs such as
Command
,
Configuration
,
Permissions
and
Translation
.