Skip to content

Commit

Permalink
[PersonalChannels] fix message being nonetype
Browse files Browse the repository at this point in the history
  • Loading branch information
japandotorg committed Sep 15, 2023
1 parent 1e74cc2 commit 89ccf3a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions personalchannels/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,9 @@ async def _pin(self, ctx: commands.Context, message: Optional[discord.Message] =
channel = ctx.guild.get_channel(channel)
await self.check_text_channels(ctx, channel)
message = ref.resolved if (ref := ctx.message.reference) else message # type: ignore
if message is None:
await ctx.send("`Message` is a required argument.")
return
if message.channel is not channel:
await ctx.send(f"This is not your personal channel. (Your channel: {channel.mention})")
return
Expand All @@ -580,6 +583,9 @@ async def _unpin(self, ctx: commands.Context, message: Optional[discord.Message]
channel = ctx.guild.get_channel(channel)
await self.check_text_channels(ctx, channel)
message = ref.resolved if (ref := ctx.message.reference) else message # type: ignore
if message is None:
await ctx.send("`Message` is a required argument.")
return
if message.channel is not channel:
await ctx.send(f"This is not your personal channel. (Your channel: {channel.mention})")
return
Expand Down

0 comments on commit 89ccf3a

Please sign in to comment.