From 463bea21e93c31c6dc9078053e3db48576614878 Mon Sep 17 00:00:00 2001 From: Jimmy-Blue <60958064+Jimmy-Blue@users.noreply.github.com> Date: Mon, 8 Aug 2022 19:03:15 +0700 Subject: [PATCH 1/3] perf: Change how Extension is loaded --- interactions/ext/files/files.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/interactions/ext/files/files.py b/interactions/ext/files/files.py index 596f7f7..64cba0f 100644 --- a/interactions/ext/files/files.py +++ b/interactions/ext/files/files.py @@ -287,9 +287,6 @@ async def _edit( return payload, files - _Context.send = _send - _Context.edit = _edit - class Files(Extension): """I don't know what this does, but it is required to load the extension.""" @@ -609,11 +606,13 @@ async def component_edit( return Message(**payload, _client=ctx._client) -CommandContext.send = command_send -CommandContext.edit = command_edit -ComponentContext.send = component_send -ComponentContext.edit = component_edit - +def setup(client: Client) -> Files: + """Setup the extension.""" -def setup(client: Client): + _Context.send = Context._send + _Context.edit = Context._edit + CommandContext.send = command_send + CommandContext.edit = command_edit + ComponentContext.send = component_send + ComponentContext.edit = component_edit return Files(client) From 0faf21e769c2512b7848aa74cb5c6d49ac87e707 Mon Sep 17 00:00:00 2001 From: Jimmy-Blue <60958064+Jimmy-Blue@users.noreply.github.com> Date: Mon, 8 Aug 2022 19:06:25 +0700 Subject: [PATCH 2/3] fix: Fix edit in ``Context()`` and ``component_edit`` --- interactions/ext/files/files.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interactions/ext/files/files.py b/interactions/ext/files/files.py index 64cba0f..55924a5 100644 --- a/interactions/ext/files/files.py +++ b/interactions/ext/files/files.py @@ -252,7 +252,7 @@ async def _edit( if self.message.components is not None or components is not MISSING: if components is MISSING: - _components = self.message.components + _components = _build_components(components=self.message.components) elif not components: _components = [] else: @@ -556,7 +556,7 @@ async def component_edit( :rtype: Message """ - payload, files = await Context._send(ctx, content, **kwargs) + payload, files = await Context._edit(ctx, content, **kwargs) msg = None From 50e4fb664392292192c0b1d215e91477a3c69a43 Mon Sep 17 00:00:00 2001 From: Blue <60958064+Jimmy-Blue@users.noreply.github.com> Date: Mon, 8 Aug 2022 19:19:45 +0700 Subject: [PATCH 3/3] chore: Bump version to ``1.1.3`` --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index d5e6297..22dd723 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name="interactions-files", - version="1.1.2-post.1", + version="1.1.3", description="An extension library for interactions.py allowing files in interaction responses.", long_description=long_description, long_description_content_type="text/markdown",