I'm building a script which has multiple task loops, with different intervals. Naturally I would want to make a for-loop to define all of these, to make it take up less space. However, it seems like it's not possible to do so.
How can I shorten down this snippet? Is there actually a way?
timeloops = ["60","600","3600","7200","14400","21600"]
@tasks.loop(seconds=60)
async def task_60(self):
await second_func(self,channels["60"])
@tasks.loop(seconds=600)
async def task_600(self):
await second_func(self,channels["600"])
@tasks.loop(seconds=3600)
async def task_3600(self):
await second_func(self,channels["3600"])
@tasks.loop(seconds=7200)
async def task_7200(self):
await second_func(self,channels["7200"])
@tasks.loop(seconds=14400)
async def task_14400(self):
await second_func(self,channels["14400"])
@tasks.loop(seconds=21600)
async def task_21600(self):
await second_func(self,channels["21600"])
Another question on here lead me to use Globals, but it seems like that's only for calling the function, and not for defining it.
Thank you in advance.