dolfies / discord.py-self

A fork of the popular discord.py for user accounts.
https://discordpy-self.rtfd.io/en/latest/
MIT License
651 stars 154 forks source link

@tasks.loop(seconds=x) not working #591

Closed ZoomGC closed 6 months ago

ZoomGC commented 8 months ago

Summary

@tasks.loop(seconds=x) not working

Reproduction Steps

Download discord.py-self renamed (selfcord) import selfcord.ext.tasks Try to use @tasks.loop It doesn't do anything

Code

@tasks.loop(seconds = 10)
async def bump332():
        print("TEST")
        global guild; global chnl
        async for cmd in chnl.slash_commands(command_ids=[947088344167366698]):
                if cmd.name == "bump":
                        await cmd(chnl)

Expected Results

It runs the code that is in the function beneath

Actual Results

It is not doing anything as even the print statement doesn't work

System Information

Checklist

Additional Information

All variables which are uninitialised in this snippet of code shown are indeed initialised and properly referenced in code

idkrn123 commented 8 months ago

I don't see anywhere in the code where you're running "bump332.start()" to start the loop. Assuming it isn't somewhere outside of what you've shared here, that's the cause.

dolfies commented 6 months ago

That is indeed the issue. The tasks implementation is unchanged from upstream.