From 15644e999017c4a439dfedfa626b86a9b06eeaf0 Mon Sep 17 00:00:00 2001 From: AstreaTSS <25420078+AstreaTSS@users.noreply.github.com> Date: Tue, 30 Apr 2024 14:51:33 -0400 Subject: [PATCH 1/2] feat: add missing imports and reorganize some alls --- interactions/__init__.py | 34 ++++++++---- interactions/client/utils/__init__.py | 70 ++++++++++++------------ interactions/models/__init__.py | 38 ++++++++----- interactions/models/discord/__init__.py | 11 +++- interactions/models/discord/channel.py | 1 + interactions/models/internal/__init__.py | 17 +++--- 6 files changed, 104 insertions(+), 67 deletions(-) diff --git a/interactions/__init__.py b/interactions/__init__.py index 50cdda95c..3f4412991 100644 --- a/interactions/__init__.py +++ b/interactions/__init__.py @@ -94,6 +94,7 @@ ChannelSelectMenu, ChannelType, check, + ClientObject, ClientUser, Color, COLOR_TYPES, @@ -114,8 +115,10 @@ CustomEmoji, CustomEmojiConverter, DateTrigger, + DefaultableSelectMenu, DefaultNotificationLevel, DefaultReaction, + DiscordObject, DM, dm_only, DMChannel, @@ -131,11 +134,13 @@ EmbedProvider, Entitlement, ExplicitContentFilterLevel, + ExponentialBackoffSystem, Extension, File, FlatUIColors, FlatUIColours, ForumLayoutType, + ForumSortOrder, get_components_ids, global_autocomplete, GlobalAutoComplete, @@ -189,11 +194,14 @@ Invite, InviteTargetType, is_owner, + LeakyBucketSystem, listen, Listener, LocalisedDesc, + LocalisedField, LocalisedName, LocalizedDesc, + LocalizedField, LocalizedName, MaterialColors, MaterialColours, @@ -258,6 +266,7 @@ ScheduledEventPrivacyLevel, ScheduledEventStatus, ScheduledEventType, + SelectDefaultValues, ShortText, slash_attachment_option, slash_bool_option, @@ -276,6 +285,7 @@ SlashCommandOption, SlashCommandParameter, SlashContext, + SlidingWindowSystem, Snowflake, Snowflake_Type, SnowflakeConverter, @@ -311,6 +321,7 @@ to_optional_snowflake, to_snowflake, to_snowflake_list, + TokenBucketSystem, TYPE_ALL_ACTION, TYPE_ALL_CHANNEL, TYPE_ALL_TRIGGER, @@ -338,11 +349,6 @@ WebhookMixin, WebhookTypes, WebSocketOPCode, - SlidingWindowSystem, - ExponentialBackoffSystem, - LeakyBucketSystem, - TokenBucketSystem, - ForumSortOrder, ) from .api import events from . import ext @@ -409,6 +415,7 @@ "ChannelType", "check", "Client", + "ClientObject", "ClientUser", "Color", "COLOR_TYPES", @@ -418,8 +425,8 @@ "ComponentCommand", "ComponentContext", "ComponentType", - "ConsumeRest", "const", + "ConsumeRest", "context_menu", "CONTEXT_MENU_NAME_LENGTH", "ContextMenu", @@ -428,16 +435,14 @@ "cooldown", "Cooldown", "CooldownSystem", - "SlidingWindowSystem", - "ExponentialBackoffSystem", - "LeakyBucketSystem", - "TokenBucketSystem", "CustomEmoji", "CustomEmojiConverter", "DateTrigger", + "DefaultableSelectMenu", "DefaultNotificationLevel", "DefaultReaction", "DISCORD_EPOCH", + "DiscordObject", "DM", "dm_only", "DMChannel", @@ -460,13 +465,14 @@ "errors", "events", "ExplicitContentFilterLevel", + "ExponentialBackoffSystem", "ext", "Extension", "File", "FlatUIColors", "FlatUIColours", - "ForumSortOrder", "ForumLayoutType", + "ForumSortOrder", "get_components_ids", "get_logger", "global_autocomplete", @@ -524,11 +530,14 @@ "InviteTargetType", "is_owner", "kwarg_spam", + "LeakyBucketSystem", "listen", "Listener", "LocalisedDesc", + "LocalisedField", "LocalisedName", "LocalizedDesc", + "LocalizedField", "LocalizedName", "logger_name", "MaterialColors", @@ -600,6 +609,7 @@ "ScheduledEventStatus", "ScheduledEventType", "SELECT_MAX_NAME_LENGTH", + "SelectDefaultValues", "SELECTS_MAX_OPTIONS", "Sentinel", "ShortText", @@ -625,6 +635,7 @@ "SlashCommandOption", "SlashCommandParameter", "SlashContext", + "SlidingWindowSystem", "smart_cache", "Snowflake", "Snowflake_Type", @@ -663,6 +674,7 @@ "to_optional_snowflake", "to_snowflake", "to_snowflake_list", + "TokenBucketSystem", "TYPE_ALL_ACTION", "TYPE_ALL_CHANNEL", "TYPE_ALL_TRIGGER", diff --git a/interactions/client/utils/__init__.py b/interactions/client/utils/__init__.py index 68b943b73..140c6b353 100644 --- a/interactions/client/utils/__init__.py +++ b/interactions/client/utils/__init__.py @@ -47,41 +47,9 @@ underline, ) from .text_utils import mentions +from .deserialise_app_cmds import deserialize_app_cmds __all__ = ( - "define", - "docs", - "field", - "str_validator", - "NullCache", - "TTLCache", - "TTLItem", - "list_converter", - "optional", - "timestamp_converter", - "FastJson", - "get_args", - "get_first_word", - "response_decode", - "escape_mentions", - "find", - "find_all", - "get", - "get_all", - "get_event_name", - "get_object_name", - "get_parameters", - "maybe_coroutine", - "nulled_boolean_get", - "wrap_partial", - "dict_filter", - "dict_filter_none", - "export_converter", - "get_file_mimetype", - "no_export_meta", - "unpack_helper", - "to_dict", - "to_image_data", "ansi_block", "ansi_escape", "ansi_format", @@ -93,14 +61,48 @@ "bold", "code_block", "colors", + "define", + "deserialize_app_cmds", + "dict_filter", + "dict_filter_none", + "docs", + "escape_mentions", + "export_converter", + "FastJson", + "field", + "find", + "find_all", + "get", + "get_all", + "get_args", + "get_event_name", + "get_file_mimetype", + "get_first_word", + "get_object_name", + "get_parameters", "inline_code", "italic", "link_in_embed", + "list_converter", + "maybe_coroutine", + "mentions", "no_embed_link", + "no_export_meta", + "NullCache", + "nulled_boolean_get", + "optional", "quote_line", + "response_decode", "spoiler", + "str_validator", "strikethrough", "styles", + "timestamp_converter", + "to_dict", + "to_image_data", + "TTLCache", + "TTLItem", "underline", - "mentions", + "unpack_helper", + "wrap_partial", ) diff --git a/interactions/models/__init__.py b/interactions/models/__init__.py index e66a5a5aa..6e47f68ed 100644 --- a/interactions/models/__init__.py +++ b/interactions/models/__init__.py @@ -36,6 +36,7 @@ ChannelMention, ChannelSelectMenu, ChannelType, + ClientObject, ClientUser, Color, COLOR_TYPES, @@ -43,8 +44,10 @@ CommandType, ComponentType, CustomEmoji, + DefaultableSelectMenu, DefaultNotificationLevel, DefaultReaction, + DiscordObject, DM, DMChannel, DMGroup, @@ -60,6 +63,7 @@ FlatUIColors, FlatUIColours, ForumLayoutType, + ForumSortOrder, get_components_ids, Guild, GuildBan, @@ -138,6 +142,7 @@ ScheduledEventPrivacyLevel, ScheduledEventStatus, ScheduledEventType, + SelectDefaultValues, ShortText, Snowflake, Snowflake_Type, @@ -190,7 +195,6 @@ WebhookMixin, WebhookTypes, WebSocketOPCode, - ForumSortOrder, ) from .internal import ( ActiveVoiceState, @@ -211,26 +215,21 @@ component_callback, ComponentCommand, ComponentContext, - context_menu, - user_context_menu, - message_context_menu, ConsumeRest, + context_menu, ContextMenu, ContextMenuContext, Converter, cooldown, Cooldown, CooldownSystem, - SlidingWindowSystem, - ExponentialBackoffSystem, - LeakyBucketSystem, - TokenBucketSystem, CustomEmojiConverter, DateTrigger, dm_only, DMChannelConverter, DMConverter, DMGroupConverter, + ExponentialBackoffSystem, Extension, global_autocomplete, GlobalAutoComplete, @@ -254,15 +253,19 @@ InteractionContext, IntervalTrigger, is_owner, + LeakyBucketSystem, listen, Listener, LocalisedDesc, + LocalisedField, LocalisedName, LocalizedDesc, + LocalizedField, LocalizedName, max_concurrency, MaxConcurrency, MemberConverter, + message_context_menu, MessageableChannelConverter, MessageConverter, modal_callback, @@ -292,12 +295,15 @@ SlashCommandOption, SlashCommandParameter, SlashContext, + SlidingWindowSystem, SnowflakeConverter, subcommand, sync_needed, Task, ThreadChannelConverter, TimeTrigger, + TokenBucketSystem, + user_context_menu, UserConverter, VoiceChannelConverter, Wait, @@ -358,6 +364,7 @@ "ChannelSelectMenu", "ChannelType", "check", + "ClientObject", "ClientUser", "Color", "COLOR_TYPES", @@ -375,15 +382,13 @@ "cooldown", "Cooldown", "CooldownSystem", - "SlidingWindowSystem", - "ExponentialBackoffSystem", - "LeakyBucketSystem", - "TokenBucketSystem", "CustomEmoji", "CustomEmojiConverter", "DateTrigger", + "DefaultableSelectMenu", "DefaultNotificationLevel", "DefaultReaction", + "DiscordObject", "DM", "dm_only", "DMChannel", @@ -399,12 +404,13 @@ "EmbedProvider", "Entitlement", "ExplicitContentFilterLevel", + "ExponentialBackoffSystem", "Extension", "File", "FlatUIColors", "FlatUIColours", - "ForumSortOrder", "ForumLayoutType", + "ForumSortOrder", "get_components_ids", "global_autocomplete", "GlobalAutoComplete", @@ -458,11 +464,14 @@ "Invite", "InviteTargetType", "is_owner", + "LeakyBucketSystem", "listen", "Listener", "LocalisedDesc", + "LocalisedField", "LocalisedName", "LocalizedDesc", + "LocalizedField", "LocalizedName", "MaterialColors", "MaterialColours", @@ -527,6 +536,7 @@ "ScheduledEventPrivacyLevel", "ScheduledEventStatus", "ScheduledEventType", + "SelectDefaultValues", "ShortText", "slash_attachment_option", "slash_bool_option", @@ -545,6 +555,7 @@ "SlashCommandOption", "SlashCommandParameter", "SlashContext", + "SlidingWindowSystem", "Snowflake", "Snowflake_Type", "SnowflakeConverter", @@ -580,6 +591,7 @@ "to_optional_snowflake", "to_snowflake", "to_snowflake_list", + "TokenBucketSystem", "TYPE_ALL_ACTION", "TYPE_ALL_CHANNEL", "TYPE_ALL_TRIGGER", diff --git a/interactions/models/discord/__init__.py b/interactions/models/discord/__init__.py index 2168dd0c9..a957b126e 100644 --- a/interactions/models/discord/__init__.py +++ b/interactions/models/discord/__init__.py @@ -57,11 +57,13 @@ BaseSelectMenu, Button, ChannelSelectMenu, + DefaultableSelectMenu, get_components_ids, InteractiveComponent, MentionableSelectMenu, process_components, RoleSelectMenu, + SelectDefaultValues, spread_to_rows, StringSelectMenu, StringSelectOption, @@ -167,6 +169,8 @@ from .timestamp import Timestamp, TimestampStyles from .user import BaseUser, Member, User, ClientUser from .voice_state import VoiceRegion, VoiceState +from .webhooks import Webhook, WebhookTypes +from .base import ClientObject, DiscordObject __all__ = ( "ActionRow", @@ -206,6 +210,7 @@ "ChannelMention", "ChannelSelectMenu", "ChannelType", + "ClientObject", "ClientUser", "Color", "COLOR_TYPES", @@ -213,8 +218,10 @@ "CommandType", "ComponentType", "CustomEmoji", + "DefaultableSelectMenu", "DefaultNotificationLevel", "DefaultReaction", + "DiscordObject", "DM", "DMChannel", "DMGroup", @@ -229,8 +236,8 @@ "File", "FlatUIColors", "FlatUIColours", - "ForumSortOrder", "ForumLayoutType", + "ForumSortOrder", "get_components_ids", "Guild", "GuildBan", @@ -309,6 +316,7 @@ "ScheduledEventPrivacyLevel", "ScheduledEventStatus", "ScheduledEventType", + "SelectDefaultValues", "ShortText", "Snowflake", "Snowflake_Type", @@ -362,4 +370,3 @@ "WebhookTypes", "WebSocketOPCode", ) -from .webhooks import Webhook, WebhookTypes diff --git a/interactions/models/discord/channel.py b/interactions/models/discord/channel.py index d7d0ff263..7b8ceca0e 100644 --- a/interactions/models/discord/channel.py +++ b/interactions/models/discord/channel.py @@ -62,6 +62,7 @@ "GuildText", "ThreadChannel", "GuildForum", + "GuildMedia", "GuildNewsThread", "GuildPublicThread", "GuildForumPost", diff --git a/interactions/models/internal/__init__.py b/interactions/models/internal/__init__.py index 258a1c255..bed923473 100644 --- a/interactions/models/internal/__init__.py +++ b/interactions/models/internal/__init__.py @@ -102,6 +102,7 @@ from .extension import Extension from .wait import Wait from .tasks import BaseTrigger, DateTrigger, IntervalTrigger, OrTrigger, Task, TimeTrigger +from .localisation import LocalisedField, LocalizedField __all__ = ( "ActiveVoiceState", @@ -122,26 +123,21 @@ "component_callback", "ComponentCommand", "ComponentContext", - "context_menu", - "user_context_menu", - "message_context_menu", "ConsumeRest", + "context_menu", "ContextMenu", "ContextMenuContext", "Converter", "cooldown", "Cooldown", "CooldownSystem", - "SlidingWindowSystem", - "ExponentialBackoffSystem", - "LeakyBucketSystem", - "TokenBucketSystem", "CustomEmojiConverter", "DateTrigger", "dm_only", "DMChannelConverter", "DMConverter", "DMGroupConverter", + "ExponentialBackoffSystem", "Extension", "global_autocomplete", "GlobalAutoComplete", @@ -165,15 +161,19 @@ "InteractionContext", "IntervalTrigger", "is_owner", + "LeakyBucketSystem", "listen", "Listener", "LocalisedDesc", + "LocalisedField", "LocalisedName", "LocalizedDesc", + "LocalizedField", "LocalizedName", "max_concurrency", "MaxConcurrency", "MemberConverter", + "message_context_menu", "MessageableChannelConverter", "MessageConverter", "modal_callback", @@ -203,12 +203,15 @@ "SlashCommandOption", "SlashCommandParameter", "SlashContext", + "SlidingWindowSystem", "SnowflakeConverter", "subcommand", "sync_needed", "Task", "ThreadChannelConverter", "TimeTrigger", + "TokenBucketSystem", + "user_context_menu", "UserConverter", "VoiceChannelConverter", "Wait", From f59eafa9a5543442c7303b908d2e5e2b0ec70cfc Mon Sep 17 00:00:00 2001 From: AstreaTSS <25420078+AstreaTSS@users.noreply.github.com> Date: Tue, 30 Apr 2024 15:18:25 -0400 Subject: [PATCH 2/2] fix: export CronTrigger --- interactions/__init__.py | 6 ++++-- interactions/models/__init__.py | 2 ++ interactions/models/internal/__init__.py | 3 ++- interactions/models/internal/tasks/__init__.py | 4 ++-- interactions/models/internal/tasks/triggers.py | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/interactions/__init__.py b/interactions/__init__.py index 3f4412991..857f03632 100644 --- a/interactions/__init__.py +++ b/interactions/__init__.py @@ -109,9 +109,10 @@ ContextMenu, ContextMenuContext, Converter, - cooldown, Cooldown, + cooldown, CooldownSystem, + CronTrigger, CustomEmoji, CustomEmojiConverter, DateTrigger, @@ -435,6 +436,7 @@ "cooldown", "Cooldown", "CooldownSystem", + "CronTrigger", "CustomEmoji", "CustomEmojiConverter", "DateTrigger", @@ -563,8 +565,8 @@ "MessageReference", "MessageType", "MFALevel", - "Missing", "MISSING", + "Missing", "Modal", "modal_callback", "ModalCommand", diff --git a/interactions/models/__init__.py b/interactions/models/__init__.py index 6e47f68ed..f56714bfc 100644 --- a/interactions/models/__init__.py +++ b/interactions/models/__init__.py @@ -223,6 +223,7 @@ cooldown, Cooldown, CooldownSystem, + CronTrigger, CustomEmojiConverter, DateTrigger, dm_only, @@ -382,6 +383,7 @@ "cooldown", "Cooldown", "CooldownSystem", + "CronTrigger", "CustomEmoji", "CustomEmojiConverter", "DateTrigger", diff --git a/interactions/models/internal/__init__.py b/interactions/models/internal/__init__.py index bed923473..77032a5f8 100644 --- a/interactions/models/internal/__init__.py +++ b/interactions/models/internal/__init__.py @@ -101,7 +101,7 @@ from .protocols import Converter from .extension import Extension from .wait import Wait -from .tasks import BaseTrigger, DateTrigger, IntervalTrigger, OrTrigger, Task, TimeTrigger +from .tasks import BaseTrigger, CronTrigger, DateTrigger, IntervalTrigger, OrTrigger, Task, TimeTrigger from .localisation import LocalisedField, LocalizedField __all__ = ( @@ -131,6 +131,7 @@ "cooldown", "Cooldown", "CooldownSystem", + "CronTrigger", "CustomEmojiConverter", "DateTrigger", "dm_only", diff --git a/interactions/models/internal/tasks/__init__.py b/interactions/models/internal/tasks/__init__.py index 9df6a8ce4..91f9c32fe 100644 --- a/interactions/models/internal/tasks/__init__.py +++ b/interactions/models/internal/tasks/__init__.py @@ -1,4 +1,4 @@ -from .triggers import BaseTrigger, IntervalTrigger, DateTrigger, TimeTrigger, OrTrigger +from .triggers import BaseTrigger, CronTrigger, DateTrigger, IntervalTrigger, OrTrigger, TimeTrigger from .task import Task -__all__ = ("BaseTrigger", "IntervalTrigger", "DateTrigger", "TimeTrigger", "OrTrigger", "Task") +__all__ = ("BaseTrigger", "CronTrigger", "DateTrigger", "IntervalTrigger", "OrTrigger", "Task", "TimeTrigger") diff --git a/interactions/models/internal/tasks/triggers.py b/interactions/models/internal/tasks/triggers.py index cf1bf5525..5ac993236 100644 --- a/interactions/models/internal/tasks/triggers.py +++ b/interactions/models/internal/tasks/triggers.py @@ -7,7 +7,7 @@ from croniter import croniter -__all__ = ("BaseTrigger", "IntervalTrigger", "DateTrigger", "TimeTrigger", "OrTrigger") +__all__ = ("BaseTrigger", "IntervalTrigger", "DateTrigger", "TimeTrigger", "OrTrigger", "CronTrigger") class BaseTrigger(ABC):