I created this discord bot, that I only use, which basically gets the voice chat of the author of the command, gets the activity being played in the voice channel, and change the name of the channel accordingly. I have no clue, why I'm getting this 429, Also it's my first time using discord.py so I may have used something wrong. Here is the code:
import asyncio
import discord
from discord.ext import commands
token = 'Token'
intents = discord.Intents.all()
bot = commands.Bot(command_prefix='!', intents=intents)
async def my_task(ctx):
voice_channel = ctx.author.voice.channel
while True:
if activities := [a.name for m in voice_channel.members for a in m.activities]:
most_common_activity = max(set(activities), key=activities.count)
await voice_channel.edit(name=f"{most_common_activity}")
else:
await voice_channel.edit(name="Other Games")
await asyncio.sleep(15)
@bot.command()
async def set_channel_activity(ctx):
bot.loop.create_task(my_task(ctx))
bot.run(token)