[英]Discord bot (python) edit own message itself every minute
import os
import discord
import requests
import time
import datetime
class MyClient(discord.Client):
async def on_ready(self):
await client.change_presence(activity=discord.Activity(type=0, name='HIDDENSTATUS'))
print('Logged on as {0}!'.format(self.user))
async def on_message(self, message):
msglower = message.content.lower()
channelStatusSV = client.get_channel(HIDDENCHANNELID)
if msglower == '!refresh':
standard = formated_info('HIDDENIP', '36963', 'ok')
messageStandard = await channelStatusSV.fetch_message(HIDDENMESSAGEID)
await messageStandard.edit(content=standard)
client = MyClient()
client.run('HIDDENTOKEN')
This is the full script (with some hidden info like IP, URL, etc).这是完整的脚本(带有一些隐藏信息,如 IP、URL 等)。
It fetches my game server info into an embedded bot message.它将我的游戏服务器信息提取到嵌入式机器人消息中。 Currently, it fetches info on demand.
目前,它按需获取信息。
How can I change it to automatically fetch every minute?如何将其更改为每分钟自动获取一次?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.