[英]How to add Time in Discord Bot?
你如何制作一個機器人 function 以便機器人刪除 0 點鍾的聊天(頻道)你如何在機器人中包含時間(Discord.py)
請舉個例子:)
謝謝
我用谷歌試過但沒有用所以請幫忙
只需使用 discord.ext.tasks 擴展名! 只需在您的代碼中實現此示例並對其進行修改,使其適合您的變量!
from discord.ext import tasks
from datetime import time #This at your import statements
purge_loop.start() # This cog_load function
@tasks.loop(time=time(hour=0, minute=0)) #this function in your cog
async def purge_loop(self):
await channel.purge(limit=1000)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.