#dose anyone know how to give someone a role
1 messages · Page 1 of 1 (latest)
Member isn't defined there, use await ctx.author.add_role(role_id)
ok
it comes up with lots of errors
@slash_command(name="New", description="ONLY USE IF YOU ARE NEW")
async def my_long_command_function(ctx: SlashContext):
await ctx.author.add_role(1108540941708562503)
- That command name doesn't match the required regex, there can't be capital letters
- What are the errors
Traceback (most recent call last):
File "c:\Users\matth\Desktop\import interactions.py", line 44, in <module>
@slash_command(name="New", description="ONLY USE IF YOU ARE NEW")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\matth\AppData\Local\Programs\Python\Python311\Lib\site-packages\interactions\models\internal\application_commands.py", line 932, in wrapper
cmd = SlashCommand(
^^^^^^^^^^^^^
File "<attrs generated init interactions.models.internal.application_commands.SlashCommand>", line 26, in init
File "C:\Users\matth\AppData\Local\Programs\Python\Python311\Lib\site-packages\interactions\models\internal\localisation.py", line 103, in converter
obj.setattr(obj.default_locale, str(value))
File "C:\Users\matth\AppData\Local\Programs\Python\Python311\Lib\site-packages\attr_make.py", line 1063, in setattr
nval = hook(self, a, val)
^^^^^^^^^^^^^^^^^^
File "C:\Users\matth\AppData\Local\Programs\Python\Python311\Lib\site-packages\attr\setters.py", line 23, in wrapped_pipe
rv = setter(instance, attrib, rv)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\matth\AppData\Local\Programs\Python\Python311\Lib\site-packages\attr\setters.py", line 52, in validate
v(instance, attrib, new_value)
File "C:\Users\matth\AppData\Local\Programs\Python\Python311\Lib\site-packages\interactions\models\internal\application_commands.py", line 89, in name_validator
raise ValueError(
ValueError: Slash Command names must be lower case and match this regex: ^[\w-](1, {32})$
You need to name all of the functions different things, they can't all be "my_long_command_function"
ok