I have this code and i want it too work like a setTimeout function in discord.js but i dont know how. I want this code to show a slot machine in the embed and every time it spins, the second message edits itself for every letter it spins. I have these reference codes: https://cdn.discordapp.com/attachments/948236057097416766/954472309748555896/unknown.png https://cdn.discordapp.com/attachments/948236057097416766/954472151866564678/unknown.png https://cdn.discordapp.com/attachments/948236057097416766/954472868790546462/unknown.png https://cdn.discordapp.com/attachments/948236057097416766/954472868790546462/unknown.png https://cdn.discordapp.com/attachments/948236057097416766/954473890883715092/unknown.png
from a friend and he uses .js This is my code for slots:
#slots
@client.command()
async def slot(ctx,amount = None):
await open_account(ctx.author)
if amount == None:
em = discord.Embed(title='ERROR:', description='Please specify a amount you want to put in the slot!', color=0xff0000)
await ctx.send(embed = em)
return
bal = await update_bank(ctx.author)
amount = int(amount)
if amount>bal[0]:
em = discord.Embed(title='ERROR:', description="You don't have enough money!", color=0xff0000)
await ctx.send(embed = em)
return
if amount<10:
em = discord.Embed(title='ERROR:', description="Put a amount of ``10-70`` in the slot machine!", color=0xff0000)
await ctx.send(embed = em)
return
if amount>70:
em = discord.Embed(title='ERROR:', description="Put a amount of ``10-70`` in the slot machine!", color=0xff0000)
await ctx.send(embed = em)
return
final = []
for i in range(3):
a = random.choice([':regional_indicator_x:',':regional_indicator_o:',':regional_indicator_q:',':regional_indicator_g:',':regional_indicator_u:'])
final.append(a)
em3 = discord.Embed(title='Slot:', description=f'{final}', color=0xff000)
em3 = set.Image('https://cdn.discordapp.com/attachments/844618714439483435/954485256021508156/ezgif.com-gif-maker.gif')
await ctx.send(embed = em3)
as you can see on the last line i try to add that slots GIF. But i want it to spin 3 times and then the messages under it changes with it... I tried to clarify my goal with this a good as possible!
The python equivalent to JavaScript's setTimeout function is time.sleep.
An example usage of time.sleep is:
await ctx.send(embed = em)
sleep(200)
await ctx.send(embed = em3)