Add role by ID : interactions.py

41 Views Asked by At

I want to create a bot that creates three buttons and assigns a different role to each one.

My problem is that every method i use it dosn't work. It's my first discord bot project.

@slash_command(name="give_role")
async def give_role(ctx: SlashContext, role: Role):
    await ctx.author.add_roles(1210596582387490877)
    await ctx.send(f"Die Rolle {role.name} wurde dir erfolgreich gegeben.")

This is the code I made. But I have an error message: TypeError: give_role() missing 1 required keyword-only argument: 'role'

My seccond problem is that i don't know how to save the role.id in the buttons

0

There are 0 best solutions below