Encounter Error 429s

I’m super new to programming and wanted to make a simple bot that could roll dice and stuff with everything I’ve already learnt. The bot usually works fine, but I encounter 429s every few weeks randomly. Any help on how I could prevent this from happening would be super appreciated.

from keep_alive import keep_alive
from discord.ext import commands
import os
import random

client = commands.Bot(command_prefix='/')


@client.event
async def on_ready():
	print('We have logged in as {0.user}'.format(client))


@client.command(aliases=['r'])
async def roll(ctx, amount=69):
	n1 = random.randint(1, amount)
	await ctx.send('{} rolled a **{}**!'.format((ctx.author.mention), n1))
	if n1 == 69:
		await ctx.send(':clap:')
	if n1 == 420:
		await ctx.send('holy shit')


@client.command()
async def choose(ctx, *, ctx1):
	try:
		ctx1 = ctx1.replace(';', ',')
		ctx1 = ctx1.replace('|', ',')
		s1 = ctx1.split(',')
		await ctx.send('I choose **{}**!'.format(random.choice(s1)))
	except:
		await ctx.send('Error')

client.run(os.getenv('TOKEN'))

I’m going to guess but it looks like you’re hitting some usage rate limit

Yeah, I looked into the discord API and figured out that it was because my bot was sending too many requests and want to know how I could possibly fix my code.

I’ll leave it for others familiar with how the limits are set (perhaps you can find what those throttling limits are) but generally speaking you fix it by not reaching those limits. That would depend upon what your bot does and how many servers are using it (I would guess).