@@ -95,6 +95,7 @@ def as_message_menu(
95
95
default_to_ephemeral : typing .Optional [bool ] = None ,
96
96
dm_enabled : typing .Optional [bool ] = None ,
97
97
is_global : bool = True ,
98
+ nsfw : bool = False ,
98
99
) -> _AsMsgResultProto :
99
100
"""Build a message [MenuCommand][tanjun.MenuCommand] by decorating a function.
100
101
@@ -145,6 +146,9 @@ async def message_command(self, ctx: tanjun.abc.MenuContext, message: hikari.Mes
145
146
will be used.
146
147
is_global
147
148
Whether this command is a global command.
149
+ nsfw
150
+ Whether this command should only be accessible in channels marked as
151
+ nsfw.
148
152
149
153
Returns
150
154
-------
@@ -185,6 +189,7 @@ def decorator(
185
189
default_to_ephemeral = default_to_ephemeral ,
186
190
dm_enabled = dm_enabled ,
187
191
is_global = is_global ,
192
+ nsfw = nsfw ,
188
193
_wrapped_command = wrapped_command ,
189
194
)
190
195
@@ -216,6 +221,7 @@ def as_user_menu(
216
221
default_to_ephemeral : typing .Optional [bool ] = None ,
217
222
dm_enabled : typing .Optional [bool ] = None ,
218
223
is_global : bool = True ,
224
+ nsfw : bool = False ,
219
225
) -> _AsUserResultProto :
220
226
"""Build a user [MenuCommand][tanjun.MenuCommand] by decorating a function.
221
227
@@ -268,6 +274,9 @@ async def user_command(
268
274
will be used.
269
275
is_global
270
276
Whether this command is a global command.
277
+ nsfw
278
+ Whether this command should only be accessible in channels marked as
279
+ nsfw.
271
280
272
281
Returns
273
282
-------
@@ -308,6 +317,7 @@ def decorator(
308
317
default_to_ephemeral = default_to_ephemeral ,
309
318
dm_enabled = dm_enabled ,
310
319
is_global = is_global ,
320
+ nsfw = nsfw ,
311
321
_wrapped_command = wrapped_command ,
312
322
)
313
323
@@ -328,6 +338,7 @@ class MenuCommand(base.PartialCommand[tanjun.MenuContext], tanjun.MenuCommand[_A
328
338
"_description" ,
329
339
"_is_dm_enabled" ,
330
340
"_is_global" ,
341
+ "_is_nsfw" ,
331
342
"_names" ,
332
343
"_parent" ,
333
344
"_tracked_command" ,
@@ -348,6 +359,7 @@ def __init__(
348
359
default_to_ephemeral : typing .Optional [bool ] = None ,
349
360
dm_enabled : typing .Optional [bool ] = None ,
350
361
is_global : bool = True ,
362
+ nsfw : bool = False ,
351
363
_wrapped_command : typing .Optional [tanjun .ExecutableCommand [typing .Any ]] = None ,
352
364
) -> None :
353
365
...
@@ -367,6 +379,7 @@ def __init__(
367
379
default_to_ephemeral : typing .Optional [bool ] = None ,
368
380
dm_enabled : typing .Optional [bool ] = None ,
369
381
is_global : bool = True ,
382
+ nsfw : bool = False ,
370
383
_wrapped_command : typing .Optional [tanjun .ExecutableCommand [typing .Any ]] = None ,
371
384
) -> None :
372
385
...
@@ -384,6 +397,7 @@ def __init__(
384
397
default_to_ephemeral : typing .Optional [bool ] = None ,
385
398
dm_enabled : typing .Optional [bool ] = None ,
386
399
is_global : bool = True ,
400
+ nsfw : bool = False ,
387
401
_wrapped_command : typing .Optional [tanjun .ExecutableCommand [typing .Any ]] = None ,
388
402
) -> None :
389
403
...
@@ -403,6 +417,7 @@ def __init__(
403
417
default_to_ephemeral : typing .Optional [bool ] = None ,
404
418
dm_enabled : typing .Optional [bool ] = None ,
405
419
is_global : bool = True ,
420
+ nsfw : bool = False ,
406
421
_wrapped_command : typing .Optional [tanjun .ExecutableCommand [typing .Any ]] = None ,
407
422
) -> None :
408
423
...
@@ -422,6 +437,7 @@ def __init__(
422
437
default_to_ephemeral : typing .Optional [bool ] = None ,
423
438
dm_enabled : typing .Optional [bool ] = None ,
424
439
is_global : bool = True ,
440
+ nsfw : bool = False ,
425
441
_wrapped_command : typing .Optional [tanjun .ExecutableCommand [typing .Any ]] = None ,
426
442
) -> None :
427
443
"""Initialise a user or message menu command.
@@ -475,6 +491,9 @@ def __init__(
475
491
will be used.
476
492
is_global
477
493
Whether this command is a global command.
494
+ nsfw
495
+ Whether this command should only be accessible in channels marked as
496
+ nsfw.
478
497
479
498
Returns
480
499
-------
@@ -513,6 +532,7 @@ def __init__(
513
532
self ._defaults_to_ephemeral = default_to_ephemeral
514
533
self ._is_dm_enabled = dm_enabled
515
534
self ._is_global = is_global
535
+ self ._is_nsfw = nsfw
516
536
self ._names = names
517
537
self ._parent : typing .Optional [tanjun .SlashCommandGroup ] = None
518
538
self ._tracked_command : typing .Optional [hikari .ContextMenuCommand ] = None
@@ -551,6 +571,11 @@ def is_global(self) -> bool:
551
571
# <<inherited docstring from tanjun.abc.AppCommand>>.
552
572
return self ._is_global
553
573
574
+ @property
575
+ def is_nsfw (self ) -> typing .Optional [bool ]:
576
+ # <<inherited docstring from tanjun.abc.AppCommand>>.
577
+ return self ._is_nsfw
578
+
554
579
@property
555
580
def name (self ) -> str :
556
581
# <<inherited docstring from tanjun.abc.AppCommand>>.
@@ -583,7 +608,10 @@ def wrapped_command(self) -> typing.Optional[tanjun.ExecutableCommand[typing.Any
583
608
def build (self , * , component : typing .Optional [tanjun .Component ] = None ) -> hikari .api .ContextMenuCommandBuilder :
584
609
# <<inherited docstring from tanjun.abc.MenuCommand>>.
585
610
builder = hikari .impl .ContextMenuCommandBuilder (
586
- type = self ._type , name = self ._names .default_value , name_localizations = self ._names .localised_values
611
+ type = self ._type ,
612
+ name = self ._names .default_value ,
613
+ name_localizations = self ._names .localised_values ,
614
+ is_nsfw = self ._is_nsfw ,
587
615
)
588
616
589
617
component = component or self ._component
0 commit comments