on_message如何与client.command一起使用?
How to use on_message together with client.command?
@client.event
async def on_message(message):
await client.process_commands(message)
我不知道如何使用它。
上面的代码完全没问题。如果你还没有定义你的机器人,你必须这样做。
下面是简单的代码,大家可以根据需要修改。
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix = 'YOUR PREFIX')
@bot.command()
async def ling(ctx):
await ctx.send("Mabel")
@client.event
async def on_message(message):
await client.process_commands(message)
我不知道如何使用它。
上面的代码完全没问题。如果你还没有定义你的机器人,你必须这样做。 下面是简单的代码,大家可以根据需要修改。
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix = 'YOUR PREFIX')
@bot.command()
async def ling(ctx):
await ctx.send("Mabel")