mirror of
https://github.com/kaaninchen/Gleiswechsel.git
synced 2026-07-21 19:52:47 +00:00
/Umstieg cooldown hinzugefügt
Discord hat diesen nervigen cooldown von 2 mal channel umbennen innerhalb von 10min. In dem cooldown hier ist es 1 mal pro 10 minuten, zur Sicherheit...
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import discord
|
||||
import random
|
||||
from discord.ext import tasks
|
||||
import time
|
||||
from discord.ext import tasks, commands
|
||||
from config import config
|
||||
from src.handlers import rename_vc
|
||||
from src.commands import setup_commands
|
||||
@@ -10,7 +11,7 @@ from src.data.status import discord_status
|
||||
bot = discord.Bot(intents=discord.Intents.all())
|
||||
setup_commands(bot)
|
||||
|
||||
@tasks.loop(minutes=1)
|
||||
@tasks.loop(minutes=5)
|
||||
async def change_status():
|
||||
status = random.choice(discord_status)
|
||||
await bot.change_presence(activity=discord.Game(name=status))
|
||||
@@ -24,7 +25,11 @@ async def on_ready():
|
||||
|
||||
@bot.event
|
||||
async def on_application_command_error(ctx, error):
|
||||
embed = build_error_embed(f"Ein Fehler ist aufgetreten: {error}")
|
||||
if isinstance(error, commands.CommandOnCooldown):
|
||||
retry_timestamp = int(time.time() + error.retry_after)
|
||||
embed = build_error_embed(f"Dein Umstieg ist erst <t:{retry_timestamp}:R> da! (Discord Cooldown)")
|
||||
else:
|
||||
embed = build_error_embed(f"Ein Fehler ist aufgetreten: {error}")
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user