Compare commits
2 commits
10ae222474
...
dc06ec1d20
Author | SHA1 | Date | |
---|---|---|---|
dc06ec1d20 | |||
72b889ad89 |
4 changed files with 84 additions and 1 deletions
21
LICENSE
Normal file
21
LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2023-present Adora Kalb <dev@lauka.net>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
|
@ -1,11 +1,14 @@
|
||||||
config = {
|
config = {
|
||||||
"bot": {
|
"bot": {
|
||||||
|
# Get the token by doing https://discordpy.readthedocs.io/en/stable/discord.html
|
||||||
|
# we need (privileged) Message Content Intent and the Send Message Bot permission
|
||||||
"token": "aslkjdasjldjsaldjasl",
|
"token": "aslkjdasjldjsaldjasl",
|
||||||
|
# Channel-ID of whitelisted Channels
|
||||||
"channels": [
|
"channels": [
|
||||||
12873281371823821328193, # laura lol, bot-test
|
12873281371823821328193, # laura lol, bot-test
|
||||||
21302918421093801832 # LiLa Network Clubhaus, game-control
|
21302918421093801832 # LiLa Network Clubhaus, game-control
|
||||||
],
|
],
|
||||||
|
# Username of people that are whitelisted to send commands
|
||||||
"whitelist": [
|
"whitelist": [
|
||||||
"username"
|
"username"
|
||||||
]
|
]
|
||||||
|
@ -13,8 +16,11 @@ config = {
|
||||||
},
|
},
|
||||||
"games": [
|
"games": [
|
||||||
{
|
{
|
||||||
|
# Display name
|
||||||
"displayname": "Minecraft Vanilla Server",
|
"displayname": "Minecraft Vanilla Server",
|
||||||
|
# slug is used in the actual chat commands
|
||||||
"slug": "mc-v",
|
"slug": "mc-v",
|
||||||
|
# systemd service name that you would use in 'sytemctl restart xyz'
|
||||||
"systemd": "minecraft-vanilla01.service"
|
"systemd": "minecraft-vanilla01.service"
|
||||||
},
|
},
|
||||||
{
|
{
|
13
example/discord-bot.service
Normal file
13
example/discord-bot.service
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Game Discord Bot by Adora
|
||||||
|
After=multi-user.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
Restart=always
|
||||||
|
WorkingDir=/games/discord-bot
|
||||||
|
ExecStart=/games/discord-bot/venv/bin/python3 ./app.py
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
|
43
readme.md
Normal file
43
readme.md
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
# game-bot
|
||||||
|
This is a Bot by @lauralani to let her friends start, stop and display the status of various game servers.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
Get the Discord Bot token by following this guide https://discordpy.readthedocs.io/en/stable/discord.html
|
||||||
|
|
||||||
|
Discord privileges needed:
|
||||||
|
Privileged Permissions:
|
||||||
|
- Message Content
|
||||||
|
Bot Permissions:
|
||||||
|
- Send Message Bot permission
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
```bash
|
||||||
|
# clone this repo
|
||||||
|
cp example/config.example.py config.py
|
||||||
|
|
||||||
|
# edit and fill config.py
|
||||||
|
python3 -m venv venv
|
||||||
|
source venv/bin/activate
|
||||||
|
pip3 install -r requirements.txt
|
||||||
|
|
||||||
|
python3 app.py
|
||||||
|
```
|
||||||
|
|
||||||
|
For setting this bot up as a systemd service, you can take a look at the
|
||||||
|
systemd service file in the example directory.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
- modular configuration of services/game servers
|
||||||
|
- use chat commands in DM and in channels
|
||||||
|
|
||||||
|
## Commands
|
||||||
|
The bot has the following commands:
|
||||||
|
- __help__: Get help for the commands
|
||||||
|
- __info__: List all available games, their status and their _<slug>_
|
||||||
|
- __start__ _<slug>_: Start game with slug _<slug>_
|
||||||
|
- __stop__ _<slug>_: Stop game with slug _<slug>_
|
||||||
|
- __restart__ _<slug>_: Stop game with slug _<slug>_
|
||||||
|
- __status__ _<slug>_: Show status for game with slug _<slug>_
|
||||||
|
|
||||||
|
## License
|
||||||
|
`discord-bot` is available under the MIT license. See the [LICENSE](LICENSE) file for more info.
|
Loading…
Reference in a new issue