【问题标题】:Discord.py run function in class at specific timeDiscord.py 在特定时间在课堂上运行函数
【发布时间】:2021-02-05 20:46:01
【问题描述】:

如何在每天 14:00 运行 DiscordClient().announceChallenge() 并且机器人/脚本 24/7 运行?

imports

class DiscordClient(discord.Client):
    def __init__(self):
        super().__init__()

    async def on_ready(self):
        print('Logged on as {0}!'.format(self.user))
    
    async def announceChallenge(self):)
        print("Announced the daily challenge")

client = DiscordClient()
client.run(token)```

【问题讨论】:

标签: python discord scheduled-tasks discord.py


【解决方案1】:

阅读有关the sched module 的文档。

Here 是一个简单的教程。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-29
    • 1970-01-01
    相关资源
    最近更新 更多