Hello I am trying to setup cogs in my nextcord discord bot, but i get this warning/error:
MissingApplicationCommandParametersWarning: Callback SlashApplicationCommand ping <function Ping.ping at 0x000002D0F5288F40> is missing the self and/or interaction parameters. Please double check your function definition.
and I also do not get the ability to perform any slash commands in the discord server that I have the bot in.
Here is the following code:
in a moderation folder in the cogs folder I have an __init__.py
file with the following:
from nextcord.ext import commands, application_checks
import nextcord
class Ping(commands.Cog, name="Ping"):
def __init__(self, bot: commands.Bot):
self.bot = bot
@nextcord.slash_command(name="ping", description="Slash command that responds with 'Hello World'")
async def ping(self, ctx: commands.Context):
print("Received ping")
await ctx.send("Pong!")
def setup(bot: commands.Bot):
bot.add_cog(Ping(bot))
Then in a main.py
file I have this code:
activity = nextcord.Game(name="with joe mamas balls")
intents = nextcord.Intents.all()
class Overlord(commands.Bot):
def __init__(self):
super().__init__(command_prefix="!", intents=intents, activity= activity)
for folder in os.listdir("cogs"):
self.load_extension(f"cogs.{folder}")
async def setup_hook(self):
for ext in self.cogslist:
await self.load_extension(ext)
async def on_connect(self):
logger.info("OVERLORD IS CONNECTED")
async def on_ready(self):
logger.info("OVERLORD IS READY")
if __name__ == "__main__":
client = Overlord()
client.run("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")