Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.

Commit

Permalink
refactor: help with attrs typing of app cmds (#701)
Browse files Browse the repository at this point in the history
  • Loading branch information
LordOfPolls committed Oct 31, 2022
1 parent 0f50830 commit e05b6cc
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions naff/models/naff/application_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class InteractionCommand(BaseCommand):
"""

name: LocalisedName = attrs.field(
name: LocalisedName | str = attrs.field(
repr=False, metadata=docs("1-32 character name") | no_export_meta, converter=LocalisedName.converter
)
scopes: List["Snowflake_Type"] = attrs.field(
Expand Down Expand Up @@ -323,7 +323,7 @@ class SlashCommandChoice(DictSerializationMixin):
"""

name: LocalisedField = attrs.field(repr=False, converter=LocalisedField.converter)
name: LocalisedField | str = attrs.field(repr=False, converter=LocalisedField.converter)
value: Union[str, int, float] = attrs.field(
repr=False,
)
Expand Down Expand Up @@ -351,11 +351,11 @@ class SlashCommandOption(DictSerializationMixin):
"""

name: LocalisedName = attrs.field(repr=False, converter=LocalisedName.converter)
name: LocalisedName | str = attrs.field(repr=False, converter=LocalisedName.converter)
type: Union[OptionTypes, int] = attrs.field(
repr=False,
)
description: LocalisedDesc = attrs.field(
description: LocalisedDesc | str = attrs.field(
repr=False, default="No Description Set", converter=LocalisedDesc.converter
)
required: bool = attrs.field(repr=False, default=True)
Expand Down Expand Up @@ -455,19 +455,19 @@ def as_dict(self) -> dict:

@attrs.define(eq=False, order=False, hash=False, kw_only=True)
class SlashCommand(InteractionCommand):
name: LocalisedName = attrs.field(repr=False, converter=LocalisedName.converter)
name: LocalisedName | str = attrs.field(repr=False, converter=LocalisedName.converter)
description: LocalisedDesc = attrs.field(
repr=False, default="No Description Set", converter=LocalisedDesc.converter
)

group_name: LocalisedName = attrs.field(
group_name: LocalisedName | str = attrs.field(
repr=False, default=None, metadata=no_export_meta, converter=LocalisedName.converter
)
group_description: LocalisedDesc = attrs.field(
repr=False, default="No Description Set", metadata=no_export_meta, converter=LocalisedDesc.converter
)

sub_cmd_name: LocalisedName = attrs.field(
sub_cmd_name: LocalisedName | str = attrs.field(
repr=False, default=None, metadata=no_export_meta, converter=LocalisedName.converter
)
sub_cmd_description: LocalisedDesc = attrs.field(
Expand Down

0 comments on commit e05b6cc

Please sign in to comment.