@@ -307,7 +307,7 @@ It acceps a list of :class:`~SlashOption`
307307
308308 @ui.slash.command(name="test", description="this is a test command", options=[
309309 SlashOption(int, name="parameter1", description="this is a parameter")
310- ], guild_ids=[" 785567635802816595" ])
310+ ], guild_ids=[785567635802816595])
311311 async def command(ctx, parameter1="nothing"):
312312 await ctx.respond("I got `" + str(parameter1) + "` for `parameter1`")
313313
@@ -344,17 +344,13 @@ If you want the parameter to be required, in the option, you have to set ``requi
344344
345345 @ui.slash.command(name="test", description="this is a test command", options=[
346346 SlashOption(int, name="parameter1", description="this is a parameter", required=True)
347- ], guild_ids=[" 785567635802816595" ])
347+ ], guild_ids=[785567635802816595])
348348 async def command(ctx, parameter1):
349349 await ctx.respond("I got `" + str(parameter1) + "` for `parameter1`")
350350
351351 .. image :: images/slash/test_param_options_required.gif
352352 :width: 550
353353
354- .. note ::
355-
356- the ``parameter `` argument of the callback function doesn't have a default value anymore,
357- because if the command is used, it will always get a value passed
358354
359355Choices
360356~~~~~~~~~~
@@ -370,13 +366,28 @@ Too add them, where we add the options with the :class:`~SlashOption` class, we
370366 SlashOption(int, name="parameter1", description="this is a parameter", choices=[
371367 {"name": "first choice", "value": 1}, {"name": "second choice", "value": 2}
372368 ])
373- ], guild_ids=[" 785567635802816595" ])
369+ ], guild_ids=[785567635802816595])
374370 async def command(ctx, parameter1="nothing"):
375371 await ctx.respond("I got `" + str(parameter1) + "` for `parameter1`")
376372
377373 Choices are a list of dict, where ``"name": `` is the displayed choice name and ``"value": `` is the real value,
378374which will be received when the choice is selected
379375
376+ You can also use the ``create_choice `` function to make it easier
377+
378+ .. code-block ::
379+
380+ from discord_ui import create_choice
381+ ...
382+
383+ @ui.slash.command(name="test", description="this is a test command", options=[
384+ SlashOption(int, name="parameter1", description="this is a parameter", choices=[
385+ create_choice("first choice", 1), create_choice("second choice", 2)
386+ ])
387+ ], guild_ids=[785567635802816595])
388+ async def command(ctx, parameter1="nothing"):
389+ await ctx.respond("I got `" + str(parameter1) + "` for `parameter1`")
390+
380391 .. image :: images/slash/test_param_choices.gif
381392 :width: 550
382393
@@ -402,7 +413,7 @@ If the default permission to ``False``, no one can use the command, if it's ``Tr
402413
403414 @ui.slash.command(name="test", description="this is a test command", options=[
404415 SlashOption(int, name="parameter1", description="this is a parameter")
405- ], guild_ids=[" 785567635802816595" ], default_permission=False)
416+ ], guild_ids=[785567635802816595], default_permission=False)
406417 async def command(ctx, parameter1="nothing"):
407418 ...
408419
@@ -420,8 +431,8 @@ You can add role ids or/and user ids
420431
421432 @ui.slash.command(name="test", description="this is a test command", options=[
422433 SlashOption(int, name="parameter1", description="this is a parameter")
423- ], guild_ids=[" 785567635802816595" ], guild_permissions={
424- " 785567635802816595" : SlashPermission(
434+ ], guild_ids=[785567635802816595], guild_permissions={
435+ 785567635802816595: SlashPermission(
425436 allowed={
426437 "539459006847254542": SlashPermission.USER,
427438 "849035012476895232": SlashPermission.ROLE
@@ -444,6 +455,9 @@ Forbidden command
444455 :width: 1000
445456
446457
458+ You can later update the command permissions with the :meth: `~Slash.update_permissions ` function.
459+
460+
447461guild ids
448462~~~~~~~~~~~
449463
@@ -453,7 +467,7 @@ To set the guilds where the command is useable, you need to set the ``guild_id``
453467
454468.. code-block ::
455469
456- @ui.slash.command(name="test", description="this is a test command", guild_ids=[" 785567635802816595" ])
470+ @ui.slash.command(name="test", description="this is a test command", guild_ids=[785567635802816595])
457471 async def command(ctx, parameter1="nothing"):
458472 ...
459473
0 commit comments