Trying to search a text channel on the development version. But I'm getting a "discord.errors.HTTPException: 400 Bad Request (error code: 50024): Cannot execute action on this channel type"
Reproduction Steps
Traceback (most recent call last):
File "c:\Users\User\Desktop\self-bot\self-bot\Lib\site-packages\discord\ext\commands\core.py", line 242, in wrapped
ret = await coro(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\Desktop\self-bot\cogs\search_test.py", line 24, in search
async for message in channel.search("ms", limit=100):
File "c:\Users\User\Desktop\self-bot\self-bot\Lib\site-packages\discord\abc.py", line 385, in _handle_message_search
data = await endpoint(entity_id, payload)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\User\Desktop\self-bot\self-bot\Lib\site-packages\discord\http.py", line 925, in request
raise HTTPException(response, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50024): Cannot execute action on this channel type
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "c:\Users\User\Desktop\self-bot\self-bot\Lib\site-packages\discord\ext\commands\bot.py", line 1169, in invoke
await ctx.command.invoke(ctx)
File "c:\Users\User\Desktop\self-bot\self-bot\Lib\site-packages\discord\ext\commands\core.py", line 1026, in invoke
await injected(*ctx.args, **ctx.kwargs) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\User\Desktop\self-bot\self-bot\Lib\site-packages\discord\ext\commands\core.py", line 251, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 50024): Cannot execute action on this channel type
Search any text channel using TextChannel.Search
Code
@commands.command()
async def search(self, ctx):
if ctx.guild.id != 825768260862476318:
return
channel_name = "commands"
guild = self.bot.get_guild(825768260862476318)
channel = guild.get_channel(1113952017644257280)
if isinstance(channel, discord.TextChannel):
async for message in channel.search("test", limit=100):
print(message.content)
else:
print(f"{channel} is not a text channel")
Expected Results
I am supposed to see a list of messages containing test
Actual Results
Getting an error
System Information
Python v3.11.0-final
discord.py-self v2.1.0-alpha
discord.py-self metadata: v2.1.0a4784+gf7e5100e
aiohttp v3.8.4
system info: Windows 10 10.0.22621
Checklist
[X] I have searched the open issues for duplicates.
[x] I have shared the entire traceback.
[X] I am using a user token (and it isn't visible in the code).
Summary
Trying to search a text channel on the development version. But I'm getting a "discord.errors.HTTPException: 400 Bad Request (error code: 50024): Cannot execute action on this channel type"
Reproduction Steps
Traceback (most recent call last): File "c:\Users\User\Desktop\self-bot\self-bot\Lib\site-packages\discord\ext\commands\core.py", line 242, in wrapped ret = await coro(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\Desktop\self-bot\cogs\search_test.py", line 24, in search async for message in channel.search("ms", limit=100): File "c:\Users\User\Desktop\self-bot\self-bot\Lib\site-packages\discord\abc.py", line 385, in _handle_message_search data = await endpoint(entity_id, payload) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Users\User\Desktop\self-bot\self-bot\Lib\site-packages\discord\http.py", line 925, in request raise HTTPException(response, data) discord.errors.HTTPException: 400 Bad Request (error code: 50024): Cannot execute action on this channel type
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "c:\Users\User\Desktop\self-bot\self-bot\Lib\site-packages\discord\ext\commands\bot.py", line 1169, in invoke await ctx.command.invoke(ctx) File "c:\Users\User\Desktop\self-bot\self-bot\Lib\site-packages\discord\ext\commands\core.py", line 1026, in invoke await injected(*ctx.args, **ctx.kwargs) # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Users\User\Desktop\self-bot\self-bot\Lib\site-packages\discord\ext\commands\core.py", line 251, in wrapped raise CommandInvokeError(exc) from exc discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 50024): Cannot execute action on this channel type
Search any text channel using TextChannel.Search
Code
Expected Results
I am supposed to see a list of messages containing test
Actual Results
Getting an error
System Information
Checklist
Additional Information
No response