Код: Выделить всё
@tasks.loop(seconds=1)
async def update_channel_name():
global status_check
try:
status = server.status()
channel = bot.get_channel(VOICE_CHANNEL_ID)
if channel is None:
print("Voice channel not found!")
return
if status_check != status.players.online:
await channel.edit(name=f'Online players: {status.players.online}')
print(f"Updated voice channel to: {status.players.online}")
status_check = status.players.online
else:
print("-")
except discord.Forbidden:
print("Bot lacks permission to edit the voice channel.")
except discord.HTTPException as e:
print(f"An error occurred : {e}")
@bot.event
async def on_ready():
print(f'Bot is ready. Logged in as {bot.user}')
await bot.get_channel(VOICE_CHANNEL_ID).edit(name=f'Online players: {server.status().players.online}')
print(f"At start updated channel to {server.status().players.online}")
update_channel_name.start()
Код: Выделить всё
: discord.http We are being rate limited. PATCH *{Channel_ID_link}* responded with 429. Retrying in 580.74 seconds.
Every time i run my code, channel name gets changed about 2 or 3 times and then I get rate limited for 500sec.
Подробнее здесь: https://stackoverflow.com/questions/790 ... s-per-seco