Browse Source
Add Message.is_forwardable to check if a message can be forwarded
pull/10406/head
n6ck
4 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
27 additions and
0 deletions
-
discord/message.py
|
|
|
@ -3051,3 +3051,30 @@ class Message(PartialMessage, Hashable): |
|
|
|
The newly edited message. |
|
|
|
""" |
|
|
|
return await self.edit(attachments=[a for a in self.attachments if a not in attachments]) |
|
|
|
|
|
|
|
def is_forwardable(self) -> bool: |
|
|
|
""":class:`bool`: Whether the message can be forwarded using :meth:`Message.forward`. |
|
|
|
|
|
|
|
A message is forwardable only if it is a basic message type and does not |
|
|
|
contain a poll, call, or activity, and is not a system message. |
|
|
|
|
|
|
|
.. versionadded:: 2.7 |
|
|
|
""" |
|
|
|
if self.type not in ( |
|
|
|
MessageType.default, |
|
|
|
MessageType.reply, |
|
|
|
MessageType.chat_input_command, |
|
|
|
MessageType.context_menu_command, |
|
|
|
): |
|
|
|
return False |
|
|
|
|
|
|
|
if self.poll is not None: |
|
|
|
return False |
|
|
|
|
|
|
|
if self.call is not None: |
|
|
|
return False |
|
|
|
|
|
|
|
if self.activity is not None: |
|
|
|
return False |
|
|
|
|
|
|
|
return True |
|
|
|
|