当前位置: 首页 > 知识库问答 >
问题:

为什么会出现此错误消息上的命令已是现有命令或别名

易镜
2023-03-14

我有这个代码的麻烦(抱歉,它的巨大):

import discord, random, asyncio, datetime, time, os
from discord.utils import get
from discord.ext import commands
from discord.ext.commands import bot
import json 

bot = commands.Bot(command_prefix="aag!", case_insensitive=True)

@bot.event
async def on_ready():
  await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="dick pills"))
  print("gay")

@bot.event
async def on_guild_join(guild):
  for channel in guild.text_channels:
    if channel.permissions_for(guild.me).send_messages:
      await channel.send('**Hello I am AAG Bot! Here are some of my features:                          **__AAG Ultimate Team:__** _To get started with AAG UT start with the command_ `aag!UT`                           **__Signing Method:__** _Give all credit to @Doggy for making this part possible!_                           **__Economy Commands for UT:__** _to start using economy use command_ `aag!signup`')
      break

@bot.check
async def __before_invoke(ctx):
    if not ctx.message.author.bot:
        return True

@bot.command()
async def on_message(message, member: discord.Member, *, role: discord.Role):
  if bot.user.id != message.author.id:
    if f':ARI1: sign {member.mention}' in message.content:
      await bot.say(f"**Signing {member.mention} to Arizona Cardinals**")
      await bot.add_roles(member, role="@Arizona Cardinals")
      await bot.say(f"**{member.mention} Signed to Arizona Cardinals**")

@bot.command()
async def on_message(message, member: discord.Member, *, role: discord.Role):
  if bot.user.id != message.author.id:
    if f':ATL1: sign {member.mention}' in message.content:
      await bot.say(f"**Signing {member.mention} to Atlanta Falcons**")
      await bot.add_roles(member, role="@Atlanta Falcons")
      await bot.say(f"**{member.mention} Signed to Atlanta Falcons**")

@bot.command()
async def on_message(message, member: discord.Member, *, role: discord.Role):
  if bot.user.id != message.author.id:
    if f':BAL1: sign {member.mention}' in message.content:
      await bot.say(f"**Signing {member.mention} to Baltimore Ravens**")
      await bot.add_roles(member, role="@Baltimore Ravens")
      await bot.say(f"**{member.mention} Signed to Baltimore Ravens**")

@bot.command()
async def on_message(message, member: discord.Member, *, role: discord.Role):
  if bot.user.id != message.author.id:
    if f':BUF1: sign {member.mention}' in message.content:
      await bot.say(f"**Signing {member.mention} to Buffalo Bills**")
      await bot.add_roles(member, role="@Buffalo Bills")
      await bot.say(f"**{member.mention} Signed to Buffalo Bills**")

@bot.command()
async def on_message(message, member: discord.Member, *, role: discord.Role):
  if bot.user.id != message.author.id:
    if f':CAR1: sign {member.mention}' in message.content:
      await bot.say(f"**Signing {member.mention} to Carolina Panthers**")
      await bot.add_roles(member, role="@Carolina Panthers")
      await bot.say(f"**{member.mention} Signed to Carolina Panthers**")

@bot.command()
async def on_message(message, member: discord.Member, *, role: discord.Role):
  if bot.user.id != message.author.id:
    if f':CIN1: sign {member.mention}' in message.content:
      await bot.say(f"**Signing {member.mention} to Cincinnati Bengals**")
      await bot.add_roles(member, role="@Cincinnati Bengals")
      await bot.say(f"**{member.mention} Signed to Cincinnati Bengals**")

@bot.command()
async def on_message(message, member: discord.Member, *, role: discord.Role):
  if bot.user.id != message.author.id:
    if f':CHI1: sign {member.mention}' in message.content:
      await bot.say(f"**Signing {member.mention} to Chicago Bears**")
      await bot.add_roles(member, role="@Chicago Bears")
      await bot.say(f"**{member.mention} Signed to Chicago Bears**")

@bot.command()
async def on_message(message, member: discord.Member, *, role: discord.Role):
  if bot.user.id != message.author.id:
    if f':CLE1: sign {member.mention}' in message.content:
      await bot.say(f"**Signing {member.mention} to Cleveland Browns**")
      await bot.add_roles(member, role="@Cleveland Browns")
      await bot.say(f"**{member.mention} Signed to Cleveland Browns**")

@bot.command()
async def on_message(message, member: discord.Member, *, role: discord.Role):
  if bot.user.id != message.author.id:
    if f':DAL1: sign {member.mention}' in message.content:
      await bot.say(f"**Signing {member.mention} to Dallas Cowboys**")
      await bot.add_roles(member, role="@Dallas Cowboys")
      await bot.say(f"**{member.mention} Signed to Dallas Cowboys**")

@bot.command()
async def on_message(message, member: discord.Member, *, role: discord.Role):
  if bot.user.id != message.author.id:
    if f':DEN1: sign {member.mention}' in message.content:
      await bot.say(f"**Signing {member.mention} to Denver Broncos**")
      await bot.add_roles(member, role="@Denver Broncos")
      await bot.say(f"**{member.mention} Signed to Denver Broncos**")

