Messages

The following section documents everything related to messages. Messages are core part of Stoat and they are way for users to communicate.

Models

BaseSystemEvent

class stoat.BaseSystemEvent[source]

Represents system event within message.

TextSystemEvent

Attributes
Methods
class stoat.TextSystemEvent(*, content)[source]

A simple text system message.

This inherits from BaseSystemEvent.

content

The event contents.

Type:

str

attach_state(message, /)[source]

TextSystemEvent Attach a state to system event.

Parameters:

message (Message) – The state to attach.

to_dict()[source]

dict: Convert system event to raw data.

property system_content[source]

The displayed system’s content.

Type:

str

StatelessUserAddedSystemEvent

class stoat.StatelessUserAddedSystemEvent(*, internal_user, internal_by)[source]

An user was added to a group.

This inherits from BaseSystemEvent.

internal_user

The ID of the user that was added, or full user instance.

Type:

Union[User, str]

internal_by

The ID of the user that added this user, or full user instance.

Type:

Union[User, str]

get_by()[source]

Optional[User]: The user that added this user.

get_user()[source]

Optional[User]: The user that was added.

property by[source]

The user that added this user.

Type:

User

property by_id[source]

The user’s ID that added this user.

Type:

str

property system_content[source]

The displayed system’s content.

Type:

str

property user[source]

The user that was added.

Type:

User

property user_id[source]

The user’s ID that was added.

Type:

str

attach_state(message, /)[source]

UserAddedSystemEvent: Attach a state to system event.

Parameters:

message (Message) – The state to attach.

to_dict()[source]

dict: Convert system event to raw data.

UserAddedSystemEvent

class stoat.UserAddedSystemEvent(*, internal_user, internal_by, message)[source]

An user was added to a group.

This is a stateful version of StatelessUserAddedSystemEvent, and inherits from it.

message

The message that holds this system event.

Type:

Message

get_user()[source]

Optional[User]: The user that was added.

get_by()[source]

Optional[User]: The user that added this user.

attach_state(message, /)[source]

UserAddedSystemEvent: Attach a state to system event.

Parameters:

message (Message) – The state to attach.

property by[source]

The user that added this user.

Type:

User

property by_id[source]

The user’s ID that added this user.

Type:

str

internal_by

The ID of the user that added this user, or full user instance.

Type:

Union[User, str]

internal_user

The ID of the user that was added, or full user instance.

Type:

Union[User, str]

property system_content[source]

The displayed system’s content.

Type:

str

to_dict()[source]

dict: Convert system event to raw data.

property user[source]

The user that was added.

Type:

User

property user_id[source]

The user’s ID that was added.

Type:

str

StatelessUserRemovedSystemEvent

class stoat.StatelessUserRemovedSystemEvent(*, internal_user, internal_by)[source]

An user was removed from a group.

This inherits from BaseSystemEvent.

internal_user

The ID of the user that was removed, or full user instance.

Type:

Union[User, str]

internal_by

The ID of the user that removed this user, or full user instance.

Type:

Union[User, str]

get_by()[source]

Optional[User]: The user that removed this user.

get_user()[source]

Optional[User]: The user that was removed.

property by[source]

The user that removed this user.

Type:

User

property by_id[source]

The user’s ID that removed this user.

Type:

str

property system_content[source]

The displayed system’s content.

Type:

str

property user[source]

The user that was removed.

Type:

User

property user_id[source]

The user’s ID that was removed.

Type:

str

attach_state(message, /)[source]

UserRemovedSystemEvent: Attach a state to system event.

Parameters:

message (Message) – The state to attach.

to_dict()[source]

dict: Convert system event to raw data.

UserRemovedSystemEvent

class stoat.UserRemovedSystemEvent(*, internal_user, internal_by, message)[source]

An user was removed from a group.

This is a stateful version of StatelessUserRemovedSystemEvent, and inherits from it.

message

The message that holds this system event.

Type:

Message

get_by()[source]

Optional[User]: The user that removed this user.

get_user()[source]

Optional[User]: The user that was removed.

attach_state(message, /)[source]

UserRemovedSystemEvent: Attach a state to system event.

Parameters:

message (Message) – The state to attach.

property by[source]

The user that removed this user.

Type:

User

property by_id[source]

The user’s ID that removed this user.

Type:

str

internal_by

The ID of the user that removed this user, or full user instance.

Type:

Union[User, str]

internal_user

The ID of the user that was removed, or full user instance.

Type:

Union[User, str]

property system_content[source]

The displayed system’s content.

Type:

str

to_dict()[source]

dict: Convert system event to raw data.

property user[source]

The user that was removed.

Type:

User

property user_id[source]

The user’s ID that was removed.

Type:

str

StatelessUserJoinedSystemEvent

class stoat.StatelessUserJoinedSystemEvent(*, internal_user)[source]

An user joined a server.

This inherits from BaseSystemEvent.

internal_user

The ID of the user that joined this server, or full member/user instance.

Type:

Union[Member, User, str]

get_user()[source]

Optional[Union[Member, User]]: The user that joined this server.

get_user_as_member()[source]

Optional[Member]: The user that joined this server.

get_user_as_user()[source]

Optional[User]: The user that joined this server.

property system_content[source]

The displayed system’s content.

Type:

str

property user[source]

The user that joined this server.

Type:

Union[Member, User]

property user_as_member[source]

The user that joined this server.

Type:

Member

property user_as_user[source]

The user that joined this server.

Type:

User

property user_id[source]

The user’s ID that joined this server.

Type:

str

attach_state(message, /)[source]

UserJoinedSystemEvent: Attach a state to system event.

Parameters:

message (Message) – The state to attach.

to_dict()[source]

dict: Convert system event to raw data.

UserJoinedSystemEvent

class stoat.UserJoinedSystemEvent(*, internal_user, message)[source]

An user joined a server.

This is a stateful version of StatelessUserJoinedSystemEvent, and inherits from it.

message

The message that holds this system event.

Type:

Message

get_user()[source]

Optional[Union[Member, User]]: The user that was added.

get_user_as_member()[source]

Optional[Member]: The user that was added.

get_user_as_user()[source]

Optional[User]: The user that was added.

attach_state(message, /)[source]

UserJoinedSystemEvent: Attach a state to system event.

Parameters:

message (Message) – The state to attach.

internal_user

The ID of the user that joined this server, or full member/user instance.

Type:

Union[Member, User, str]

property system_content[source]

The displayed system’s content.

Type:

str

to_dict()[source]

dict: Convert system event to raw data.

property user[source]

The user that joined this server.

Type:

Union[Member, User]

property user_as_member[source]

The user that joined this server.

Type:

Member

property user_as_user[source]

The user that joined this server.

Type:

User

property user_id[source]

The user’s ID that joined this server.

Type:

str

StatelessUserLeftSystemEvent

class stoat.StatelessUserLeftSystemEvent(*, internal_user)[source]

An user left a group or server.

This inherits from BaseSystemEvent.

internal_user

The ID of the user that left this group/server, or full member/user instance.

Type:

Union[Member, User, str]

get_user()[source]

Optional[Union[Member, User]]: The user that left this group/server.

get_user_as_member()[source]

Optional[Member]: The user that left this group/server.

get_user_as_user()[source]

Optional[User]: The user that left this group/server.

property system_content[source]

The displayed system’s content.

Type:

str

property user[source]

The user that left this group/server.

Type:

Union[Member, User]

property user_as_member[source]

The user that left this group/server.

Type:

Member

property user_as_user[source]

The user that left this group/server.

Type:

User

property user_id[source]

The user’s ID that left this group/server.

Type:

str

attach_state(message, /)[source]

UserLeftSystemEvent: Attach a state to system event.

Parameters:

message (Message) – The state to attach.

