Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/342.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python discord.py命令没有响应_Python_Python 3.x_Discord.py - Fatal编程技术网

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

代码:

  • 当我打字的时候。哈哈,机器人没有反应
  • 如果我输入“你好”,机器人会回答
  • 问题在哪里

覆盖\u消息上提供的默认值
将禁止运行任何额外命令。要解决此问题,请在消息的
末尾添加
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")