mirror of
https://github.com/kaaninchen/Gleiswechsel.git
synced 2026-07-21 19:52:47 +00:00
Aufgrund von /umstieg gabs konstant Probleme mit dem Discord Cooldown Limit, worauf die await funktionen nicht klar kamen. Ich werde eventuell den Befehl später wieder hinzufügen, aber jetzt wäre es besser ihn wegzulassen
34 lines
950 B
Python
34 lines
950 B
Python
import discord
|
|
import random
|
|
import time
|
|
from discord.ext import tasks, commands
|
|
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.data.status import discord_status
|
|
|
|
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=status))
|
|
|
|
@bot.event
|
|
async def on_ready():
|
|
print(f"{bot.user} ist online")
|
|
if not change_status.is_running():
|
|
change_status.start()
|
|
await rename_vc(bot)
|
|
|
|
@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)
|
|
|
|
try:
|
|
bot.run(config['token'])
|
|
except:
|
|
print("An error occured while parsing the token (check the config!)") |