to_dict()[source]

dict: Convert system event to raw data.

UserLeftSystemEvent

class stoat.UserLeftSystemEvent(*, internal_user, message)[source]

An user left a group or server.

This is a stateful version of StatelessUserLeftSystemEvent, and inherits from it.

message

The message that holds this system event.

Type:

Message

get_user()[source]

Optional[Union[Member, User]]: The user that left this group/server.

get_user_as_member()[source]

Optional[Member]: The user that left this group/server.

get_user_as_user()[source]

Optional[User]: The user that left this group/server.

attach_state(message, /)[source]

UserLeftSystemEvent: Attach a state to system event.

Parameters:

message (Message) – The state to attach.

internal_user

The ID of the user that left this group/server, or full member/user instance.

Type:

Union[Member, User, str]

property system_content[source]

The displayed system’s content.

Type:

str

to_dict()[source]

dict: Convert system event to raw data.

property user[source]

The user that left this group/server.

Type:

Union[Member, User]

property user_as_member[source]

The user that left this group/server.

Type:

Member

property user_as_user[source]

The user that left this group/server.

Type:

User

property user_id[source]

The user’s ID that left this group/server.

Type:

str

StatelessUserKickedSystemEvent

class stoat.StatelessUserKickedSystemEvent(*, internal_user)[source]

A member was kicked from a server.

This inherits from BaseSystemEvent.

internal_user

The ID of the user that kicked from this server, or full member/user instance.

Type:

Union[Member, User, str]

get_user()[source]

Optional[Union[Member, User]]: The user that was kicked from this server.

get_user_as_member()[source]

Optional[Member]: The user that was kicked from this server.

get_user_as_user()[source]

Optional[User]: The user that was kicked from this server.

property system_content[source]

The displayed system’s content.

Type:

str

property user[source]

The user that was kicked from this server.

Type:

Union[Member, User]

property user_as_member[source]

The user that was kicked from this server.

Type:

Member

property user_as_user[source]

The user that was kicked from this server.

Type:

User

property user_id[source]

The user’s ID that was kicked from this server.

Type:

str

attach_state(message, /)[source]

UserKickedSystemEvent: Attach a state to system event.

Parameters:

message (Message) – The state to attach.

to_dict()[source]

dict: Convert system event to raw data.

UserKickedSystemEvent

class stoat.UserKickedSystemEvent(*, internal_user, message)[source]

A member was kicked from a server.

This is a stateful version of StatelessUserKickedSystemEvent, and inherits from it.

message

The message that holds this system event.

Type:

Message

get_user()[source]

Optional[Union[Member, User]]: The user that was kicked from this server.

get_user_as_member()[source]

Optional[Member]: The user that was kicked from this server.

get_user_as_user()[source]

Optional[User]: The user that was kicked from this server.

attach_state(message, /)[source]

UserKickedSystemEvent: Attach a state to system event.

Parameters:

message (Message) – The state to attach.

internal_user

The ID of the user that kicked from this server, or full member/user instance.

Type:

Union[Member, User, str]

property system_content[source]

The displayed system’s content.

Type:

str

to_dict()[source]

dict: Convert system event to raw data.

property user[source]

The user that was kicked from this server.

Type:

Union[Member, User]

property user_as_member[source]

The user that was kicked from this server.

Type:

Member

property user_as_user[source]

The user that was kicked from this server.

Type:

User

property user_id[source]

The user’s ID that was kicked from this server.

Type:

str

StatelessUserBannedSystemEvent

class stoat.StatelessUserBannedSystemEvent(*, internal_user)[source]

An user was banned from a server.

This inherits from BaseSystemEvent.

internal_user

The ID of the user that was banned from this server, or full member/user instance.

Type:

Union[Member, User, str]

get_user()[source]

Optional[Union[Member, User]]: The user that was banned from this server.

get_user_as_member()[source]

Optional[Member]: The user that was banned from this server.

get_user_as_user()[source]

Optional[User]: The user that was banned from this server.

property system_content[source]

The displayed system’s content.

Type:

str

property user[source]

The user that was banned from this server.

Type:

Union[Member, User]

property user_as_member[source]

The user that was banned from this server.

Type:

Member

property user_as_user[source]

The user that was banned from this server.

Type:

User

property user_id[source]

The user’s ID that was kicked from this server.

Type:

str

attach_state(message, /)[source]

UserBannedSystemEvent: Attach a state to system event.

Parameters:

message (Message) – The state to attach.

to_dict()[source]

dict: Convert system event to raw data.

UserBannedSystemEvent

class stoat.UserBannedSystemEvent(*, internal_user, message)[source]

An user was banned from a server.

This is a stateful version of StatelessUserBannedSystemEvent, and inherits from it.

message

The message that holds this system event.

Type:

Message

get_user()[source]

Optional[Union[Member, User]]: The user that was banned from this server.

get_user_as_member()[source]

Optional[Member]: The user that was banned from this server.

get_user_as_user()[source]

Optional[User]: The user that was banned from this server.

attach_state(message, /)[source]

UserBannedSystemEvent: Attach a state to system event.

Parameters:

message (Message) – The state to attach.

internal_user

The ID of the user that was banned from this server, or full member/user instance.

Type:

Union[Member, User, str]

property system_content[source]

The displayed system’s content.

Type:

str

to_dict()[source]

dict: Convert system event to raw data.

property user[source]

The user that was banned from this server.

Type:

Union[Member, User]

property user_as_member[source]

The user that was banned from this server.

Type:

Member

property user_as_user[source]

The user that was banned from this server.

Type:

User

property user_id[source]

The user’s ID that was kicked from this server.

Type:

str

StatelessChannelRenamedSystemEvent

class stoat.StatelessChannelRenamedSystemEvent(*, name, internal_by)[source]

An user renamed group.

This inherits from BaseSystemEvent.

name

The new name of this group.

Type:

str

internal_by

The ID of the user that renamed this group, or full user instance.

Type:

Union[User, str]

get_by()[source]

Optional[User]: The user that renamed this group.

property by[source]

The user that renamed this group.

Type:

User

property by_id[source]

The user’s ID that renamed this group.

Type:

str

property system_content[source]

The displayed system’s content.

Type:

str

attach_state(message, /)[source]

ChannelRenamedSystemEvent: Attach a state to system event.

Parameters:

message (Message) – The state to attach.

to_dict()[source]

dict: Convert system event to raw data.

ChannelRenamedSystemEvent

class stoat.ChannelRenamedSystemEvent(*, name, internal_by, message)[source]

An user renamed group.

This is a stateful version of StatelessChannelRenamedSystemEvent, and inherits from it.

message

The message that holds this system event.

Type:

Message

get_by()[source]

Optional[User]: The user that renamed this group.

attach_state(message, /)[source]

ChannelRenamedSystemEvent: Attach a state to system event.

Parameters:

message (Message) – The state to attach.

property by[source]

The user that renamed this group.

Type:

User

property by_id[source]

The user’s ID that renamed this group.

Type:

str

internal_by

The ID of the user that renamed this group, or full user instance.

Type:

Union[User, str]

name

The new name of this group.

Type:

str

property system_content[source]

The displayed system’s content.

Type:

str

to_dict()[source]

dict: Convert system event to raw data.

StatelessChannelDescriptionChangedSystemEvent

Methods
class stoat.StatelessChannelDescriptionChangedSystemEvent(*, internal_by)[source]

An user changed group’s description.

This inherits from BaseSystemEvent.

internal_by

The ID of the user that changed description of this group, or full user instance.

Type:

Union[User, str]

get_by()[source]

Optional[User]: The user that changed description of this group.

property by[source]

The user that changed description of this group.

Type:

User

property by_id[source]

The user’s ID that changed description of this group.

