【问题标题】:discord py get guild ID in taskdiscord py在任务中获取公会ID
【发布时间】:2022-12-10 23:37:33
【问题描述】:

你好,我是 discord py 的新手,我想在我的任务中使用公会 ID 我如何在我的任务中做到这一点我希望有人能帮助我

    async def count_channel_task(self):
        async with aiosqlite.connect(self.DB) as db:
           async with db.execute("SELECT channel_id FROM count_channels WHERE guild_id = ?", (guild.id,)) as cursor:
            result = await cursor.fetchone()

【问题讨论】:

    标签: python discord.py


    【解决方案1】:

    如果您的任务在机器人类中,那么您可以这样做:

    @tasks.loop(minutes=30)
    async def check_punishment(self):
        for guild in self.guilds:
            print(guild)
    

    Result

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-11-10
      • 2022-08-09
      • 2021-05-28
      • 1970-01-01
      • 2021-06-23
      • 2021-02-06
      • 1970-01-01
      • 2021-03-11
      相关资源
      最近更新 更多