[Python] Discord.py How to make a command happen a set amount of times

Discussão em 'Python' iniciado por Stack, Novembro 23, 2024.

  1. Stack

    Stack Membro Participativo

    So I'm currently making a fun command called tornado that takes a user and moves them around a bunch of voice channels. What I want to be able to do is make the command >tornado @Blah#1234 5 and have them be moved through the 6 voice channels 5 times before they aare returned to voice channel 0 (the initial voice channel). So far I am able to command >tornado @Blah#1234 and they are moved through the 6 voice channels once and then are returned to their original voice channel. Any help is appreciated!

    @bot.command(pass_context=True)
    async def tornado(ctx, member: discord.Member):
    voice1 = bot.get_channel(824745972768702525)
    voice2 = bot.get_channel(729916324272144439)
    voice3 = bot.get_channel(729927718296223839)
    voice4 = bot.get_channel(775807325641375744)
    voice5 = bot.get_channel(729958198957834290)
    voice6 = bot.get_channel(729958233669632020)
    voice0 = member.voice.channel
    await member.move_to(voice1) ; sleep(0.1)
    await member.move_to(voice2) ; sleep(0.1)
    await member.move_to(voice3) ; sleep(0.1)
    await member.move_to(voice4) ; sleep(0.1)
    await member.move_to(voice5) ; sleep(0.1)
    await member.move_to(voice6) ; sleep(0.1)
    await member.move_to(voice0)

    Continue reading...

Compartilhe esta Página