Type:

str

property system_content[source]

The displayed system’s content.

Type:

str

attach_state(message, /)[source]

ChannelDescriptionChangedSystemEvent: Attach a state to system event.

Parameters:

message (Message) – The state to attach.

to_dict()[source]

dict: Convert system event to raw data.

ChannelDescriptionChangedSystemEvent

class stoat.ChannelDescriptionChangedSystemEvent(*, internal_by, message)[source]

An user changed group’s description.

This is a stateful version of StatelessChannelDescriptionChangedSystemEvent, and inherits from it.

message

The message that holds this system event.

Type:

Message

get_by()[source]

Optional[User]: The user that changed description of this group.

attach_state(message, /)[source]

ChannelDescriptionChangedSystemEvent: Attach a state to system event.

Parameters:

message (Message) – The state to attach.

property by[source]

The user that changed description of this group.

Type:

User

property by_id[source]

The user’s ID that changed description of this group.

Type:

str

internal_by

The ID of the user that changed description of this group, or full user instance.

Type:

Union[User, str]

property system_content[source]

The displayed system’s content.

Type:

str

to_dict()[source]

dict: Convert system event to raw data.

StatelessChannelIconChangedSystemEvent

Methods
class stoat.StatelessChannelIconChangedSystemEvent(*, internal_by)[source]

An user changed group’s icon.

This inherits from BaseSystemEvent.

internal_by

The ID of the user that changed icon of this group, or full user instance.

Type:

Union[User, str]

get_by()[source]

Optional[User]: The user that changed icon of this group.

property by[source]

The user that changed icon of this group.

Type:

User

property by_id[source]

The user’s ID that changed icon of this group.

Type:

str

property system_content[source]

The displayed system’s content.

Type:

str

attach_state(message, /)[source]

ChannelIconChangedSystemEvent: Attach a state to system event.

Parameters:

message (Message) – The state to attach.

to_dict()[source]

dict: Convert system event to raw data.

ChannelIconChangedSystemEvent

class stoat.ChannelIconChangedSystemEvent(*, internal_by, message)[source]

An user changed group’s icon.

This is a stateful version of StatelessChannelIconChangedSystemEvent, and inherits from it.

message

The message that holds this system event.

Type:

Message

get_by()[source]

Optional[User]: The user that changed icon of this group.

attach_state(message, /)[source]

ChannelIconChangedSystemEvent: Attach a state to system event.

Parameters:

message (Message) – The state to attach.

property by[source]

The user that changed icon of this group.

Type:

User

property by_id[source]

The user’s ID that changed icon of this group.

Type:

str

internal_by

The ID of the user that changed icon of this group, or full user instance.

Type:

Union[User, str]

property system_content[source]

The displayed system’s content.

Type:

str

to_dict()[source]

dict: Convert system event to raw data.

StatelessChannelOwnershipChangedSystemEvent

class stoat.StatelessChannelOwnershipChangedSystemEvent(*, internal_from, internal_to)[source]

A group owner transferred ownership to someone else.

This inherits from BaseSystemEvent.

internal_from

The ID of the user that was previous owner of this group, or full user instance.

Type:

Union[User, str]

internal_to

The ID of the user that became owner of this group, or full user instance.

Type:

Union[User, str]

get_from()[source]

Optional[User]: The user that was previous owner of this group.

get_to()[source]

Optional[User]: The user that became owner of this group.

property from_[source]

The user that was previous owner of this group.

Type:

User

property from_id[source]

The user’s ID that was previous owner of this group.

Type:

str

property to[source]

The user that became owner of this group.

Type:

User

property to_id[source]

The user’s ID that became owner of this group.

Type:

str

property system_content[source]

The displayed system’s content.

Type:

str

attach_state(message, /)[source]

ChannelOwnershipChangedSystemEvent: Attach a state to system event.

Parameters:

message (Message) – The state to attach.

to_dict()[source]

dict: Convert system event to raw data.

ChannelOwnershipChangedSystemEvent

class stoat.ChannelOwnershipChangedSystemEvent(*, internal_from, internal_to, message)[source]

A group owner transferred ownership to someone else.

This is a stateful version of StatelessChannelOwnershipChangedSystemEvent, and inherits from it.

message

The message that holds this system event.

Type:

Message

get_from()[source]

Optional[User]: The user that was previous owner of this group.

get_to()[source]

Optional[User]: The user that became owner of this group.

attach_state(message, /)[source]

ChannelOwnershipChangedSystemEvent: Attach a state to system event.

Parameters:

message (Message) – The state to attach.

property from_[source]

The user that was previous owner of this group.

Type:

User

property from_id[source]

The user’s ID that was previous owner of this group.

Type:

str

internal_from

The ID of the user that was previous owner of this group, or full user instance.

Type:

Union[User, str]

internal_to

The ID of the user that became owner of this group, or full user instance.

Type:

Union[User, str]

property system_content[source]

The displayed system’s content.

Type:

str

property to[source]

The user that became owner of this group.

Type:

User

to_dict()[source]

dict: Convert system event to raw data.

property to_id[source]

The user’s ID that became owner of this group.

Type:

str

StatelessMessagePinnedSystemEvent

class stoat.StatelessMessagePinnedSystemEvent(*, pinned_message_id, internal_by)[source]

A message was pinned.

This inherits from BaseSystemEvent.

pinned_message_id

The ID of the message that was pinned.

Type:

str

internal_by

The ID of the user that pinned a message, or full member/user instance.

Type:

Union[Member, User, str]

get_by()[source]

Optional[Union[Member, User]]: The user that pinned a message.

get_by_as_member()[source]

Optional[Member]: The user that pinned a message.

get_by_as_user()[source]

Optional[User]: The user that pinned a message.

property by[source]

The user that pinned a message.

Type:

Union[Member, User]

property by_as_member[source]

The user that pinned a message.

Type:

Member

property by_as_user[source]

The user that pinned a message.

Type:

User

property by_id[source]

The user’s ID that pinned a message.

Type:

str

property system_content[source]

The displayed system’s content.

Type:

str

attach_state(message, /)[source]

MessagePinnedSystemEvent: Attach a state to system event.

Parameters:

message (Message) – The state to attach.

to_dict()[source]

dict: Convert system event to raw data.

MessagePinnedSystemEvent

class stoat.MessagePinnedSystemEvent(*, pinned_message_id, internal_by, message)[source]

A message was pinned.

This is a stateful version of StatelessMessagePinnedSystemEvent, and inherits from it.

message

The message that holds this system event.

Type:

Message

get_by()[source]

Optional[Union[Member, User]]: The user that pinned a message.

get_by_as_member()[source]

Optional[Member]: The user that pinned a message.

get_by_as_user()[source]

Optional[User]: The user that pinned a message.

get_pinned_message()[source]

Optional[Message]: The message that was pinned in this channel.

attach_state(message, /)[source]

MessagePinnedSystemEvent: Attach a state to system event.

Parameters:

message (Message) – The state to attach.

property by[source]

The user that pinned a message.

Type:

Union[Member, User]

property by_as_member[source]

The user that pinned a message.

Type:

Member

property by_as_user[source]

The user that pinned a message.

Type:

User

property by_id[source]

The user’s ID that pinned a message.

Type:

str

internal_by

The ID of the user that pinned a message, or full member/user instance.

Type:

Union[Member, User, str]

pinned_message_id

The ID of the message that was pinned.

Type:

str

property system_content[source]

The displayed system’s content.

Type:

str

to_dict()[source]

dict: Convert system event to raw data.

StatelessMessageUnpinnedSystemEvent

class stoat.StatelessMessageUnpinnedSystemEvent(*, unpinned_message_id, internal_by)[source]

A message was unpinned.

This inherits from BaseSystemEvent.

unpinned_message_id

The ID of the message that was unpinned.

Type:

str

internal_by

The ID of the user that unpinned a message, or full member/user instance.

Type:

Union[Member, User, str]

get_by()[source]

Optional[Union[Member, User]]: The user that unpinned a message.

get_by_as_member()[source]

Optional[Member]: The user that unpinned a message.

get_by_as_user()[source]

Optional[User]: The user that unpinned a message.

property by[source]

The user that unpinned a message.

Type:

Union[Member, User]

property by_as_member[source]

The user that unpinned a message.

Type:

Member

property by_as_user[source]

The user that unpinned a message.

Type:

User

property by_id[source]

The user’s ID that unpinned a message.

Type:

str

property system_content[source]

The displayed system’s content.

Type:

str

attach_state(message, /)[source]

MessageUnpinnedSystemEvent: Attach a state to system event.

Parameters:

message (Message) – The state to attach.

to_dict()[source]

dict: Convert system event to raw data.

MessageUnpinnedSystemEvent

class stoat.MessageUnpinnedSystemEvent(*, unpinned_message_id, internal_by, message)[source]

A message was unpinned.

This is a stateful version of StatelessMessageUnpinnedSystemEvent, and inherits from it.

message

The message that holds this system event.

Type:

Message

get_by()[source]

Optional[Union[Member, User]]: The user that unpinned a message.

get_by_as_member()[source]

Optional[Member]: The user that unpinned a message.

get_by_as_user()[source]

Optional[User]: The user that unpinned a message.

get_unpinned_message()[source]

Optional[Message]: The message that was unpinned from this channel.

attach_state(message, /)[source]

MessageUnpinnedSystemEvent: Attach a state to system event.

Parameters:

message (Message) – The state to attach.

property by[source]

The user that unpinned a message.

Type:

Union[Member, User]

property by_as_member[source]

The user that unpinned a message.

Type:

Member

property by_as_user[source]

The user that unpinned a message.

Type:

User

property by_id[source]

The user’s ID that unpinned a message.

Type:

str

internal_by

The ID of the user that unpinned a message, or full member/user instance.

Type:

Union[Member, User, str]

property system_content[source]

The displayed system’s content.

Type:

str

to_dict()[source]

dict: Convert system event to raw data.

unpinned_message_id

The ID of the message that was unpinned.

Type:

str

StatelessCallStartedSystemEvent

class stoat.StatelessCallStartedSystemEvent(*, internal_by, finished_at)[source]

A call was just started in the channel.

This inherits from BaseSystemEvent.

internal_by

The ID of the user that started a call, or full user instance.

Type:

Union[User, str]

finished_at

When the call was finished.

Added in version 1.2.

Type:

Optional[datetime]

get_by()[source]

Optional[User]: The user that started a call.

property by[source]

The user that started a call.

Type:

User

property by_id[source]

The user’s ID that started a call.

Type:

str

property system_content[source]

The displayed system’s content.

Type:

str

attach_state(message, /)[source]

CallStartedSystemEvent: Attach a state to system event.

Parameters:

message (Message) – The state to attach.

to_dict()[source]

dict: Convert system event to raw data.

CallStartedSystemEvent

class stoat.CallStartedSystemEvent(*, internal_by, finished_at, message)[source]

A call was just started in the channel.

This is a stateful version of StatelessCallStartedSystemEvent, and inherits from it.

message

The message that holds this system event.

Type:

Message

get_by()[source]

Optional[User]: The user that started call.

attach_state(message, /)[source]

CallStartedSystemEvent: Attach a state to system event.

Parameters:

message (Message) – The state to attach.

property by[source]

The user that started a call.

Type:

User

property by_id[source]

The user’s ID that started a call.

Type:

str

finished_at

When the call was finished.

Added in version 1.2.

Type:

Optional[datetime]

internal_by

The ID of the user that started a call, or full user instance.

Type:

Union[User, str]

property system_content[source]

The displayed system’s content.

Type:

str

to_dict()[source]

dict: Convert system event to raw data.

StatelessSystemEvent

class stoat.StatelessSystemEvent

An union of all stateless system events that message may hold.

The following classes are included in this union:

SystemEvent

class stoat.SystemEvent

An union of all system events that message may hold.

The following classes are included in this union:

BaseMessage

Methods
class stoat.BaseMessage(*, state, id, channel_id)[source]

Represents a message in channel on Stoat.

This inherits from Base.

channel_id

The channel’s ID this message was sent in.

Type:

str

get_channel()[source]

Optional[TextableChannel]: The channel this message was sent in.

get_server()[source]

Returns the server this message was sent in.

Returns:

The server and server ID (may be empty).

Return type:

Tuple[Optional[Server], str]

property channel[source]

The channel this message was sent in.

Type:

Union[TextableChannel, PartialMessageable]

property server[source]

The server this message was sent in.

Type:

Optional[Server]

await ack(*, http_overrides=None)[source]

This function is a coroutine.

Marks this message as read.

This is an alias for acknowledge().

You must have view_channel to do this.

Fires MessageAckEvent for the current user.

Note

This can only be used by non-bot accounts.

Raises:
  • HTTPException – Possible values for type:

    Value

    Reason

    IsBot

    The current token belongs to bot account.

  • Unauthorized – Possible values for type:

    Value

    Reason

    InvalidSession

    The current bot/user token is invalid.

  • Forbidden – Possible values for type:

    Value

    Reason

    MissingPermission

    You do not have the proper permissions to view the message.

  • NotFound – Possible values for type:

    Value

    Reason

    NotFound

    The channel was not found.

await acknowledge(*, http_overrides=None)[source]

This function is a coroutine.

Marks this message as read.

You must have view_channel to do this.

There is an alias for this called ack().

Fires MessageAckEvent for the current user.

Note

This can only be used by non-bot accounts.

Parameters:

http_overrides (Optional[HTTPOverrideOptions]) – The HTTP request overrides.

Raises:
  • HTTPException – Possible values for type:

    Value

    Reason

    IsBot

    The current token belongs to bot account.

  • Unauthorized – Possible values for type:

    Value

    Reason

    InvalidSession

    The current bot/user token is invalid.

  • Forbidden – Possible values for type:

    Value

    Reason

    MissingPermission

    You do not have the proper permissions to view the message.

  • NotFound – Possible values for type:

    Value

    Reason

    NotFound

    The channel was not found.

await clear_reactions(*, http_overrides=None)[source]

This function is a coroutine.

Removes all the reactions from the message.

You must have manage_messages to do this.

Fires MessageUpdateEvent with empty reactions for all users who can see target channel.

Parameters:

http_overrides (Optional[HTTPOverrideOptions]) – The HTTP request overrides.

Raises:
  • Unauthorized – Possible values for type:

    Value

    Reason

    InvalidSession

    The current bot/user token is invalid.

  • Forbidden – Possible values for type:

    Value

    Reason

    MissingPermission

    You do not have the proper permissions to remove all the reactions.

  • NotFound – Possible values for type:

    Value

    Reason

    NotFound

    The channel or message was not found.

  • InternalServerError – Possible values for type:

    Value

    Reason

    Populated attributes

    DatabaseError

    Something went wrong during querying database.

    collection, operation

await delete(*, http_overrides=None)[source]

This function is a coroutine.

Deletes the message in a channel.

You must have manage_messages to do this if message is not yours.

Fires MessageDeleteEvent for all users who can see target channel.

Parameters:

http_overrides (Optional[HTTPOverrideOptions]) – The HTTP request overrides.

