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)```
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.
Comments