不和机器人不响应我的前缀



请帮助我这个代码我为我的不和服务器。我不知道我在做什么,我需要弄清楚为什么当我使用!aczping(或者当我把它改成!)前缀)它什么都不做!谢谢你的帮助

import discord
import random
import os
from itertools import cycle
from discord.ext import commands, tasks
from discord.ext.commands import Bot
client = commands.Bot(command_prefix = "!acz")
status = cycle(['!acz // Senkuu by Rubix', 'acz!help - Made by AntsCzech', '!acz // Alpha v0.11.2, Made in Python (discord.py/repl.it)'])
bot = Bot("!acz")

@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@tasks.loop(seconds=20)
async def change_status ():
await client.change_presence(activity=discord.Game(next(status)))
@client.command()
async def test(ctx):
await ctx.channel.send("Command executed")
@client.command()
async def ping(ctx):
await ctx.send(f'Pong! {round(client.latency * 1000)} ms')
@client.event
async def on_command_error(ctx, error):
if isinstance(error,commands.MissingRequiredArgument):
await ctx.send('Chybí část příkazu, zkus to znovu.')
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('!acz ahoj'):
await message.channel.send('Hoj hoj!')
if message.content.startswith('!acz help'):
await message.channel.send ('**Voláš o pomoc?** nzatím ti nabídnu jen tyto příkazy: nn`!acz ahoj` Pozdravím tě! n`!acz help` Pošlu ti tento seznam')
elif message.content.startswith("!users"):
await message.channel.send(f"""# počet Uživatelů na serveru: {id.member_count}""") 
client.run(os.getenv('TOKEN'))

命令至少需要消息意图

将您的客户端实例定义行更改为

intents = discord.Intents.default()
client = commands.Bot(command_prefix = "!acz", intents=intents)

你的bot = bot(…)当您将bot实例定义为client时,没有意义。我建议您将实例重命名为bot。

最新更新