Raises:
  • Unauthorized – Possible values for type:

    Value

    Reason

    InvalidSession

    The current bot/user token is invalid.

  • Forbidden – Possible values for type:

    Value

    Reason

    MissingPermission

    You do not have the proper permissions to delete the message.

  • NotFound – Possible values for type:

    Value

    Reason

    NotFound

    The channel or message was not found.

  • InternalServerError – Possible values for type:

    Value

    Reason

    Populated attributes

    DatabaseError

    Something went wrong during querying database.

    collection, operation

await edit(*, http_overrides=None, content=UNDEFINED, embeds=UNDEFINED)[source]

This function is a coroutine.

Edits the message.

Fires MessageUpdateEvent and optionally MessageAppendEvent, both for all users who can see target channel.

Parameters:
  • http_overrides (Optional[HTTPOverrideOptions]) – The HTTP request overrides.

  • content (UndefinedOr[str]) – The new content to replace the message with. Must be between 1 and 2000 characters long.

  • embeds (UndefinedOr[List[SendableEmbed]]) –

    The new embeds to replace the original with. Must be a maximum of 10. To remove all embeds [] should be passed.

    You must have send_embeds to provide this.

Raises:
  • HTTPException – Possible values for type:

    Value

    Reason

    FailedValidation

    The payload was invalid.

    PayloadTooLarge

    The message was too large.

  • Unauthorized – Possible values for type:

    Value

    Reason

    InvalidSession

    The current bot/user token is invalid.

  • Forbidden – Possible values for type:

    Value

    Reason

    CannotEditMessage

    The message you tried to edit isn’t yours.

    MissingPermission

    You do not have the proper permissions to send messages.

  • NotFound – Possible values for type:

    Value

    Reason

    NotFound

    The channel/message/file was not found.

  • InternalServerError – Possible values for type:

    Value

    Reason

    Populated attributes

    DatabaseError

    Something went wrong during querying database.

    collection, operation

Returns:

The newly edited message.

Return type:

Message

editing()[source]

Editing: Returns an asynchronous context manager that allows you to send an editing indicator for a message in channel for an indefinite period of time.

await fetch(*, http_overrides=None)[source]

This function is a coroutine.

Retrieves the message.

Parameters:

http_overrides (Optional[HTTPOverrideOptions]) – The HTTP request overrides.

Raises:
  • Unauthorized – Possible values for type:

    Value

    Reason

    InvalidSession

    The current bot/user token is invalid.

  • Forbidden – Possible values for type:

    Value

    Reason

    MissingPermission

    You do not have the proper permissions to view the channel.

  • NotFound – Possible values for type:

    Value

    Reason

    NotFound

    The channel/message was not found.

  • InternalServerError – Possible values for type:

    Value

    Reason

    Populated attributes

    DatabaseError

    Something went wrong during querying database.

    collection, operation

Returns:

The retrieved message.

Return type:

Message

await pin(*, http_overrides=None)[source]

This function is a coroutine.

Pins the message.

You must have manage_messages to do this, unless the channel is DMChannel.

Fires MessageUpdateEvent and MessageCreateEvent, both for all users who can see target channel.

Parameters:

http_overrides (Optional[HTTPOverrideOptions]) – The HTTP request overrides.

Raises:
  • HTTPException – Possible values for type:

    Value

    Reason

    AlreadyPinned

    The message was already pinned.

  • Unauthorized – Possible values for type:

    Value

    Reason

    InvalidSession

    The current bot/user token is invalid.

  • Forbidden – Possible values for type:

    Value

    Reason

    MissingPermission

    You do not have the proper permissions to pin the message.

  • NotFound – Possible values for type:

    Value

    Reason

    NotFound

    The channel/message was not found.

  • InternalServerError – Possible values for type:

    Value

    Reason

    Populated attributes

    DatabaseError

    Something went wrong during querying database.

    collection, operation

await react(emoji, *, http_overrides=None)[source]

This function is a coroutine.

React to this message.

You must have react to do this.

Fires MessageReactEvent for all users who can see target channel.

Parameters:
Raises:
  • HTTPException – Possible values for type:

    Value

    Reason

    InvalidOperation

    One of these:

  • Unauthorized – Possible values for type:

    Value

    Reason

    InvalidSession

    The current bot/user token is invalid.

  • Forbidden – Possible values for type:

    Value

    Reason

    MissingPermission

    You do not have the proper permissions to react.

  • NotFound – Possible values for type:

    Value

    Reason

    NotFound

    The channel/message/custom emoji was not found.

  • InternalServerError – Possible values for type:

    Value

    Reason

    Populated attributes

    DatabaseError

    Something went wrong during querying database.

    collection, operation

await reply(content=None, *, http_overrides=None, nonce=None, attachments=None, embeds=None, masquerade=None, interactions=None, silent=None, mention_everyone=None, mention_online=None, mention=True)[source]

This function is a coroutine.

Replies to this message.

You must have send_messages to do this.

If message mentions “@everyone” or “@online”, you must have mention_everyone to do that.

If message mentions any roles, you must mention_roles to do that.

Fires MessageCreateEvent and optionally MessageAppendEvent, both for all users who can see target channel.

Parameters:
  • content (Optional[str]) – The message content.

  • http_overrides (Optional[HTTPOverrideOptions]) – The HTTP request overrides.

  • nonce (Optional[str]) – The message nonce.

  • attachments (Optional[List[ResolvableResource]]) –

    The attachments to send the message with.

    You must have upload_files to provide this.

  • replies (Optional[List[Union[Reply, ULIDOr[BaseMessage]]]]) – The message replies.

  • embeds (Optional[List[SendableEmbed]]) –

    The embeds to send the message with.

    You must have send_embeds to provide this.

  • masquearde (Optional[MessageMasquerade]) –

    The message masquerade.

    You must have use_masquerade to provide this.

    If MessageMasquerade.color is provided, manage_roles is also required.

  • interactions (Optional[MessageInteractions]) –

    The message interactions.

    If MessageInteractions.reactions is provided, react is required.

  • silent (Optional[bool]) – Whether to suppress notifications or not.

  • mention_everyone (Optional[bool]) –

    Whether to mention all users who can see the channel. This cannot be mixed with mention_online parameter.

    Note

    User accounts cannot set this to True.

  • mention_online (Optional[bool]) –

    Whether to mention all users who are online and can see the channel. This cannot be mixed with mention_everyone parameter.

    Note

    User accounts cannot set this to True.

  • mention (bool) – Whether to mention author of message you’re replying to.

Raises:
  • HTTPException – Possible values for type:

    Value

    Reason

    EmptyMessage

    The message was empty.

    FailedValidation

    The payload was invalid.

    InvalidFlagValue

    Both mention_everyone and mention_online were True.

    InvalidOperation

    The passed nonce was already used. One of MessageInteractions.reactions elements was invalid.

    InvalidProperty

    MessageInteractions.restrict_reactions was True but MessageInteractions.reactions was empty.

    IsBot

    The current token belongs to bot account.

    IsNotBot

    The current token belongs to user account.

    PayloadTooLarge

    The message was too large.

    TooManyAttachments

    You provided more attachments than allowed on this instance.

    TooManyEmbeds

    You provided more embeds than allowed on this instance.

    TooManyReplies

    You were replying to more messages than was allowed on this instance.

  • Unauthorized – Possible values for type:

    Value

    Reason

    InvalidSession

    The current bot/user token is invalid.

  • Forbidden – Possible values for type:

    Value

    Reason

    MissingPermission

    You do not have the proper permissions to send messages.

  • NotFound – Possible values for type:

    Value

    Reason

    NotFound

    The channel/file/reply was not found.

  • InternalServerError – Possible values for type:

    Value

    Reason

    Populated attributes

    DatabaseError

    Something went wrong during querying database.

    collection, operation

    InternalError

    Somehow something went wrong during message creation.

Returns:

The message that was sent.

Return type:

Message

await report(reason, *, http_overrides=None, additional_context=None)[source]

