#commands.slash_command raising TypeError
1 messages · Page 1 of 1 (latest)
heres my code
@commands.slash_command()
async def conclude(self, ctx):
if await self.check(ctx) == 1:
return
else:
channel = self.check(ctx)
if str(channel.id) not in self.bot.rooms:
return await ctx.reply("You must be in a debate channel to use this command.")
if "participants" not in self.bot.rooms[str(channel.id)] or "debaters" not in self.bot.rooms[str(channel.id)]:
return await ctx.send("The room must have an ongoing debate for you to vote.")
if "concluded" not in self.bot.rooms[str(channel.id)]:
self.bot.rooms[str(channel.id)]["concluded"] = []
if ctx.author.id in self.bot.rooms[str(channel.id)]["concluded"]:
return await ctx.reply("You have already voted to conclude.")
self.bot.rooms[str(channel.id)]["concluded"].append(ctx.author.id)
if len(self.bot.rooms[str(channel.id)]["concluded"]) > (len(self.bot.rooms[str(channel.id)]["vc"].members)/2):
stance = None
if "for" not in self.bot.rooms[str(channel.id)] and "against" not in self.bot.rooms[str(channel.id)]:
stance = random.choice("for", "against")
if "for" not in self.bot.rooms[str(channel.id)]:
self.bot.rooms[str(channel.id)]["for"] = 0
if "against" not in self.bot.rooms[str(channel.id)]:
self.bot.rooms[str(channel.id)]["against"] = 0
stance = self.bot.rooms[str(channel.id)]["for"] if len(self.bot.rooms[str(channel.id)]["for"]) >= self.bot.rooms[str(channel.id)]["against"] else self.bot.rooms[str(channel.id)]["against"]
return self._end_debate(ctx, channel, stance)
return await ctx.reply("You have voted to conclude.")
can you send the full traceback please
File "C:\Users\Marley\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\cog.py", line 715, in _load_from_module_spec
spec.loader.exec_module(lib) # type: ignore
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\Marley\Documents\Wilson\plugins\debates\__init__.py", line 2, in <module>
from plugins.debates.debates import Debates
File "C:\Users\Marley\Documents\Wilson\plugins\debates\debates.py", line 25, in <module>
class Debates(commands.Cog):
File "C:\Users\Marley\Documents\Wilson\plugins\debates\debates.py", line 338, in Debates
async def conclude(self, ctx):
TypeError: slash_command() takes 0 positional arguments but 1 was given
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "main.py", line 20, in <module>
bot.load_extension(extension)
File "C:\Users\Marley\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\cog.py", line 787, in load_extension
self._load_from_module_spec(spec, name)
File "C:\Users\Marley\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\cog.py", line 718, in _load_from_module_spec
raise errors.ExtensionFailed(key, e) from e
discord.errors.ExtensionFailed: Extension 'plugins.debates' raised an error: TypeError: slash_command() takes 0 positional arguments but 1 was given
PS C:\Users\Marley\Documents\Wilson> ```
thats weird
commands is still defined as from discord.ext import commands and isn't changed at any point correct?
mhm
my only real guess is that you've got some sort of namespace conflict
i.e. discord.py isn't fully uninstalled or something went wrong in installation of the lib?
maybe
i'd uninstall all discord related libraries, including py-cord, and then reinstall py-cord==2.0.0rc1
i did install it from git with pip but i was just using from what i remember from discordpy
did the process ever change?
yeah thats the only command it does it on too
no indentation errors right? you are still in the cog indentation?
mhm
im reinstalling pycord right now
i didn't have dpy on this system to begin with
yeah same error even after reinstalling
damn that is weird
i looked at comits just now but the only recent changes to ext havent't been anything that should effect this
ill try to install latest release instead and see what happens
that fixed it
must be an issue with recent changes
at least those within the last month
nevermind im an idiot