Bots 使用Discord.py命令的Discord bot不工作.PLZ
我刚刚开始学习如何在discord.py中编写自己的机器人。然而,我在Youtube上遵循了教程,使用了完全相同的代码,但在我的服务器上不起作用Bots 使用Discord.py命令的Discord bot不工作.PLZ,bots,discord.py,Bots,Discord.py,我刚刚开始学习如何在discord.py中编写自己的机器人。然而,我在Youtube上遵循了教程,使用了完全相同的代码,但在我的服务器上不起作用 import discord from discord.ext import commands client = commands.Bot(command_prefix = '.') @client.command(pass_context = True) async def test(ctx): await ctx.send('Pong
import discord from discord.ext import commands
client = commands.Bot(command_prefix = '.')
@client.command(pass_context = True)
async def test(ctx):
await ctx.send('Pong!')
@client.event
async def on_ready():
print('Bot is ready')
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('hello'):
await message.channel.send('Hello there.')
@client.event
async def on_member_join(member):
print(f'{member}has joined the server!!')
@client.event
async def on_member_remove(member):
print(f'Seeya,{member}. Oh wait\n can we?')
client.run('NzU1MjI2Mzk1MjM5Nzc2Mjg2.XGGNZA.s2qLVQMONMLqs1f8Zky9wtM6ZDo')
覆盖\u消息上提供的默认值
将禁止运行任何额外的命令。若要解决此问题,请在消息的末尾添加client.process\u命令(消息)
行
@client.event
异步def on_消息(消息):
如果message.author==client.user:
返回
如果message.content.startswith('hello'):
等待message.channel.send('您好')
等待客户端处理命令(消息)
非常感谢您!问题解决了。