curious.dataclasses.message

Wrappers for Message objects.

Classes

Message(client, **kwargs) Represents a Message.
MessageType Represents the type of a message.
class curious.dataclasses.message.MessageType[source]

Bases: enum.IntEnum

Represents the type of a message.

DEFAULT = 0

The default (i.e. user message) type.

RECIPIENT_ADD = 1

The recipient add type, used when a recipient is added to a group.

RECIPIENT_REMOVE = 2

The recipient remove type, used when a recipient is added to a group.

CALL = 3

The call type, used when a call is started.

CHANNEL_NAME_CHANGE = 4

The channel name change type, used when a group channel name is changed.

CHANNEL_ICON_CHANGE = 5

The channel icon change type, used when a group channel icon is changed.

CHANNEL_PINNED_MESSAGE = 6

The channel pinned message type, used when a message is pinned.

GUILD_MEMBER_JOIN = 7

The guild member join type, used when a member joins a guild.

class curious.dataclasses.message.Message(client, **kwargs)[source]

Bases: curious.dataclasses.bases.Dataclass

Represents a Message.

Inspects the stack to ensure we’re being called correctly.

content

The content of the message.

guild_id

The ID of the guild this message is in.

channel_id

The ID of the channel the message was sent in.

author_id

The ID of the author.

author

The author of this message. Can be one of: Member, Webhook, User.

type

The type of this message.

created_at

The true timestamp of this message, a datetime.datetime. This is not the snowflake timestamp.

edited_timestamp = None

The edited timestamp of this message. This can sometimes be None.

embeds

The list of Embed objects this message contains.

attachments

The list of Attachment this message contains.

_mentions

The mentions for this message. This is UNORDERED.

_role_mentions

The role mentions for this message. This is UNORDERED.

reactions

The reactions for this message.

guild
Return type:Guild
Returns:The Guild this message is associated with.
channel
Return type:Channel
Returns:The Channel this message is associated with.
mentions

Returns a list of Member that were mentioned in this message.

Warning

The mentions in this will not be in order. Discord does not return them in any particular order.

Return type:List[Member]
role_mentions

Returns a list of Role that were mentioned in this message.

Warning

The mentions in this will not be in order. Discord does not return them in any particular order.

Return type:List[Role]
channel_mentions

Returns a list of Channel that were mentioned in this message.

Note

These mentions are in order. They are parsed from the message content.

Return type:List[Channel]
emojis

Returns a list of Emoji that was found in this message.

Return type:List[Emoji]
await clean_content()[source]

Gets the cleaned content for this message.

Return type:str
await get_invites()[source]

Gets a list of valid invites in this message.

Return type:List[Invite]
invites

Returns a list of Invite objects that are in this message (and valid).

Return type:AsyncIterator[Invite]
_resolve_mentions(mentions, type_)[source]

Resolves the mentions for this message.

Parameters:
  • mentions (List[Union[dict, str]]) – The mentions to resolve; a list of dicts or ints.
  • type (str) – The type of mention to resolve: channel, role, or member.
Return type:

List[Union[Channel, Role, Member]]

reacted(emoji)[source]

Checks if this message was reacted to with the specified emoji.

Parameters:emoji (Union[Emoji, str]) – The emoji to check.
Return type:bool
await delete()[source]

Deletes this message.

You must have MANAGE_MESSAGE permissions to delete this message, or have it be your own message.

Return type:None
await edit(new_content=None, *, embed=None)[source]

Edits this message.

You must be the owner of this message to edit it.

Parameters:
  • new_content (Optional[str]) – The new content for this message.
  • embed (Optional[Embed]) – The new embed to provide.
Return type:

Message

Returns:

This message, but edited with the new content.

await pin()[source]

Pins this message.

You must have MANAGE_MESSAGES in the channel to pin the message.

Return type:Message
await unpin()[source]

Unpins this message.

You must have MANAGE_MESSAGES in this channel to unpin the message. Additionally, the message must already be pinned.

Return type:Message
await get_who_reacted(emoji)[source]

Fetches who reacted to this message.

Parameters:emoji (Union[Emoji, str]) – The emoji to check.
Return type:List[Union[User, Member]]
Returns:A list of either Member or User that reacted to this message.
await react(emoji)[source]

Reacts to a message with an emoji.

This requires an Emoji object for reacting to messages with custom reactions, or a string containing the literal unicode (e.g ™) for normal emoji reactions.

Parameters:emoji (Union[Emoji, str]) – The emoji to react with.
await unreact(reaction, victim=None)[source]

Removes a reaction from a user.

Parameters:
  • reaction (Union[Emoji, str]) – The reaction to remove.
  • victim (Optional[Member]) – The victim to remove the reaction of. Can be None to signify ourselves.
await remove_all_reactions()[source]

Removes all reactions from a message.

Return type:None
snowflake_timestamp
Return type:datetime
Returns:The timestamp of the snowflake.