Ara-Bot
Ara-Bot is a Python Discord bot designed to help me manage various community activities on my server.
Design
Initially, I started with the Discord library to develop the bot’s first version. My goal was for it to:
Automatically create channels for players based on a simple CSV file table;playerA;playerB
Set up events for casters who wanted to broadcast a match
Allow players to submit their own results
Close a round by deleting all channels and preparing the new round based on the submitted results
The first version was ready for the launch of my tournament “AOE Pong”, but it wasn’t very user-friendly. I needed slash commands to make it more accessible to the community.
So, I started recoding it using the interactions.py library.
I also add a youtube checker function to check if my youtube channel is live so i can advertise about it.
Infrastructure
The bot’s content is stored in a private Git repository, while the bot itself runs inside a K3s-managed container on my Raspberry Pi.
Each time I update it, the system removes the existing container, recreates it, and pulls the latest version from my repository.
Time Saved
Without the bot, I would probably spend around 4 hours per week managing round closures and new round preparations.
Additionally, if I hadn’t scripted the new draft system, this management time could easily increase to a full day.
Next Steps
The bot still requires more development to achieve all the features I envision.
My goal is to create a ladder tournament where players can simply say:
“Hey, match me with someone for a BO5!”
The bot would find an available opponent and automatically organize the match using the tournament settings.
I also want the bot to :
Work with a database instead of files
Have more “tournament concept” like leagues, elimination bracket…
Automate players registrations, with automatic elos check by api
Have the possibility to insert new players between rounds
Replace the “Interaction Role Bot” on my discord by adding the usecases i need
… There’s still plenty of room for updates and improvements!
Code Example
Here’s a basic example of how the bot check if i’m live automatically :
import asyncio
from utils.youtube import check_live
from utils.time import get_check_interval
from utils.discord import getRoleByName
from settings.vars import *
import re
async def start_youtube_checker(bot, YOUTUBE_API_KEY, BOT_LOG):
"""
Lance une tâche asynchrone pour vérifier les lives YouTube.
"""
# Vérification du live
video_title, video_url = await check_live(YOUTUBE_API_KEY, CHANNEL_ID)
if video_title:
GUILD = bot.get_guild(GUILD_ID)
channel = bot.get_channel(DISCORD_CHANNEL_ID)
NOTIFICATION_ROLE= await getRoleByName(GUILD,"Notifications")
pattern=r'^\[(\w{2})\]\s*\[([\w|:]+)\]\s*(.+)$'
match = re.match(pattern,video_title)
if match :
LANG = match.group(1)
GAME = match.group(2)
TITLE = match.group(3)
if LANG == "FR" and GAME and TITLE :
MESSAGE=f"""
Bonjour à tous {NOTIFICATION_ROLE.mention} !
Le Vieil Ours est en live sur le jeu **{GAME}**.
Il streame **{TITLE}** et c'est par ici : {video_url} !
"""
elif LANG == "EN" and GAME and TITLE :
MESSAGE=f"""
Hi everyone {NOTIFICATION_ROLE.mention} !
The Old Bear is live on the game **{GAME}**.
He is streaming **{TITLE}**. You're interested ? Let's go there : {video_url} !
"""
else :
MESSAGE=f"""📢 Aramatu est maintenant en live ! \nIl streame : **{video_title}** ! \nRegardez ici : {video_url}"""
if channel:
await channel.send(f"{MESSAGE}")
BOT_LOG.info(f"Notification envoyée : {video_title}")
return True
return False
Code Architecture
📂 AraBot/
├── 📁 libs/ → Handles bot commands
├── 📁 utils/ → Utility functions (API requests, logs)
├── 📁 settings/ → Configuration files (settings, API keys, constants)
├── 📄 Ara-bot.py → Bot entry point, initializes everything
├── 📄 requirements.txt → Dependencies required for the bot
├── 📄 README.md → Documentation and setup guide