Manage a discord bot via a REST API and an Angular Website.
Not finished and not tested
I hated to manage my bot just over source files or via command line, so i made a simple REST API and website to manage my bot.
On the releases page are the build executables for linux and windows, without the website, it is just the api and the bot. Before running the executable you have to include the .env file.
To run this Project you need a postgresql instance and a webserver like apache2.
- Build the go app, with go modules enabled.
- Then rename
.env.sample
to.env
and add the required informations, like postgresql host, port, discord bot token, etc. - The angular website is located in the
website
directory. - Before you can build the website you have to add the host entry in
website/environment/environment.prod.ts
. - Then build the website with
npm run-script "build go"
, this will build the website and put the output in thestatic
folder in the parentdirectory of the website. - Now you can run the go app you build at step 1.
- The bot should come online on your discord server and the website should be available under port
:80
.
NOTE: Right now the bot needs admin rights on the discord server to properply function.
If the bot and website are running, you can manage the bot. The standard login credentials are sponge
: bot
. You should change them immediatly.
Commands are regular expression, which means every message will be matched against all commands. This means a message can match more then one time, in this case the bot will execute all of them.
The bot can reply with simple static responses or you can build your own reply via scripts.
You can create custom functionality through starlark, a python dialect and starlight-go.
With s you can call builtin variables. You call them, like in many programming languages, with s.
.
Name | Type |
---|---|
s.Message |
A string, which contains the message |
s.Result |
A empty string, which sould contain your response |
s.GuildId |
A string which contains the ID of the discord server |
s.AuthorId |
A string which contains the ID of the message author |
kickUser |
A function which takes three arguments: a GuildID, AuthorID and a Reasons, all three are strings. Its purpose is to kick an user |
s.Result = s.Message.upper()
This script will return the message in uppercase.
- Dockerize the app
- Better tests
- Make more discord commands available, like ban, votekick, etc
- Better README.md
- Host the angular website with go http
- Check required rights of the bot on the discord server