transitous: basic rename_vc functionality

This commit is contained in:
Kaaninchen
2026-08-15 19:12:30 +02:00
parent adfa0a0440
commit 826b543347
5 changed files with 68 additions and 187 deletions
+11 -31
View File
@@ -1,40 +1,20 @@
import discord
import random
from discord.ext import tasks
from src.config import config
from src.handlers import rename_vc
from src.commands import setup_commands
from src.embeds import build_error_embed
from src.utils import logger
from src.data.status import discord_status
from src.utils import config, logger
from src.dc.handlers import rename_vc
from src.dc.helpers import validate_channel
bot = discord.Bot(intents=discord.Intents.all())
setup_commands(bot)
@tasks.loop(minutes=5)
async def change_status():
status = random.choice(discord_status)
await bot.change_presence(activity=discord.Game(name=f"{status} • /info"))
_bot_initialized = False
@bot.event
async def on_ready():
global _bot_initialized
print(f"{bot.user} ist online")
if not change_status.is_running():
change_status.start()
if not _bot_initialized:
_bot_initialized = True
await rename_vc(bot)
else:
logger("Discord Reconnect, laufende Fahrt bleibt unangetastet")
server_id = config["server"]
server_vc_id = config["vc"]
channel = validate_channel(bot=bot, server_id=server_id, channel_id=server_vc_id)
@bot.event
async def on_application_command_error(ctx, error):
embed = build_error_embed(f"Ein Fehler ist aufgetreten: {error}")
await ctx.respond(embed=embed)
logger(f"{bot.user} ist online")
await rename_vc(bot=bot, voice_channel=channel)
try:
bot.run(config['token'])
try:
bot.run(config["token"])
except:
logger("Fehler beim parsen des token", "fatal")
logger("Feher peim parsen des tokens", "fatal")