mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
Fix the handling of PartialMessageable channels (#6005)
Co-authored-by: Flame442 <34169552+Flame442@users.noreply.github.com>
This commit is contained in:
parent
0a5aa94cde
commit
c79d0d723e
@ -824,7 +824,13 @@ class Red(
|
|||||||
|
|
||||||
# We do not consider messages with PartialMessageable channel as eligible.
|
# We do not consider messages with PartialMessageable channel as eligible.
|
||||||
# See `process_commands()` for our handling of it.
|
# See `process_commands()` for our handling of it.
|
||||||
if isinstance(channel, discord.PartialMessageable):
|
|
||||||
|
# 27-03-2023: Addendum, DMs won't run into the same issues that guild partials will,
|
||||||
|
# so we can safely continue to execute the command.
|
||||||
|
if (
|
||||||
|
isinstance(channel, discord.PartialMessageable)
|
||||||
|
and channel.type is not discord.ChannelType.private
|
||||||
|
):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if guild:
|
if guild:
|
||||||
@ -1029,7 +1035,6 @@ class Red(
|
|||||||
discord.Member
|
discord.Member
|
||||||
The user you requested.
|
The user you requested.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if (member := guild.get_member(member_id)) is not None:
|
if (member := guild.get_member(member_id)) is not None:
|
||||||
return member
|
return member
|
||||||
return await guild.fetch_member(member_id)
|
return await guild.fetch_member(member_id)
|
||||||
@ -1609,7 +1614,11 @@ class Red(
|
|||||||
ctx.prefix = m
|
ctx.prefix = m
|
||||||
break
|
break
|
||||||
|
|
||||||
if ctx.invoked_with and isinstance(message.channel, discord.PartialMessageable):
|
if (
|
||||||
|
ctx.invoked_with
|
||||||
|
and isinstance(message.channel, discord.PartialMessageable)
|
||||||
|
and message.channel.type is not discord.ChannelType.private
|
||||||
|
):
|
||||||
log.warning(
|
log.warning(
|
||||||
"Discarded a command message (ID: %s) with PartialMessageable channel: %r",
|
"Discarded a command message (ID: %s) with PartialMessageable channel: %r",
|
||||||
message.id,
|
message.id,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user