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

refactor: help with attrs typing of app cmds #701

Merged
merged 1 commit into from
Oct 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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