aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Izan <[email protected]>2022-02-17 09:15:15 +0000
committerGravatar Izan <[email protected]>2022-02-17 09:15:15 +0000
commit4daa320a8482bc263b8cac3e912f69aa390056bf (patch)
tree5ccbeb90bae47a69eb90a0f805166f371c1c49d6
parentFix DM handling for code snippets. (diff)
Fix two errors
- Changed `destination.guild` to `message.guild` since `DMChannel` doesn't have a "guild" attribute - Only call `wait_for_deletion` when inside a guild.
-rw-r--r--bot/exts/info/code_snippets.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/bot/exts/info/code_snippets.py b/bot/exts/info/code_snippets.py
index 95a0fb014..ebc7ce1c6 100644
--- a/bot/exts/info/code_snippets.py
+++ b/bot/exts/info/code_snippets.py
@@ -262,7 +262,7 @@ class CodeSnippets(Cog):
raise e
# If we're in a guild, then check if we need to redirect to #bot-commands
- if destination.guild:
+ if message.guild:
if len(message_to_send) > 1000 and message.channel.id != Channels.bot_commands:
# Redirects to #bot-commands if the snippet contents are too long
await self.bot.wait_until_guild_available()
@@ -273,10 +273,12 @@ class CodeSnippets(Cog):
f'Please see {destination.mention} for the full snippet.'
)
- await wait_for_deletion(
- await destination.send(message_to_send),
- (message.author.id,)
- )
+ await wait_for_deletion(
+ await destination.send(message_to_send),
+ (message.author.id,)
+ )
+ else:
+ await destination.send(message_to_send)
def setup(bot: Bot) -> None: