#dose anyone know how to give someone a role

1 messages · Page 1 of 1 (latest)

scarlet chasmBOT
#

Hey! Once your issue is solved, press the button below to close this thread!

severe fjord
#

Member isn't defined there, use await ctx.author.add_role(role_id)

neon oriole
#

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)

severe fjord
#
  1. That command name doesn't match the required regex, there can't be capital letters
  2. What are the errors
neon oriole
#

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})$

severe fjord
#

Yeah doesn't match the regex

#

Make the command name "new" instead of "New"

neon oriole
#

ok

#

it works thanks

#

look

#

now none of my codes are showing up

severe fjord
#

You need to name all of the functions different things, they can't all be "my_long_command_function"

neon oriole
#

ok