TypeError: emoji() takes 1 positional argument but 2 were given
eltaylor1104 opened this issue · comments
@inter_client.slash_command(guild_ids=bonbot_support)
async def emoji(ctx):
pass
@emoji.sub_command(description="steal an emoji with an option to lock it to a role", options=[Option("emoji", "an emoji to steal", OptionType.STRING, required=True),
Option("role", "A role to lock this emoji to. (User must have this role to use emoji)", OptionType.ROLE)], guild_ids=bonbot_support)
@slash_commands.guild_only()
@slash_commands.has_permissions(manage_emojis=True)
async def steal(self, ctx, emoji, role):
c = commands.EmojiConverter() # create instance
emoji_final = await c.convert(emoji)
# fetch the emoji asset and read it as bytes.
emoji_bytes = await emoji_final.read()
emoji_roles = [role]
await ctx.guild.create_custom_emoji(name=emoji_final.name, image=emoji_bytes, roles=emoji_roles)
await ctx.send("Created emoji!", ephemeral=True)
I get this error when I run this code, I even added print("number")
after every step and it doesn't print anything. Not sure what is happening, I have asked for help in several servers and nobody can figure it out. When I run the same code as a regular command, (removing the components parts) it works flawlessly. Full error: https://mystb.in/UrwPutsGarlic.apache
You forgot self
in async def emoji
Also, I suspect that you forgot to pass ctx
to c.convert
Let me know if it works
thanks so much, that worked. I can't believe I missed something so simple, here I was thinking it was something super big.