log whenever joined/left a server
This commit is contained in:
parent
b9f87e853d
commit
03356e28a6
25
README.md
25
README.md
@ -1,6 +1,27 @@
|
|||||||
# IT Discord Bot
|
# Tux Bot
|
||||||
|
|
||||||
|
|
||||||
|
This is just a little fun bot. It can give you an excuse, if you're stuck while programming.
|
||||||
|
|
||||||
## Getting started
|
## Getting started
|
||||||
|
|
||||||
|
Create a file calles `secret.json` in the directory, where the `docker-compose.yml` file is. Put there your discord bot token in:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"BOT_TOKEN": "YOUR_TOKEN"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
And start the discord bot with:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
docker-compose up --build
|
||||||
|
```
|
||||||
|
For getting the right invite link with the right permissions, run:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
python3 create_invite_link.py YOUR_BOTS_ID
|
||||||
|
```
|
||||||
|
You can get the ID from the developer portal or from the terminal log while starting the discord bot
|
||||||
|
|
||||||
|
## Privacy
|
||||||
|
|
||||||
|
The discord bot will only log, whenever a command was called and whenever the bot was added or removed from a discord server. It won't log any user/server specific information.
|
||||||
11
src/bot.py
11
src/bot.py
@ -3,6 +3,7 @@ import asyncio
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
|
from discord import Guild
|
||||||
from discord import app_commands
|
from discord import app_commands
|
||||||
from discord import Interaction
|
from discord import Interaction
|
||||||
|
|
||||||
@ -31,6 +32,16 @@ async def load_cogs():
|
|||||||
await bot.load_extension(f"cogs.{filename[:-3]}")
|
await bot.load_extension(f"cogs.{filename[:-3]}")
|
||||||
|
|
||||||
|
|
||||||
|
@bot.event
|
||||||
|
async def on_guild_join(guild: Guild):
|
||||||
|
logger.info("Joined guild")
|
||||||
|
|
||||||
|
|
||||||
|
@bot.event
|
||||||
|
async def on_guild_remove(guild: Guild):
|
||||||
|
logger.info("Left guild")
|
||||||
|
|
||||||
|
|
||||||
@bot.event
|
@bot.event
|
||||||
async def on_ready():
|
async def on_ready():
|
||||||
logger.info(f"Logged in as: {bot.user.name} with ID {bot.user.id}")
|
logger.info(f"Logged in as: {bot.user.name} with ID {bot.user.id}")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user