@bot.command()
async def on_message(message, member: discord.Member, *, role: discord.Role):
  if bot.user.id != message.author.id:
    if f':DET1: sign {member.mention}' in message.content:
      await bot.say(f"**Signing {member.mention} to Detroit Lions**")
      await bot.add_roles(member, role="@Detroit Lions")
      await bot.say(f"**{member.mention} Signed to Detroit Lions**")

@bot.command()
async def on_message(message, member: discord.Member, *, role: discord.Role):
  if bot.user.id != message.author.id:
    if f':GB1: sign {member.mention}' in message.content:
      await bot.say(f"**Signing {member.mention} to Green Bay Packers**")
      await bot.add_roles(member, role="@Green Bay Packers")
      await bot.say(f"**{member.mention} Signed to Green Bay Packers**")

@bot.command()
async def on_message(message, member: discord.Member, *, role: discord.Role):
  if bot.user.id != message.author.id:
    if f':HOU1: sign {member.mention}' in message.content:
      await bot.say(f"**Signing {member.mention} to Houston Texans**")
      await bot.add_roles(member, role="@Houston Texans")
      await bot.say(f"**{member.mention} Signed to Houston Texans**")

@bot.command()
async def on_message(message, member: discord.Member, *, role: discord.Role):
  if bot.user.id != message.author.id:
    if f':IND1: sign {member.mention}' in message.content:
      await bot.say(f"**Signing {member.mention} to Indianapolis Colts**")
      await bot.add_roles(member, role="@Indianapolis Colts")
      await bot.say(f"**{member.mention} Signed to Indianapolis Colts**")

@bot.command()
async def on_message(message, member: discord.Member, *, role: discord.Role):
  if bot.user.id != message.author.id:
    if f':KC1: sign {member.mention}' in message.content:
      await bot.say(f"**Signing {member.mention} to Kansas City Chiefs**")
      await bot.add_roles(member, role="@Kansas City Chiefs")
      await bot.say(f"**{member.mention} Signed to Kansas City Chiefs**")

@bot.command()
async def on_message(message, member: discord.Member, *, role: discord.Role):
  if bot.user.id != message.author.id:
    if f':LAC1: sign {member.mention}' in message.content:
      await bot.say(f"**Signing {member.mention} to Los Angeles Chargers**")
      await bot.add_roles(member, role="@Los Angeles Chargers")
      await bot.say(f"**{member.mention} Signed to Los Angeles Chargers**")

@bot.command()
async def on_message(message, member: discord.Member, *, role: discord.Role):
  if bot.user.id != message.author.id:
    if f':LAR1: sign {member.mention}' in message.content:
      await bot.say(f"**Signing {member.mention} to Los Angeles Rams**")
      await bot.add_roles(member, role="@Los Angeles Rams")
      await bot.say(f"**{member.mention} Signed to Los Angeles Rams**")

@bot.command()
async def on_message(message, member: discord.Member, *, role: discord.Role):
  if bot.user.id != message.author.id:
    if f':JAX1: sign {member.mention}' in message.content:
      await bot.say(f"**Signing {member.mention} to Jacksonville Jaguars**")
      await bot.add_roles(member, role="@Jacksonville Jaguars")
      await bot.say(f"**{member.mention} Signed to Jacksonville Jaguars**")

@bot.command()
async def on_message(message, member: discord.Member, *, role: discord.Role):
  if bot.user.id != message.author.id:
    if f':MIA1: sign {member.mention}' in message.content:
      await bot.say(f"**Signing {member.mention} to Miami Dolphins**")
      await bot.add_roles(member, role="@Miami Dolphins")
      await bot.say(f"**{member.mention} Signed to Miami Dolphins**")

@bot.command()
async def on_message(message, member: discord.Member, *, role: discord.Role):
  if bot.user.id != message.author.id:
    if f':MIN1: sign {member.mention}' in message.content:
      await bot.say(f"**Signing {member.mention} to Minnesota Vikings**")
      await bot.add_roles(member, role="@Minnesota Vikings")
      await bot.say(f"**{member.mention} Signed to Minnesota Vikings**")

@bot.command()
async def on_message(message, member: discord.Member, *, role: discord.Role):
  if bot.user.id != message.author.id:
    if f':NE1: sign {member.mention}' in message.content:
      await bot.say(f"**Signing {member.mention} to New England Patriots**")
      await bot.add_roles(member, role="@New England Patriots")
      await bot.say(f"**{member.mention} Signed to New England Patriots**")

@bot.command()
async def on_message(message, member: discord.Member, *, role: discord.Role):
  if bot.user.id != message.author.id:
    if f':NO1: sign {member.mention}' in message.content:
      await bot.say(f"**Signing {member.mention} to New Orleans Saints**")
      await bot.add_roles(member, role="@New Orleans Saints")
      await bot.say(f"**{member.mention} Signed to New Orleans Saints**")

@bot.command()
async def on_message(message, member: discord.Member, *, role: discord.Role):
  if bot.user.id != message.author.id:
    if f':NYG1: sign {member.mention}' in message.content:
      await bot.say(f"**Signing {member.mention} to New York Giants**")
      await bot.add_roles(member, role="@New York Giants")
      await bot.say(f"**{member.mention} Signed to New York Giants**")