This function is a coroutine.

Report the message to the instance moderation team.

Fires ReportCreateEvent internally (but not fired over WebSocket).

Internally, 15 messages around provided message will be snapshotted for context. All attachments of provided message are snapshotted as well.

Note

This can only be used by non-bot accounts.

Parameters:
  • reason (ContentReportReason) – The reason for reporting.

  • http_overrides (Optional[HTTPOverrideOptions]) – The HTTP request overrides.

  • additional_context (Optional[str]) – The additional context for moderation team. Can be only up to 1000 characters.

Raises:
  • HTTPException – Possible values for type:

    Value

    Reason

    CannotReportYourself

    You tried to report your own message.

    FailedValidation

    The payload was invalid.

  • Unauthorized – Possible values for type:

    Value

    Reason

    InvalidSession

    The current bot/user token is invalid.

  • NotFound – Possible values for type:

    Value

    Reason

    NotFound

    The message was not found.

  • InternalServerError – Possible values for type:

    Value

    Reason

    Populated attributes

    DatabaseError

    Something went wrong during querying database.

    collection, operation

await unpin(*, http_overrides=None)[source]

This function is a coroutine.

Unpins the message.

You must have manage_messages to do this, unless the channel is DMChannel.

Fires MessageUpdateEvent and MessageCreateEvent, both for all users who can see target channel.

Parameters:

http_overrides (Optional[HTTPOverrideOptions]) – The HTTP request overrides.

Raises:
  • HTTPException – Possible values for type:

    Value

    Reason

    NotPinned

    The message was not pinned.

  • Unauthorized – Possible values for type:

    Value

    Reason

    InvalidSession

    The current bot/user token is invalid.

  • Forbidden – Possible values for type:

    Value

    Reason

    MissingPermission

    You do not have the proper permissions to unpin the message.

  • NotFound – Possible values for type:

    Value

    Reason

    NotFound

    The channel/message was not found.

  • InternalServerError – Possible values for type:

    Value

    Reason

    Populated attributes

    DatabaseError

    Something went wrong during querying database.

    collection, operation

await unreact(emoji, *, http_overrides=None, user=None, remove_all=None)[source]

This function is a coroutine.

Remove your own, someone else’s or all of a given reaction.

You must have react to do this.

Fires MessageClearReactionEvent if remove_all is True or MessageUnreactEvent, for all users who can see target channel.

Parameters:
Raises:
  • Unauthorized – Possible values for type:

    Value

    Reason

    InvalidSession

    The current bot/user token is invalid.

  • Forbidden – Possible values for type:

    Value

    Reason

    MissingPermission

    You do not have the proper permissions to remove reaction.

  • NotFound – Possible values for type:

    Value

    Reason

    NotFound

    One of these:

    • The channel was not found.

    • The message was not found.

    • The user provided did not react.

  • InternalServerError – Possible values for type:

    Value

    Reason

    Populated attributes

    DatabaseError

    Something went wrong during querying database.

    collection, operation

PartialMessage

class stoat.PartialMessage(*, state, id, channel_id, content, edited_at, internal_embeds, pinned, reactions)[source]

Represents partial message in channel on Stoat.

This inherits from BaseMessage.

content

The new message’s content.

Type:

UndefinedOr[str]

edited_at

When the message was edited.

Type:

UndefinedOr[datetime]

internal_embeds

The new message embeds.

Type:

UndefinedOr[List[StatelessEmbed]]

pinned

Whether the message was just pinned.

Type:

UndefinedOr[bool]

reactions

The new message’s reactions.

Type:

UndefinedOr[Dict[str, Tuple[str, …]]]

property embeds[source]

The new message embeds.

Type:

UndefinedOr[List[Embed]]

MessageAppendData

Attributes
class stoat.MessageAppendData(*, state, id, channel_id, internal_embeds)[source]

Appended data to message in channel on Stoat.

This inherits from BaseMessage.

internal_embeds

The stateless embeds that were appended.

Type:

UndefinedOr[List[StatelessEmbed]]

property embeds[source]

The embeds that were appended.

Type:

UndefinedOr[List[Embed]]

Message

class stoat.Message(*, state, id, nonce, channel_id, internal_author, webhook, content, internal_system_event, internal_attachments, edited_at, internal_embeds, mention_ids, role_mention_ids, replies, reactions, interactions, masquerade, pinned, raw_flags)[source]

Represents a message in channel on Stoat.

This inherits from BaseMessage.

await ack(*, http_overrides=None)[source]

This function is a coroutine.

Marks this message as read.

This is an alias for acknowledge().

You must have view_channel to do this.

Fires MessageAckEvent for the current user.

Note

This can only be used by non-bot accounts.

Raises:
  • HTTPException – Possible values for type:

    Value

    Reason

    IsBot

    The current token belongs to bot account.

  • Unauthorized – Possible values for type:

    Value

    Reason

    InvalidSession

    The current bot/user token is invalid.

  • Forbidden – Possible values for type:

    Value

    Reason

    MissingPermission

    You do not have the proper permissions to view the message.

  • NotFound – Possible values for type:

    Value

    Reason

    NotFound

    The channel was not found.

await acknowledge(*, http_overrides=None)[source]

This function is a coroutine.

Marks this message as read.

You must have view_channel to do this.

There is an alias for this called ack().

Fires MessageAckEvent for the current user.

Note

This can only be used by non-bot accounts.

Parameters:

http_overrides (Optional[HTTPOverrideOptions]) – The HTTP request overrides.

Raises:
  • HTTPException – Possible values for type:

    Value

    Reason

    IsBot

    The current token belongs to bot account.

  • Unauthorized – Possible values for type:

    Value

    Reason

    InvalidSession

    The current bot/user token is invalid.

  • Forbidden – Possible values for type:

    Value

    Reason

    MissingPermission

    You do not have the proper permissions to view the message.

  • NotFound – Possible values for type:

    Value

    Reason

    NotFound

    The channel was not found.

property channel[source]

The channel this message was sent in.

Type:

Union[TextableChannel, PartialMessageable]

await clear_reactions(*, http_overrides=None)[source]

This function is a coroutine.

Removes all the reactions from the message.

You must have manage_messages to do this.

Fires MessageUpdateEvent with empty reactions for all users who can see target channel.

Parameters:

http_overrides (Optional[HTTPOverrideOptions]) – The HTTP request overrides.

Raises:
  • Unauthorized – Possible values for type:

    Value

    Reason

    InvalidSession

    The current bot/user token is invalid.

  • Forbidden – Possible values for type:

    Value

    Reason

    MissingPermission

    You do not have the proper permissions to remove all the reactions.

  • NotFound – Possible values for type:

    Value

    Reason

    NotFound

    The channel or message was not found.

  • InternalServerError – Possible values for type:

    Value

    Reason

    Populated attributes

    DatabaseError

    Something went wrong during querying database.

    collection, operation

await delete(*, http_overrides=None)[source]

This function is a coroutine.

Deletes the message in a channel.

You must have manage_messages to do this if message is not yours.

Fires MessageDeleteEvent for all users who can see target channel.

Parameters:

http_overrides (Optional[HTTPOverrideOptions]) – The HTTP request overrides.

Raises:
  • Unauthorized – Possible values for type:

    Value

    Reason

    InvalidSession

    The current bot/user token is invalid.

  • Forbidden – Possible values for type:

    Value

    Reason

    MissingPermission

    You do not have the proper permissions to delete the message.

  • NotFound – Possible values for type:

    Value

    Reason

    NotFound

    The channel or message was not found.

  • InternalServerError – Possible values for type:

    Value

    Reason

    Populated attributes

    DatabaseError

    Something went wrong during querying database.

    collection, operation

