I’m having some trouble creating a subcommand group for my Discord bot, coded in Python using Pycord, a popular & actively maintained fork of discord.py
from __future__ import annotations
from .. import module
from core import Bot, Embed
from discord import Interaction, app_commands, Member #type:ignore
import discord #type:ignore
class Modules(module):
def __init__(self, bot: Bot) -> None:
self.bot = bot
group = discord.Group(name="module", description="Module cog")
async def setup(bot: Bot) -> None:
await bot.add_cog(Modules(bot))
Whenever I try to run my main script which runs / starts the bot, I get this error:
raise errors.ExtensionFailed(key, e) from e discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.Admin.module' raised an error: AttributeError: module 'discord' has no attribute 'Group'
Anybody know maybe what’s up with this?
I have tried to look at many fourms, including Stackoverflow, discord.py docs, and other trusted fourm sites. They seem to work for many people, but it won’t work for me, because I use app_commands instead of “@bot.slash_command” which is what most people use. I created an advanced setup for my bot, and I will have to completely rewrite my entire system if I want to not use “app_commands”
I have tried using “@Bot.group”, “@bot.group”, “@discord.group”, and “@discord.Group”, and I just CANNOT figure this out!
NotManta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.