Discord.py How do I make my function loop?

bboychris168

How do I make the loop run every 5 seconds and update the queue list?

@tasks.loop(seconds=5.0)
async def queue_check():
    channel = client.get_channel(2342354325223424224)
    queue = []
    for members in channel.members:
        queue.append(members.display_name)
        queue_check.start()
        print(queue)```
Łukasz Kwieciński

Well you need to start it, but not inside the loop itself

@tasks.loop(seconds=5.0)
async def queue_check():
    channel = client.get_channel(2342354325223424224)
    queue = []
    for members in channel.members:
        queue.append(members.display_name)
        print(queue)


queue_check.start()

You can either start it in the on_ready event, in the global scope or in a command, you can also stop it using queue_check.stop

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

how do i make my function returns multiple values within my for-loop? (Beginner)

From Dev

how can i make my discord.py bot send a message i choose to a channel i choose?

From Dev

(discord.py) How can I make my bot randomly reply to DMs?

From Dev

How can I make my chat filter block symbols in swear words? (discord.py)

From Dev

Monogame - How do I make my if statement loop?

From Dev

How do I make my while loop fire once a minute?

From Java

discord.py (rewrite) How do I make a command to a specific channel

From Dev

How do i make it so if theres no one mentioned it returns with a value discord.py

From Dev

How do I check if the same user replies to my discord.py bot

From Dev

How do I make my Discord Bot make a message right after it's launched?

From Dev

How do I make my rotate function work?

From Dev

How do I get a counter to work within a discord.py command function?

From Dev

How do I make my c# Discord Bot notify my server when I upload a YouTube video to my channel

From Dev

How can I make my "say" command delete the command message, while keeping the bot's message? (discord.py)

From Dev

How do I get my logic in this Java program to make my loop work?

From Dev

How do I stop my bot from responding to @everyone pings but also respond to @Bot pings in discord.py?

From Java

How do I stop the execution of a command in discord.py

From Dev

How do I create a custom cycling status in discord.py?

From Dev

BeautifulSoup Python how do i return all the values from my for loop as list in my function

From Dev

How can I make my Discord bot respond to mentions?

From Dev

How do I make a for loop that increase the end of my WPF image name?

From Dev

How do I make a contextmanager with a loop inside?

From Dev

How do I make this loop work?

From Dev

How i make a top servers in my bot.py?

From Dev

How do I get my code to loop?

From Dev

How do I make my JTable editable?

From Dev

How do I make this shorter in my terminal?

From Dev

How do I make my windows "wavy"?

From Dev

how do i make my code shorter

Related Related

  1. 1

    how do i make my function returns multiple values within my for-loop? (Beginner)

  2. 2

    how can i make my discord.py bot send a message i choose to a channel i choose?

  3. 3

    (discord.py) How can I make my bot randomly reply to DMs?

  4. 4

    How can I make my chat filter block symbols in swear words? (discord.py)

  5. 5

    Monogame - How do I make my if statement loop?

  6. 6

    How do I make my while loop fire once a minute?

  7. 7

    discord.py (rewrite) How do I make a command to a specific channel

  8. 8

    How do i make it so if theres no one mentioned it returns with a value discord.py

  9. 9

    How do I check if the same user replies to my discord.py bot

  10. 10

    How do I make my Discord Bot make a message right after it's launched?

  11. 11

    How do I make my rotate function work?

  12. 12

    How do I get a counter to work within a discord.py command function?

  13. 13

    How do I make my c# Discord Bot notify my server when I upload a YouTube video to my channel

  14. 14

    How can I make my "say" command delete the command message, while keeping the bot's message? (discord.py)

  15. 15

    How do I get my logic in this Java program to make my loop work?

  16. 16

    How do I stop my bot from responding to @everyone pings but also respond to @Bot pings in discord.py?

  17. 17

    How do I stop the execution of a command in discord.py

  18. 18

    How do I create a custom cycling status in discord.py?

  19. 19

    BeautifulSoup Python how do i return all the values from my for loop as list in my function

  20. 20

    How can I make my Discord bot respond to mentions?

  21. 21

    How do I make a for loop that increase the end of my WPF image name?

  22. 22

    How do I make a contextmanager with a loop inside?

  23. 23

    How do I make this loop work?

  24. 24

    How i make a top servers in my bot.py?

  25. 25

    How do I get my code to loop?

  26. 26

    How do I make my JTable editable?

  27. 27

    How do I make this shorter in my terminal?

  28. 28

    How do I make my windows "wavy"?

  29. 29

    how do i make my code shorter

HotTag

Archive