disco.types.message

Constants

MessageType = Enum(
  DEFAULT = 0,
  RECIPIENT_ADD = 1,
  RECIPIENT_REMOVE = 2,
  CALL = 3,
  CHANNEL_NAME_CHANGE = 4,
  CHANNEL_ICON_CHANGE = 5,
  PINS_ADD = 6,
  GUILD_MEMBER_JOIN = 7)

Classes

Emoji

Inherits From SlottedModel

Represents either a standard or custom Discord emoji.

Attributes
Name Type Description
id snowflake? The emoji ID (will be none if this is not a custom emoji).
name str The name of this emoji.
animated bool Whether this emoji is animated.

Functions

custom(self)

eq(self, other)

to_string(self)

MessageReactionEmoji

Inherits From Emoji

Represents a emoji which was used as a reaction on a message.

MessageReaction

Inherits From SlottedModel

A reaction of one emoji (multiple users) to a message.

Attributes
Name Type Description
emoji `MessageReactionEmoji` The emoji which was reacted.
count int The number of users who reacted with this emoji.
me bool Whether the current user reacted with this emoji.

MessageEmbedFooter

Inherits From SlottedModel

A footer for the MessageEmbed.

Attributes
Name Type Description
text str The contents of the footer.
icon_url str The URL for the footer icon.
proxy_icon_url str A proxy URL for the footer icon, set by Discord.

MessageEmbedImage

Inherits From SlottedModel

An image for the MessageEmbed.

Attributes
Name Type Description
url str The URL for the image.
proxy_url str A proxy URL for the image, set by Discord.
width int The width of the image, set by Discord.
height int The height of the image, set by Discord.

MessageEmbedThumbnail

Inherits From SlottedModel

A thumbnail for the MessageEmbed.

Attributes
Name Type Description
url str The thumbnail URL.
proxy_url str A proxy URL for the thumbnail, set by Discord.
width int The width of the thumbnail, set by Discord.
height int The height of the thumbnail, set by Discord.

MessageEmbedVideo

Inherits From SlottedModel

A video for the MessageEmbed.

Attributes
Name Type Description
url str The URL for the video.
width int The width of the video, set by Discord.
height int The height of the video, set by Discord.

MessageEmbedAuthor

Inherits From SlottedModel

An author for the MessageEmbed.

Attributes
Name Type Description
name str The name of the author.
url str A URL for the author.
icon_url str A URL to an icon for the author.
proxy_icon_url str A proxy URL for the authors icon, set by Discord.

MessageEmbedField

Inherits From SlottedModel

A field for the MessageEmbed.

Attributes
Name Type Description
name str The name of the field.
value str The value of the field.
inline bool Whether the field renders inline or by itself.

MessageEmbed

Inherits From SlottedModel

Message embed object.

Attributes
Name Type Description
title str Title of the embed.
type str Type of the embed.
description str Description of the embed.
url str URL of the embed.
timestamp datetime The timestamp for the embed.
color int The color of the embed.
footer `MessageEmbedFooter` The footer of the embed.
thumbnail `MessageEmbedThumbnail` The thumbnail of the embed.
video `MessageEmbedVideo` The video of the embed.
author `MessageEmbedAuthor` The author of the embed.
fields list[`MessageEmbedField]` The fields of the embed.

Functions

set_footer(self,*args,**kwargs)

Sets the footer of the embed, see MessageEmbedFooter.

set_image(self,*args,**kwargs)

Sets the image of the embed, see MessageEmbedImage.

set_thumbnail(self,*args,**kwargs)

Sets the thumbnail of the embed, see MessageEmbedThumbnail.

set_video(self,*args,**kwargs)

Sets the video of the embed, see MessageEmbedVideo.

set_author(self,*args,**kwargs)

Sets the author of the embed, see MessageEmbedAuthor.

add_field(self,*args,**kwargs)

Adds a new field to the embed, see MessageEmbedField.

MessageAttachment

Inherits From SlottedModel

Message attachment object.

Attributes
Name Type Description
id snowflake The id of this attachment.
filename str The filename of this attachment.
url str The URL of this attachment.
proxy_url str The URL to proxy through when downloading the attachment.
size int Size of the attachment.
height int Height of the attachment.
width int Width of the attachment.

Message

Inherits From SlottedModel

Represents a Message created within a Channel on Discord.

Attributes
Name Type Description
id snowflake The ID of this message.
channel_id snowflake The channel ID this message was sent in.
type `MessageType` Type of the message.
author :class:`disco.types.user.User` The author of this message.
content str The unicode contents of this message.
nonce str The nonce of this message.
timestamp datetime When this message was created.
edited_timestamp datetime? When this message was last edited.
tts bool Whether this is a TTS (text-to-speech) message.
mention_everyone bool Whether this message has an @everyone which mentions everyone.
pinned bool Whether this message is pinned in the channel.
mentions dict[snowflake, `User`] Users mentioned within this message.
mention_roles list[snowflake] IDs for roles mentioned within this message.
embeds list[`MessageEmbed`] Embeds for this message.
attachments list[`MessageAttachment`] Attachments for this message.
reactions list[`MessageReaction`] Reactions for this message.

Functions

str(self)

guild(self)

Returns
The guild (if applicable) this message was created in.

member(self)

Returns
The guild member (if applicable) that sent this message.

channel(self)

Returns
The channel this message was created in.

pin(self)

Pins the message to the channel it was created in.

unpin(self)

Unpins the message from the channel it was created in.

reply(self,*args,**kwargs)

Reply to this message (see Channel.send_message).

Returns
The created message object.

edit(self,*args,**kwargs)

Edit this message.

Returns
The edited message object.
Args
Name Type Description
content str The new edited contents of the message.

delete(self)

Delete this message.

Returns
The deleted message object.

get_reactors(self, emoji,*args,**kwargs)

Returns an iterator which paginates the reactors for the given emoji.

Returns
An iterator which handles pagination of reactors.

create_reaction(self, emoji)

add_reaction(self, emoji)

Adds a reaction to the message.

Parameters
Name Type Description
emoji `Emoji`|str An emoji or string representing an emoji

delete_reaction(self, emoji, user)

Deletes a reaction from the message.

is_mentioned(self, entity)

Returns
Whether the give entity was mentioned.

without_mentions(self, valid_only)

Returns
the message contents with all mentions removed.

with_proper_mentions(self)

Returns
The message with mentions replaced w/ their proper form.

replace_mentions(self, user_replace, role_replace=None, channel_replace=None, nonexistant=False)

Replaces user and role mentions with the result of a given lambda/function.

Returns
The message contents with all valid mentions replaced.
Args
Name Type Description
user_replace function A function taking a single argument, the user object mentioned, and returning a valid string.
role_replace function A function taking a single argument, the role ID mentioned, and returning a valid string.

MessageTable

Functions

init(self, sep, codeblock=True, header_break=True, language=None)

recalculate_size_index(self, cols)

set_header(self,*args)

add(self,*args)

compile_one(self, cols)

compile(self)

results matching ""

    No results matching ""