Python 我应该写什么行,这样当我写东西时,Discord机器人会以我想要的方式响应(Discord.py)?

Python 我应该写什么行,这样当我写东西时,Discord机器人会以我想要的方式响应(Discord.py)?,python,discord,discord.py,bots,Python,Discord,Discord.py,Bots,我不知道我应该用哪句话让机器人回复一条没有前缀的消息,比如我说“嗨”,他说“你好”。。。你能帮我吗 这是我的密码 import discord import os import requests import json import random from web import keep_alive from discord.ext import commands def command_prefix(bot, message): if message.guild is None:

我不知道我应该用哪句话让机器人回复一条没有前缀的消息,比如我说“嗨”,他说“你好”。。。你能帮我吗

这是我的密码

import discord
import os
import requests
import json
import random
from web import keep_alive
from discord.ext import commands

def command_prefix(bot, message):
    if message.guild is None:
        return ''
    else:
        return '\\'

client=commands.Bot(command_prefix=command_prefix,case_insensitive=True)
client.remove_command('help')

@client.event
async def on_ready():
  await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching,name='Having fun in 4 SERVER - DM Tomm#7615 to get the my invite link'))
  print('We have logged in as {0.user}'.format(client))

async def on_message(self, message):
    if message.content.startswith('here come dat boi'):
        await self.send_message(message.channel, 'o shit waddup!')

client.run('TOKEN')
感谢您的回答

祝你有个好朋友


Tomm

你就不能改变这个吗:

async def on_消息(self,message):
如果message.content.startswith('数据boi来了'):
等待自我。发送消息(message.channel'o shit waddup!')
为此:

async def on_消息(self,message):
如果message.content=='Hi':
等待self.send_消息(message.channel'Hello!')

这是哪个版本?。。。要重写其内容,请执行以下操作:

@client.event
异步def on_消息(消息):
如果message.content.startswith('数据boi来了'):
return wait message.channel.send('o shit waddup!')
elif message.content.startswith('Hi'):
return wait message.channel.send('Hello')返回等待消息

谢谢您的回答!可悲的是它不起作用了。。。我正在尝试另一种方法为什么不起作用?有错误消息吗?self.send\u消息已旧。。。ctx是正确的电流输出是多少?什么前缀?on_消息不起作用吗?