await edit(*, http_overrides=None, content=UNDEFINED, embeds=UNDEFINED)[source]

This function is a coroutine.

Edits the message.

Fires MessageUpdateEvent and optionally MessageAppendEvent, both for all users who can see target channel.

Parameters:
  • http_overrides (Optional[HTTPOverrideOptions]) – The HTTP request overrides.

  • content (UndefinedOr[str]) – The new content to replace the message with. Must be between 1 and 2000 characters long.

  • embeds (UndefinedOr[List[SendableEmbed]]) –

    The new embeds to replace the original with. Must be a maximum of 10. To remove all embeds [] should be passed.

    You must have send_embeds to provide this.

Raises:
  • HTTPException – Possible values for type:

    Value

    Reason

    FailedValidation

    The payload was invalid.

    PayloadTooLarge

    The message was too large.

  • Unauthorized – Possible values for type:

    Value

    Reason

    InvalidSession

    The current bot/user token is invalid.

  • Forbidden – Possible values for type:

    Value

    Reason

    CannotEditMessage

    The message you tried to edit isn’t yours.

    MissingPermission

    You do not have the proper permissions to send messages.

  • NotFound – Possible values for type:

    Value

    Reason

    NotFound

    The channel/message/file was not found.

  • InternalServerError – Possible values for type:

    Value

    Reason

    Populated attributes

    DatabaseError

    Something went wrong during querying database.

    collection, operation

Returns:

The newly edited message.

Return type:

Message

editing()[source]

Editing: Returns an asynchronous context manager that allows you to send an editing indicator for a message in channel for an indefinite period of time.

await fetch(*, http_overrides=None)[source]

This function is a coroutine.

Retrieves the message.

Parameters:

http_overrides (Optional[HTTPOverrideOptions]) – The HTTP request overrides.

Raises:
  • Unauthorized – Possible values for type:

    Value

    Reason

    InvalidSession

    The current bot/user token is invalid.

  • Forbidden – Possible values for type:

    Value

    Reason

    MissingPermission

    You do not have the proper permissions to view the channel.

  • NotFound – Possible values for type:

    Value

    Reason

    NotFound

    The channel/message was not found.

  • InternalServerError – Possible values for type:

    Value

    Reason

    Populated attributes

    DatabaseError

    Something went wrong during querying database.

    collection, operation

Returns:

The retrieved message.

Return type:

Message

get_channel()[source]

Optional[TextableChannel]: The channel this message was sent in.

get_server()[source]

Returns the server this message was sent in.

Returns:

The server and server ID (may be empty).

Return type:

Tuple[Optional[Server], str]

id

The ID of the entity.

Type:

str

await pin(*, http_overrides=None)[source]

This function is a coroutine.

Pins the message.

You must have manage_messages to do this, unless the channel is DMChannel.

Fires MessageUpdateEvent and MessageCreateEvent, both for all users who can see target channel.

Parameters:

http_overrides (Optional[HTTPOverrideOptions]) – The HTTP request overrides.

Raises:
  • HTTPException – Possible values for type:

    Value

    Reason

    AlreadyPinned

    The message was already pinned.

  • Unauthorized – Possible values for type:

    Value

    Reason

    InvalidSession

    The current bot/user token is invalid.

  • Forbidden – Possible values for type:

    Value

    Reason

    MissingPermission

    You do not have the proper permissions to pin the message.

  • NotFound – Possible values for type:

    Value

    Reason

    NotFound

    The channel/message was not found.

  • InternalServerError – Possible values for type:

    Value

    Reason

    Populated attributes

    DatabaseError

    Something went wrong during querying database.

    collection, operation

await react(emoji, *, http_overrides=None)[source]

This function is a coroutine.

React to this message.

You must have react to do this.

Fires MessageReactEvent for all users who can see target channel.

Parameters:
Raises:
  • HTTPException – Possible values for type:

    Value

    Reason

    InvalidOperation

    One of these:

  • Unauthorized – Possible values for type:

    Value

    Reason

    InvalidSession

    The current bot/user token is invalid.

  • Forbidden – Possible values for type:

    Value

    Reason

    MissingPermission

    You do not have the proper permissions to react.

  • NotFound – Possible values for type:

    Value

    Reason

    NotFound

    The channel/message/custom emoji was not found.

  • InternalServerError – Possible values for type:

    Value

    Reason

    Populated attributes

    DatabaseError

    Something went wrong during querying database.

    collection, operation

await reply(content=None, *, http_overrides=None, nonce=None, attachments=None, embeds=None, masquerade=None, interactions=None, silent=None, mention_everyone=None, mention_online=None, mention=True)[source]

This function is a coroutine.

Replies to this message.

You must have send_messages to do this.

If message mentions “@everyone” or “@online”, you must have mention_everyone to do that.

If message mentions any roles, you must mention_roles to do that.

Fires MessageCreateEvent and optionally MessageAppendEvent, both for all users who can see target channel.

Parameters:
  • content (Optional[str]) – The message content.

  • http_overrides (Optional[HTTPOverrideOptions]) – The HTTP request overrides.

  • nonce (Optional[str]) – The message nonce.

  • attachments (Optional[List[ResolvableResource]]) –

    The attachments to send the message with.

    You must have upload_files to provide this.

  • replies (Optional[List[Union[Reply, ULIDOr[BaseMessage]]]]) – The message replies.

  • embeds (Optional[List[SendableEmbed]]) –

    The embeds to send the message with.

    You must have send_embeds to provide this.

  • masquearde (Optional[MessageMasquerade]) –

    The message masquerade.

    You must have use_masquerade to provide this.

    If MessageMasquerade.color is provided, manage_roles is also required.

  • interactions (Optional[MessageInteractions]) –

    The message interactions.

    If MessageInteractions.reactions is provided, react is required.

  • silent (Optional[bool]) – Whether to suppress notifications or not.

  • mention_everyone (Optional[bool]) –

    Whether to mention all users who can see the channel. This cannot be mixed with mention_online parameter.

    Note

    User accounts cannot set this to True.

  • mention_online (Optional[bool]) –

    Whether to mention all users who are online and can see the channel. This cannot be mixed with mention_everyone parameter.

    Note

    User accounts cannot set this to True.

  • mention (bool) – Whether to mention author of message you’re replying to.

Raises:
  • HTTPException – Possible values for type:

    Value

    Reason

    EmptyMessage

    The message was empty.

    FailedValidation

    The payload was invalid.

    InvalidFlagValue

    Both mention_everyone and mention_online were True.

    InvalidOperation

    The passed nonce was already used. One of MessageInteractions.reactions elements was invalid.

    InvalidProperty

    MessageInteractions.restrict_reactions was True but MessageInteractions.reactions was empty.

    IsBot

    The current token belongs to bot account.

    IsNotBot

    The current token belongs to user account.

    PayloadTooLarge

    The message was too large.

    TooManyAttachments

    You provided more attachments than allowed on this instance.

    TooManyEmbeds

    You provided more embeds than allowed on this instance.

    TooManyReplies

    You were replying to more messages than was allowed on this instance.

  • Unauthorized – Possible values for type:

    Value

    Reason

    InvalidSession

    The current bot/user token is invalid.

  • Forbidden – Possible values for type:

    Value

    Reason

    MissingPermission

    You do not have the proper permissions to send messages.

  • NotFound – Possible values for type:

    Value

    Reason

    NotFound

    The channel/file/reply was not found.

  • InternalServerError – Possible values for type:

    Value

    Reason

    Populated attributes

    DatabaseError

    Something went wrong during querying database.

    collection, operation

    InternalError

    Somehow something went wrong during message creation.

Returns:

The message that was sent.

Return type:

Message

await report(reason, *, http_overrides=None, additional_context=None)[source]

This function is a coroutine.

