I got this error while trying to execute a command in a cog:
class SchoolBot(commands.Bot):
def __init__(self):
super().__init__(
command_prefix='!',
intents=Intents.all(),
sync_command=True,
application_id=APPID
)
async def setup_hook(self):
await self.load_extension("Cogs.Signup")
await bot.tree.sync(guild=Object())
async def on_ready(self):
print("Login Complete!")
print(self.user.name)
print(self.user.id)
print("===============")
game = Game("Taking school classes")
await self.change_presence(status=Status.online, activity=game)
Cogs/Signup.py:
class Application(Modal):
def __init__(self):
super.__init__("학교 정보 입력")
self.input = InputText(style=InputTextStyle.name, label="학교 이름", required=True)
self.add_item(self.input)
async def callback(self, interaction: Interaction) -> None:
spread.addRow([interaction.user.id, self.input.value, 0, 0])
class Signup(commands.Cog):
def __init__(self, bot: commands.Bot):
self.bot = bot
@commands.command()
async def register(self, ctx):
btn = Button(label='학교 등록', style=ButtonStyle.primary)
async def showEntry(self, interaction: Interaction) -> None:
app = Application()
interaction.response.send_modal(app)
btn.callback = showEntry
view = View()
view.add_item(btn)
await ctx.send('학교 등록을 위해 버튼 선택', view=view)
async def setup(bot: commands.Bot) -> None:
await bot.add_cog(Signup(bot))
Specific traceback:
Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "register" is not found
Additionally, I would be really thankful for pointing out other mistakes I made.