Discord bot不返回数据

时间:2020-09-22 12:27:36

标签: python discord discord.py

我正在忙着建立一个简单的不和谐机器人,我已经设置了一些基本命令,但是只有1个有效,这是Botty.member_count和Botty.community_report()下面的代码,不能发挥任何帮助 令牌是*的原因很明显


client = discord.Client()
token = '**********************************'


@client.event  # event decorator/wrapper
async def on_ready():
    print(f"We have logged in as {client.user}")

@client.event
async def on_message(message):
    print(f"{message.channel}: {message.author}: {message.author.name}: {message.content}")
    Botty_guild = client.get_guild(543140047449358338)


    if "hello" in message.content.lower():
        await message.channel.send("HI!")


    if "Botty.member_count" == message.content.lower():
        await message.channel.send(f"```{Botty_guild.member_count}```")
    
    elif "Botty.community_report()" == message.content.lower():
        online = 0
        idle = 0
        offline = 0

        for m in Botty_guild.members:
            if str(m.status) == "online":
                online += 1
            if str(m.status) == "offline":
                offline += 1
            else:
                idle += 1

        await message.channel.send(f"```Online: {online}.\nIdle/busy/dnd: {idle}.\nOffline: {offline}```")

client.run(token)``` 

0 个答案:

没有答案
相关问题