Discord Python机器人程序一直忽略“ if”并在关闭后保持在线状态

时间:2020-03-10 19:58:53

标签: python discord discord.py

import asyncio
import discord, csv, os, re  # requests
from discord.ext import commands
from discord.utils import get
from datetime import datetime
from discord.ext.commands import cooldown

# <editor-fold desc="Start up">
# Development
bot = commands.Bot(command_prefix='>', description='A Buushy Product')
date = datetime.now().strftime('%Y-%m-%d %H:%M:%S')


@bot.event
async def on_ready():
    print("The bot " + bot.user.name + " on ID " + str(bot.user.id) + " is running successfully!")
    await bot.change_presence(status=discord.Status.idle, activity=discord.Game("long term hide 'n' seek"))
    # await bot.change_presence(status=discord.Status.online, activity=discord.Game("Build 0.5.0"))
# </editor-fold>


@bot.event
async def on_message(msg):
    channel = msg.channel
    if msg.author.id == 686980452917051505 or 296366982599671809:
        if msg.content == "hi dad, yolo":
            async with channel.typing():
                await asyncio.sleep(3)
                await channel.send(f"Ok {msg.author.mention}, tell me all about it once I come back with some milk")
                await asyncio.sleep(300)
                await msg.author.send("Give me 5 more minutes, the line is long")
                x = 1
                while True:
                    await asyncio.sleep(300)
                    await msg.author.send("5 more minutes")
                    x =+ 1


TOKEN = "token"
bot.run(TOKEN)

标题说明了一切。它不会激活特定消息或特定用户消息,而是仅激活任何一条消息,并且在正确关闭漫游器后显示为空闲而不是离线

0 个答案:

没有答案