Python Discord.py bot命令问题

Python Discord.py bot命令问题,python,bots,discord,discord.py,Python,Bots,Discord,Discord.py,我在我的discord机器人上遇到了一个问题。命令不起作用。我认为代码不是问题。除了命令外,一切都很完美。不和谐,如果我使用!在这里测试mytext,什么都不会发生 提前谢谢你 import discord from discord.ext.commands import Bot from discord.ext import commands import asyncio import time import random from PIL import Image token=('MyTo

我在我的discord机器人上遇到了一个问题。命令不起作用。我认为代码不是问题。除了命令外,一切都很完美。不和谐,如果我使用!在这里测试mytext,什么都不会发生

提前谢谢你

 import discord
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio
import time
import random
from PIL import Image
token=('MyToken')

client = discord.Client()
bot = commands.Bot(command_prefix='!')

@client.event
async def on_ready():
    print('We have logged in as {0.user}'.format(client))



@bot.command()
async def test(ctx, arg):
    await ctx.send(arg)



client.run(token)

我认为这里的问题是您需要将上下文传递到@bot.command,如下所示:

@bot.command(pass_context=True)

欢迎请注意,问题是这样的。对不起,我没有注意到我正在用另一种语言写作。您想要客户端还是bot?您正在混合它们(注意您是如何运行客户机的,但用BOT修饰命令的)。删除客户端并使用机器人。BrainDead的答案是正确的,您同时使用客户端和机器人。您应该摆脱
client=discord.client()
并离开bot。然后将
@client.event
client.run(令牌)
更改为
@bot.event
bot.run(令牌)