31
31
from collections import OrderedDict
32
32
from typing import Any , Callable , Dict , List , Optional , Union
33
33
34
- from ..enums import SlashCommandOptionType , ChannelType
34
+ from ..enums import OptionType , ChannelType
35
35
from ..member import Member
36
36
from ..user import User
37
37
from ..message import Message
@@ -399,7 +399,7 @@ def to_dict(self) -> Dict:
399
399
"options" : [o .to_dict () for o in self .options ],
400
400
}
401
401
if self .is_subcommand :
402
- as_dict ["type" ] = SlashCommandOptionType .sub_command .value
402
+ as_dict ["type" ] = OptionType .sub_command .value
403
403
404
404
return as_dict
405
405
@@ -419,14 +419,14 @@ async def _invoke(self, ctx: ApplicationContext) -> None:
419
419
420
420
# Checks if input_type is user, role or channel
421
421
if (
422
- SlashCommandOptionType .user .value
422
+ OptionType .user .value
423
423
<= op .input_type .value
424
- <= SlashCommandOptionType .role .value
424
+ <= OptionType .role .value
425
425
):
426
426
name = "member" if op .input_type .name == "user" else op .input_type .name
427
427
arg = await get_or_fetch (ctx .guild , name , int (arg ), default = int (arg ))
428
428
429
- elif op .input_type == SlashCommandOptionType .mentionable :
429
+ elif op .input_type == OptionType .mentionable :
430
430
arg_id = int (arg )
431
431
arg = await get_or_fetch (ctx .guild , "member" , arg_id )
432
432
if arg is None :
@@ -498,9 +498,9 @@ def __init__(
498
498
self .description = description or "No description provided"
499
499
500
500
self .channel_types = []
501
- if not isinstance (input_type , SlashCommandOptionType ):
502
- self .input_type = SlashCommandOptionType .from_datatype (input_type )
503
- if self .input_type == SlashCommandOptionType .channel :
501
+ if not isinstance (input_type , OptionType ):
502
+ self .input_type = OptionType .from_datatype (input_type )
503
+ if self .input_type == OptionType .channel :
504
504
input_type = (input_type ,) if not isinstance (input_type , tuple ) else input_type
505
505
for i in input_type :
506
506
if i .__name__ == 'GuildChannel' :
@@ -572,7 +572,7 @@ def __init__(
572
572
validate_chat_input_name (name )
573
573
validate_chat_input_description (description )
574
574
super ().__init__ (
575
- SlashCommandOptionType .sub_command_group ,
575
+ OptionType .sub_command_group ,
576
576
name = name ,
577
577
description = description ,
578
578
)
0 commit comments