/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:
Kaaninchen
2026-07-17 18:30:48 +02:00
parent 743ef62720
commit ffec60ecc2
4 changed files with 17 additions and 5 deletions
+2
View File
@@ -1,9 +1,11 @@
import discord
from discord.ext import commands
from src.handlers import rename_vc
from src.embeds import build_info_embed, build_error_embed
def setup_commands(bot: discord.Bot):
@bot.slash_command(description="Steige in den nächsten Zug! Beachte das Discord Spam limit (2x in 10min)")
@commands.cooldown(1, 600, commands.BucketType.guild)
async def umstieg(ctx):
success = await rename_vc(bot)
if not success:
-1
View File
@@ -57,7 +57,6 @@ def build_info_embed() -> discord.Embed | None:
"Daten großzügig bereitgestellt von dbf.finalrewind.org"
)
embed.set_footer(text=footer_text, icon_url="https://dbf.finalrewind.org/static/icons/icon-96x96.png")
return embed
def build_error_embed(errormsg) -> discord.Embed:
+7 -1
View File
@@ -1,4 +1,5 @@
import discord
import time
from config import config
from src.utils import random_connection
@@ -25,6 +26,11 @@ async def rename_vc(bot: discord.Bot) -> bool:
train = current['train'].split()[1]
train_name = f"{train} nach {current['destination']}"
print(f"Umstieg: {train_name} von {current['station']} \nüber: {current['via']}")
print("-----------------------------------------")
current_time = time.strftime('%X')
print(f"{current_time}: Umstieg: {train_name} (Typ {train_type}) von {current['station']}")
print(f"{current_time}: Wenn hier keine Nachricht mehr kommt bin ich im Cooldown")
await channel.edit(name=f"{config['formatting']}{train_name}",)
print(f"{current_time}: Name geändert!")
print("-----------------------------------------")
return True