【问题标题】:Having some problem with discord bot which i am coding in replit我在 replit 中编码的不和谐机器人有一些问题
【发布时间】:2021-11-18 11:34:50
【问题描述】:

我无法在 replti.com 中启动我的不和谐机器人 他们的代码有什么问题吗?

import os

client = discord.Client()

@client.event
async def on_ready():
    print("I'm in")
    print(client.user)

@client.event
async def on_message(message):
    if message.author != client.user:
        await message.channel.send(message.content[::-1])

my_secret = os.environ['TOKEN']
client.run(my_secret)

【问题讨论】:

  • 你导入discord了吗?
  • 是的,我导入了不和谐模块
  • import discord 未出现在您的代码中。因此,如果您已导入它,请在您的问题中进行更改,以造福他人

标签: python-3.x python-requests discord discord.py


【解决方案1】:

你使用的方法不好。 而是这样做from discord.ext import commands

然后像这样插入命令:

@client.commands()
async def hello("")

【讨论】:

  • 好的,我现在就试试这个
猜你喜欢
  • 2021-06-27
  • 2021-07-20
  • 2022-11-10
  • 2021-08-18
  • 2021-11-14
  • 2020-06-08
  • 2019-02-26
  • 2019-09-04
  • 2020-12-25
相关资源
最近更新 更多