Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

172
Views
setTimeout in discord.py?

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!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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)
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!