Skip to content

Commit fc4ce41

Browse files
[BREAKING] Rename SlashCommandOptionType to OptionType
1 parent 3e2ac13 commit fc4ce41

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

discord/app/commands.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
from collections import OrderedDict
3232
from typing import Any, Callable, Dict, List, Optional, Union
3333

34-
from ..enums import SlashCommandOptionType, ChannelType
34+
from ..enums import OptionType, ChannelType
3535
from ..member import Member
3636
from ..user import User
3737
from ..message import Message
@@ -399,7 +399,7 @@ def to_dict(self) -> Dict:
399399
"options": [o.to_dict() for o in self.options],
400400
}
401401
if self.is_subcommand:
402-
as_dict["type"] = SlashCommandOptionType.sub_command.value
402+
as_dict["type"] = OptionType.sub_command.value
403403

404404
return as_dict
405405

@@ -419,14 +419,14 @@ async def _invoke(self, ctx: ApplicationContext) -> None:
419419

420420
# Checks if input_type is user, role or channel
421421
if (
422-
SlashCommandOptionType.user.value
422+
OptionType.user.value
423423
<= op.input_type.value
424-
<= SlashCommandOptionType.role.value
424+
<= OptionType.role.value
425425
):
426426
name = "member" if op.input_type.name == "user" else op.input_type.name
427427
arg = await get_or_fetch(ctx.guild, name, int(arg), default=int(arg))
428428

429-
elif op.input_type == SlashCommandOptionType.mentionable:
429+
elif op.input_type == OptionType.mentionable:
430430
arg_id = int(arg)
431431
arg = await get_or_fetch(ctx.guild, "member", arg_id)
432432
if arg is None:
@@ -498,9 +498,9 @@ def __init__(
498498
self.description = description or "No description provided"
499499

500500
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:
504504
input_type = (input_type,) if not isinstance(input_type, tuple) else input_type
505505
for i in input_type:
506506
if i.__name__ == 'GuildChannel':
@@ -572,7 +572,7 @@ def __init__(
572572
validate_chat_input_name(name)
573573
validate_chat_input_description(description)
574574
super().__init__(
575-
SlashCommandOptionType.sub_command_group,
575+
OptionType.sub_command_group,
576576
name=name,
577577
description=description,
578578
)

0 commit comments

Comments
 (0)