Report the message to the instance moderation team.

Fires ReportCreateEvent internally (but not fired over WebSocket).

Internally, 15 messages around provided message will be snapshotted for context. All attachments of provided message are snapshotted as well.

Note

This can only be used by non-bot accounts.

Parameters:
  • reason (ContentReportReason) – The reason for reporting.

  • http_overrides (Optional[HTTPOverrideOptions]) – The HTTP request overrides.

  • additional_context (Optional[str]) – The additional context for moderation team. Can be only up to 1000 characters.

Raises:
  • HTTPException – Possible values for type:

    Value

    Reason

    CannotReportYourself

    You tried to report your own message.

    FailedValidation

    The payload was invalid.

  • Unauthorized – Possible values for type:

    Value

    Reason

    InvalidSession

    The current bot/user token is invalid.

  • NotFound – Possible values for type:

    Value

    Reason

    NotFound

    The message was not found.

  • InternalServerError – Possible values for type:

    Value

    Reason

    Populated attributes

    DatabaseError

    Something went wrong during querying database.

    collection, operation

property server[source]

The server this message was sent in.

Type:

Optional[Server]

state

The state that controls this entity.

Type:

State

await unpin(*, http_overrides=None)[source]

This function is a coroutine.

Unpins the message.

You must have manage_messages to do this, unless the channel is DMChannel.

Fires MessageUpdateEvent and MessageCreateEvent, both for all users who can see target channel.

Parameters:

http_overrides (Optional[HTTPOverrideOptions]) – The HTTP request overrides.

Raises:
  • HTTPException – Possible values for type:

    Value

    Reason

    NotPinned

    The message was not pinned.

  • Unauthorized – Possible values for type:

    Value

    Reason

    InvalidSession

    The current bot/user token is invalid.

  • Forbidden – Possible values for type:

    Value

    Reason

    MissingPermission

    You do not have the proper permissions to unpin the message.

  • NotFound – Possible values for type:

    Value

    Reason

    NotFound

    The channel/message was not found.

  • InternalServerError – Possible values for type:

    Value

    Reason

    Populated attributes

    DatabaseError

    Something went wrong during querying database.

    collection, operation

await unreact(emoji, *, http_overrides=None, user=None, remove_all=None)[source]

This function is a coroutine.

Remove your own, someone else’s or all of a given reaction.

You must have react to do this.

Fires MessageClearReactionEvent if remove_all is True or MessageUnreactEvent, for all users who can see target channel.

Parameters:
Raises:
  • Unauthorized – Possible values for type:

    Value

    Reason

    InvalidSession

    The current bot/user token is invalid.

  • Forbidden – Possible values for type:

    Value

    Reason

    MissingPermission

    You do not have the proper permissions to remove reaction.

  • NotFound – Possible values for type:

    Value

    Reason

    NotFound

    One of these:

    • The channel was not found.

    • The message was not found.

    • The user provided did not react.

  • InternalServerError – Possible values for type:

    Value

    Reason

    Populated attributes

    DatabaseError

    Something went wrong during querying database.

    collection, operation

nonce

The unique value generated by client sending this message.

Type:

Optional[str]

channel_id

The channel’s ID this message was sent in.

Type:

str

internal_author

The ID of the user (or webhook) that sent this message, or full member/user instance.

Type:

Union[Member, User, str]

webhook

The webhook that sent this message.

Type:

Optional[MessageWebhook]

content

The message’s content.

Type:

str

internal_system_event

The stateless system event information, occured in this message, if any.

Type:

Optional[StatelessSystemEvent]

internal_attachments

The stateless attachments on this message.

Type:

List[StatelessAsset]

edited_at

Timestamp at which this message was last edited.

Type:

Optional[datetime]

internal_embeds

The attached stateless embeds to this message.

Type:

List[StatelessEmbed]

mention_ids

The user’s IDs mentioned in this message.

Type:

List[str]

role_mention_ids

The role’s IDs mentioned in this message.

Type:

List[str]

replies

The message’s IDs this message is replying to.

Type:

List[str]

reactions

The mapping of emojis to list of user IDs.

Type:

Dict[str, Tuple[str, …]]

interactions

The information about how this message should be interacted with.

Type:

Optional[MessageInteractions]

masquerade

The name and / or avatar overrides for this message.

Type:

Optional[MessageMasquerade]

pinned

Whether the message is pinned.

Type:

bool

raw_flags

The message’s flags raw value.

Type:

int

locally_update(data, /)[source]

Locally updates message with provided data.

Warning

This is called by library internally to keep cache up to date.

Parameters:

data (PartialMessage) – The data to update message with.

get_author()[source]

Optional[Union[Member, User]]: The user that sent this message.

get_author_as_member()[source]

Optional[Member]: The user that sent this message.

get_author_as_user()[source]

Optional[User]: The user that sent this message.

property attachments[source]

The attachments on this message.

Type:

List[Asset]

property author[source]

The user that sent this message.

Type:

Union[Member, User]

property author_as_member[source]

The user that sent this message.

Type:

Member

property author_as_user[source]

The user that sent this message.

Type:

User

property author_id[source]

The user’s ID or webhook that sent this message.

Type:

str

property embeds[source]

The attached embeds to this message.

Type:

List[Embed]

property flags[source]

The message’s flags.

Type:

MessageFlags

property mentions[source]

The message’s user mentions.

Type:

List[Union[Member, User]]

property mentions_as_members[source]

The message’s user mentions as members.

Type:

List[Member]

property mentions_as_users[source]

The message’s user mentions.

Type:

List[User]

property role_mentions[source]

The message’s role mentions.

Type:

List[Role]

property system_content[source]

The displayed message’s content.

Type:

str

property system_event[source]

The system event information, occured in this message, if any.

Type:

Optional[SystemEvent]

is_silent()[source]

bool: Whether the message suppresses push notifications.

to_dict()[source]

dict: Convert message to raw data.

Reply

Methods
class stoat.Reply(id, mention=False, *, fail_if_not_exists=None)[source]

Represents a message reply.

id

The ID of the message that being replied to.

Type:

str

mention

Whether to mention author of referenced message or not.

Type:

bool

fail_if_not_exists

Whether the HTTP request should fail with an error, if message does not exist. Defaults to True.

Type:

Optional[bool]

to_dict()[source]

dict: Convert reply to raw data.

MessageMasquerade

Attributes
Methods
class stoat.MessageMasquerade(name=None, avatar=None, *, color=None)[source]

Represents overrides of name and/or avatar on message.

name

The name to replace the display name on message with. Must be between 1 and 32 characters long.

Type:

Optional[str]

avatar

The image URL to replace the displayed avatar on message with.

Type:

Optional[str]

color

The CSS color to replace display role color shown on message. This must be valid CSS color.

You (or webhook) must have manage_roles permission to set this attribute.

Type:

Optional[str]

to_dict()[source]

dict: Convert masquerade to raw data.

MessageInteractions

Methods
class stoat.MessageInteractions(reactions, restrict_reactions=False)[source]

Represents information how to guide interactions on the message.

reactions

The reactions which should always appear and be distinct. Must be either emoji ID, or an unicode emoji.

Type:

List[str]

restrict_reactions

Whether reactions should be restricted to the given list.

Can only be set to True if reactions has at least 1 emoji. Defaults to False.

Type:

bool

to_dict()[source]

dict: Convert interactions information to raw data.

MessageWebhook

Attributes
Methods
class stoat.MessageWebhook(*, name, avatar)[source]

Specifies information about the webhook bundled with Message.

name

The webhook’s name. Can be between 1 to 32 characters.

Type:

str

avatar

The webhook avatar’s ID, if any.

Type:

Optional[str]

to_dict()[source]

dict: Convert message webhook to raw data.