Discord 机器人不响应命令

Discord bot does no respond to command

最近,我一直在为我的朋友制作一个特定于服务器的 Discord 机器人。当我了解到 Discord API 可以使用前缀和命令事件而不是属性 startswith 时,我很快就开始更改我的整个代码。我保留了我的机器人的响应,但在 @bot.command 上将其更改为 运行。尽管指定了我的前缀和命令,但机器人没有响应我或服务器上的任何其他人。我不自觉地认为这是一个表情符号的前缀,但将其更改为“!”或“$”也不起作用。有谁知道为什么?

import discord
from discord.ext import commands
from dotenv import load_dotenv
from discord.ext.commands import Bot
import os
import json
import random
import requests

#welcome channel="852346049959821312"
client = discord.Client()
intents = discord.Intents.default()
intents.members=True
client = discord.Client(intents=intents)
bot = commands.Bot(command_prefix="<:givebanana:852295575772856400>")

@client.event
async def on_ready():
    print('We have logged in as {0.user}'.format(client))
    global points
    try:
        with open('data.txt') as f:
            points = json.load(f)
    except FileNotFoundError:
        print("Could not load data.json")
        points = {}

@client.event
async def on_member_join(member):
    embed=discord.Embed(title="Welcome",description="Be sure to change your status. Once that is done, you will be assigned the monke intern role. Why don't you say hello to our new monke, <@&852658353678319656>. Viva la monke!", color=discord.Color.from_rgb(0,128,0))
    embed.set_thumbnail(url=member.avatar_url)
    channel = client.get_channel(852677413367709706)
    await channel.send(f"{member.mention}", embed=embed)

@bot.command()
async def roles(ctx):
    embed=discord.Embed(title="Monke Roles",description="The more people DM you 'monke', the more points you earn.", color=discord.Color.from_rgb(255,255,53))
    embed.set_thumbnail(url="http://www.clker.com/cliparts/f/1/e/9/H/i/banana-md.png")
    embed.add_field(name="Points",value="Someone DMs you and joins the server= 2 points\n\nSomeone DMs you but doesn't join= 1 point\n",inline=False)
    embed.add_field(name=" Monke Employee",value="1 Point", inline=True)
    embed.add_field(name=" Monke Soldier",value="5 Points",inline=True)
    embed.add_field(name=" Monke Officer",value="10 Points",inline=True)
    embed.add_field(name="️ Monke General",value="20 Points",inline=True)
    embed.add_field(name=" Monke Mayor",value="30 Points",inline=True)
    embed.add_field(name="️ Monke Govenor",value="50 Points",inline=True)
    embed.add_field(name="️ Monke President",value="100 Points",inline=True)
    await ctx.send(ctx.author.mention,embed=embed)
    print('Command Sucessful')

@bot.command()
async def ping(ctx):
    await ctx.send('_**AH AH**_  Here!')

client.run('censoredtoken')

这是你声明你的机器人实例的方式,它应该是这样的

你是运行你的客户而不是机器人

intents = discord.Intents.default()
intents.members=True
bot = commands.Bot(command_prefix=prefix, intents=intents)


@bot.event
# code 

@bot.command()
# code 

bot.run('TOKEN')