fix (seekers): Consider news channels as text.
Non-canonical hack to `find_channel` to include `news` types in `text`.
This commit is contained in:
@@ -485,7 +485,7 @@ async def cmd_reactionroles(ctx, flags):
|
|||||||
await ctx.error_reply(
|
await ctx.error_reply(
|
||||||
"The provided channel no longer exists!"
|
"The provided channel no longer exists!"
|
||||||
)
|
)
|
||||||
elif channel.type != discord.ChannelType.text:
|
elif not isinstance(channel, discord.TextChannel):
|
||||||
await ctx.error_reply(
|
await ctx.error_reply(
|
||||||
"The provided channel is not a text channel!"
|
"The provided channel is not a text channel!"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -182,6 +182,10 @@ async def find_channel(ctx, userstr, interactive=False, collection=None, chan_ty
|
|||||||
# Create the collection to search from args or guild channels
|
# Create the collection to search from args or guild channels
|
||||||
collection = collection if collection else ctx.guild.channels
|
collection = collection if collection else ctx.guild.channels
|
||||||
if chan_type is not None:
|
if chan_type is not None:
|
||||||
|
if chan_type == discord.ChannelType.text:
|
||||||
|
# Hack to support news channels as text channels
|
||||||
|
collection = [chan for chan in collection if isinstance(chan, discord.TextChannel)]
|
||||||
|
else:
|
||||||
collection = [chan for chan in collection if chan.type == chan_type]
|
collection = [chan for chan in collection if chan.type == chan_type]
|
||||||
|
|
||||||
# If the user input was a number or possible channel mention, extract it
|
# If the user input was a number or possible channel mention, extract it
|
||||||
@@ -413,7 +417,7 @@ async def find_message(ctx, msgid, chlist=None, ignore=[]):
|
|||||||
|
|
||||||
|
|
||||||
async def _search_in_channel(channel: discord.TextChannel, msgid: int):
|
async def _search_in_channel(channel: discord.TextChannel, msgid: int):
|
||||||
if channel.type != discord.ChannelType.text:
|
if not isinstance(channel, discord.TextChannel):
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
message = await channel.fetch_message(msgid)
|
message = await channel.fetch_message(msgid)
|
||||||
|
|||||||
Reference in New Issue
Block a user