Python discord.py命令没有响应
代码:Python discord.py命令没有响应,python,python-3.x,discord.py,Python,Python 3.x,Discord.py,代码: 当我打字的时候。哈哈,机器人没有反应 如果我输入“你好”,机器人会回答 问题在哪里 覆盖\u消息上提供的默认值将禁止运行任何额外命令。要解决此问题,请在消息的末尾添加bot.process\u命令(消息)行 import discord from discord.ext.commands import Bot from discord.ext import commands bot = Bot(command_prefix = ".") @bot.event
- 当我打字的时候。哈哈,机器人没有反应
- 如果我输入“你好”,机器人会回答
- 问题在哪里
将禁止运行任何额外命令。要解决此问题,请在消息的末尾添加bot.process\u命令(消息)
行
import discord
from discord.ext.commands import Bot
from discord.ext import commands
bot = Bot(command_prefix = ".")
@bot.event
async def on_message(message):
print(message.content)
if message.author == bot.user:
return
if message.content.startswith("hello"):
await message.channel.send('hello!')
@bot.command(name="lol")
async def _lol(ctx):
print("lelele")
print(ctx.author)
await ctx.send("lelele")
import discord
from discord.ext.commands import Bot
from discord.ext import commands
bot = Bot(command_prefix=".")
@bot.event
async def on_message(message):
print(message.content)
if message.author == bot.user:
return
if message.content.startswith("hello"):
await message.channel.send('hello!')
await bot.process_commands(message)
@bot.command(name="lol")
async def _lol(ctx):
print("lelele")
print(ctx.author)
await ctx.send("lelele")