@bot.command()
async def on_message(message, member: discord.Member, *, role: discord.Role):
  if bot.user.id != message.author.id:
    if f':NYJ1: sign {member.mention}' in message.content:
      await bot.say(f"**Signing {member.mention} to New York Jets**")
      await bot.add_roles(member, role="@New York Jets")
      await bot.say(f"**{member.mention} Signed to New York Jets**")

@bot.command()
async def on_message(message, member: discord.Member, *, role: discord.Role):
  if bot.user.id != message.author.id:
    if f':LV1: sign {member.mention}' in message.content:
      await bot.say(f"**Signing {member.mention} to Las Vegas Raiders**")
      await bot.add_roles(member, role="@Las Vegas Raiders")
      await bot.say(f"**{member.mention} Signed to Las Vegas Raiders**")

@bot.command()
async def on_message(message, member: discord.Member, *, role: discord.Role):
  if bot.user.id != message.author.id:
    if f':PHI1: sign {member.mention}' in message.content:
      await bot.say(f"**Signing {member.mention} to Philadelphia Eagles**")
      await bot.add_roles(member, role="@Philadelphia Eagles")
      await bot.say(f"**{member.mention} Signed to Philadelphia Eagles**")

@bot.command()
async def on_message(message, member: discord.Member, *, role: discord.Role):
  if bot.user.id != message.author.id:
    if f':SF1: sign {member.mention}' in message.content:
      await bot.say(f"**Signing {member.mention} to San Francisco 49ers**")
      await bot.add_roles(member, role="@San Francisco 49ers")
      await bot.say(f"**{member.mention} Signed to San Francisco 49ers**")

@bot.command()
async def on_message(message, member: discord.Member, *, role: discord.Role):
  if bot.user.id != message.author.id:
    if f':SEA1: sign {member.mention}' in message.content:
      await bot.say(f"**Signing {member.mention} to Seattle Seahawks**")
      await bot.add_roles(member, role="@Seattle Seahawks")
      await bot.say(f"**{member.mention} Signed to Seattle Seahawks**")

#keep_alive.keep_alive()
token = os.environ.get("TOKEN")
bot.run(token, bot=True)

不要说令牌不在那里,我知道它不在那里。

但是我得到了这个错误信息:

回溯(最后一次调用):文件“main.py”,第137行,异步定义on_消息(消息,成员:discord.member,*,角色:discord.role):文件“/opt/virtualenvs/python3/lib/python3.8/site packages/discord/ext/commands/core.py”,第1246行,decorator self。添加命令(结果)文件“/opt/virtualenvs/python3/lib/python3.8/site packages/discord/ext/commands/core.py”,第1138行,添加命令raise CommandRegistrationError(command.name)discord。外部命令。错误。CommandRegistrationError:_消息上的命令已是现有命令或别名。

我不知道这意味着什么请比我有更多知识的人请引导我通过这个LOL。

共有1个答案

徐淳
2023-03-14

Blockquote在消息2上的消息1上尝试调用它,依此类推:消息1上的异步定义(消息,成员:discord.member,*,角色:discord.role)-jacob galam

感谢雅各布代码现在工作!

 类似资料:
  • 我只是试着制作Discord机器人,我试着把这个命令放到一个类别中,但是,不管我怎么称呼这个命令,这个错误都会出现。这是我的密码: 这是我得到的错误: 无论我对命令做了多少更改,它都会不断给出相同的错误。

  • 当我尝试用pip(python)安装软件包时,遇到了一个问题。我认为这与路径有关,因为我用它做了一些事情。这就是错误所在

  • 我正在用python开发一个discord bot,但只要我运行代码,它就会显示一个错误

  • 当我运行命令时,它会导致以下错误 [照明\数据库\查询异常]SQLSTATE[42S01]:基表或视图已经存在:1050表'用户'已经存在(SQL:创建表<代码>用户 (<代码>idint unsignnot nullauto_increment主键,<代码>namevarchar(255)not null,<代码>emailvarchar(255)not null,<代码>密码varchar(2

  • 问题内容: 我正在尝试运行以下内容。 如果我删除以下行: 至.... 一切都会正常。如果没有,我得到以下错误: 命令不同步; 您现在不能运行此命令 在研究,我认为这可能是由于多个库MySQLi查询同时运行,其中使用但在所有样品和通用数据导向似乎并不适用。 有任何想法吗? 问题答案: MySQL客户端不允许您执行新的查询,在该查询中仍需要从正在进行的查询中获取行。有关常见错误,请参见MySQL文档中

  • 问题内容: 我正在尝试使用DB2运行一个简单的SQL语句,并且遇到了一些问题。我想在txt / db2文件中有一个脚本,并让引擎处理所有命令 这是脚本: 当我运行db2 -f / pathtofile时,我得到: 我究竟做错了什么?我的脚本有问题吗?另外,为什么没有“;”也能正常工作 我的陈述结尾处的终止符? 谢谢, 问题答案: 可能会有帮助, http://www.uc.edu/R/r25/do