Attempting to `.get_partial_message()` from a `PartialMessageable` results in an Exception
DefiDebauchery opened this issue · 1 comments
Summary
Exception thrown when trying to construct a PartialMessage from a PartialMessageable
Reproduction Steps
A help file for .partial-objects
in the Pycord Discord states the following:
Partial Objects
These can be used to make API calls when you have channel id and/or message id, and you don't want to rely on the cache to have their objects.
Methods which can be used on them are
Example Usage:
async def star_message(channel_id: int, message_id: int): # Get Partial Messageable object partial_channel = bot.get_partial_messageable(channel_id) # Get Partial Message partial_message = partial_channel.get_partial_message(message_id) # Add a reaction await partial_message.add_reaction(":star:")
The issue is that PartialMessage
checks the incoming type, and PartialMessageable
, as constructed and returned by .get_partial_messageable()
, is not on that list.
Minimal Reproducible Code
async def star_message(channel_id: int, message_id: int):
# Get Partial Messageable object
partial_channel = bot.get_partial_messageable(channel_id)
# Get Partial Message
partial_message = partial_channel.get_partial_message(message_id)
# Add a reaction
await partial_message.add_reaction(":star:")
await star_message(881224361015672863, 1273298167768682611)
Expected Results
A PartialMessage object is provided for further interaction
Actual Results
An exception is thrown due to PartialMessageable
not in the list of valid channel types for PartialMessage
Intents
any
System Information
- Python v3.11.9-final
- py-cord v2.6.None-final
- aiohttp v3.9.5
- system info: Darwin 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:11:08 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T8122
Checklist
- I have searched the open issues for duplicates.
- I have shown the entire traceback, if possible.
- I have removed my token from display, if visible.
Additional Context
No response
This is intended to be changed, but you can circumvent this by setting type
in get_partial_messageable