Events

The following section documents everything related to events.

Models

Events

BaseEvent

Attributes
Methods
class stoat.BaseEvent(*, is_canceled=False)[source]

Base class for all events.

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

before_dispatch()[source]

Called before handlers are invoked.

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

ShardEvent

Attributes
Methods
class stoat.ShardEvent(*, is_canceled=False, shard)[source]

Base class for events arrived over WebSocket.

This inherits from BaseEvent.

shard

The shard the event arrived on.

Type:

Shard

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

before_dispatch()[source]

Called before handlers are invoked.

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

class stoat.ReadyEvent(*, is_canceled=False, shard, users, servers, channels, members, emojis, me, user_settings, read_states, voice_states, policy_changes)[source]

Dispatched when initial state is available.

This inherits from ShardEvent.

Warning

This event may be dispatched multiple times due to periodic reconnects.

Consider subclassing Client and overriding setup_hook() if you wish to prepare before starting up.

users

The users that the client can see (from DMs, groups, and relationships).

This attribute contains connected user, usually at end of list, but sometimes not at end.

Type:

List[User]

servers

The servers the connected user is in.

Type:

List[Server]

channels

The DM channels, server channels and groups the connected user participates in.

Type:

List[Channel]

members

The own members for servers.

Type:

List[Member]

emojis

The emojis from servers the user participating in.

Type:

List[ServerEmoji]

me

The connected user.

Type:

OwnUser

user_settings

The settings for connected user.

Note

This attribute is unavailable on bot accounts.

Type:

UserSettings

read_states

The read states for channels ever seen by user. This is not always populated, and unavailable for bots.

Note

This attribute is unavailable on bot accounts.

Type:

List[ReadState]

voice_states

The voice states of the text/voice channels.

Type:

List[ChannelVoiceStateContainer]

policy_changes

The pending policy changes that the user didn’t acknowledge yet.

Added in version 1.2.

Note

This attribute is unavailable on bot accounts.

Type:

List[PolicyChange]

cache_context

The cache context used.

Type:

Union[UndefinedCacheContext, ReadyEventCacheContext]

before_dispatch()[source]

Called before handlers are invoked.

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

BaseChannelCreateEvent

Attributes
Methods
class stoat.BaseChannelCreateEvent(*, is_canceled=False, shard)[source]

Base class for events when a channel is created.

This inherits from ShardEvent.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

before_dispatch()[source]

Called before handlers are invoked.

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

PrivateChannelCreateEvent

class stoat.PrivateChannelCreateEvent(*, is_canceled=False, shard, channel)[source]

Bases: BaseChannelCreateEvent

Dispatched when the user created a DM, or started participating in group.

This inherits from BaseChannelCreateEvent.

channel

The joined DM or group channel.

Type:

PrivateChannel

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

before_dispatch()[source]

Called before handlers are invoked.

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

ServerChannelCreateEvent

class stoat.ServerChannelCreateEvent(*, is_canceled=False, shard, channel)[source]

Bases: BaseChannelCreateEvent

Dispatched when the channel is created in server or became accessible to the connected user.

This inherits from BaseChannelCreateEvent.

channel

The created server channel.

Type:

ServerChannel

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

before_dispatch()[source]

Called before handlers are invoked.

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

ChannelCreateEvent

class stoat.ChannelCreateEvent

An union of private/server channel create events.

The following classes are included in this union:

ChannelUpdateEvent

class stoat.ChannelUpdateEvent(*, is_canceled=False, shard, channel, before, after)[source]

Dispatched when the channel is updated.

This inherits from ShardEvent.

channel

The fields that were updated.

Type:

PartialChannel

before

The channel as it was before being updated, if available.

Type:

Optional[Channel]

after

The channel as it was updated, if available.

Type:

Optional[Channel]

cache_context

The cache context used.

Type:

Union[UndefinedCacheContextType, ChannelUpdateEventCacheContext]

before_dispatch()[source]

Called before handlers are invoked.

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

ChannelDeleteEvent

class stoat.ChannelDeleteEvent(*, is_canceled=False, shard, channel_id, channel)[source]

Dispatched when the server channel or group is deleted or became inaccessible for the connected user.

This inherits from ShardEvent.

channel_id

The channel’s ID that got deleted or inaccessible.

Type:

str

channel

The deleted channel object, if available.

Type:

Optional[Channel]

cache_context

The cache context used.

Type:

Union[UndefinedCacheContext, ChannelDeleteEventCacheContext]

before_dispatch()[source]

Called before handlers are invoked.

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

GroupRecipientAddEvent

class stoat.GroupRecipientAddEvent(*, is_canceled=False, shard, channel_id, user_id, group)[source]

Dispatched when recipient is added to the group.

This inherits from ShardEvent.

channel_id

The affected group’s ID.

Type:

str

user_id

The user’s ID who was added to the group.

Type:

str

group

The group in cache (in previous state as it had no recipient), if available.

Type:

Optional[GroupChannel]

cache_context

The cache context used.

Type:

Union[UndefinedCacheContext, GroupRecipientAddEventCacheContext]

before_dispatch()[source]

Called before handlers are invoked.

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

GroupRecipientRemoveEvent

class stoat.GroupRecipientRemoveEvent(*, is_canceled=False, shard, channel_id, user_id, group)[source]

Dispatched when recipient is removed from the group.

This inherits from ShardEvent.

channel_id

The affected group’s ID.

Type:

str

user_id

The user’s ID who was removed from the group.

Type:

str

group

The group in cache (in previous state as it had recipient), if available.

Type:

Optional[GroupChannel]

cache_context

The cache context used.

Type:

Union[UndefinedCacheContext, GroupRecipientRemoveEventCacheContext]

before_dispatch()[source]

Called before handlers are invoked.

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

ChannelStartTypingEvent

class stoat.ChannelStartTypingEvent(*, is_canceled=False, shard, channel_id, user_id)[source]

Dispatched when someone starts typing in a channel.

This inherits from ShardEvent.

channel_id

The channel’s ID where user started typing in.

Type:

str

user_id

The user’s ID who started typing.

Type:

str

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

before_dispatch()[source]

Called before handlers are invoked.

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

ChannelStopTypingEvent

class stoat.ChannelStopTypingEvent(*, is_canceled=False, shard, channel_id, user_id)[source]

Dispatched when someone stopped typing in a channel.

This inherits from ShardEvent.

channel_id

The channel’s ID where user stopped typing in.

Type:

str

user_id

The user’s ID who stopped typing.

Type:

str

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

before_dispatch()[source]

Called before handlers are invoked.

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

MessageStartEditingEvent

class stoat.MessageStartEditingEvent(*, is_canceled=False, shard, channel_id, message_id, user_id)[source]

Dispatched when someone starts editing a message.

This inherits from ShardEvent.

channel_id

The channel’s ID where user started editing message in.

Type:

str

message_id

The message’s ID that started to be edited.

Type:

str

user_id

The user’s ID who started editing.

Type:

str

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

before_dispatch()[source]

Called before handlers are invoked.

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

MessageStopEditingEvent

class stoat.MessageStopEditingEvent(*, is_canceled=False, shard, channel_id, message_id, user_id)[source]

Dispatched when someone stops editing a message.

This inherits from ShardEvent.

channel_id

The channel’s ID where user stopped editing message in.

Type:

str

message_id

The message’s ID that stopped to be edited.

Type:

str

user_id

The user’s ID who stopped editing.

Type:

str

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

before_dispatch()[source]

Called before handlers are invoked.

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

MessageAckEvent

class stoat.MessageAckEvent(*, is_canceled=False, shard, channel_id, message_id, user_id)[source]

Dispatched when the connected user acknowledges the message in a channel (usually from remote device).

This inherits from ShardEvent.

channel_id

The channel’s ID the message is in.

Type:

str

message_id

The message’s ID that got acknowledged.

Type:

str

user_id

The connected user’s ID.

Type:

str

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

before_dispatch()[source]

Called before handlers are invoked.

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

MessageCreateEvent

class stoat.MessageCreateEvent(*, is_canceled=False, shard, message)[source]

Dispatched when someone sends message in a channel.

This inherits from ShardEvent.

message

The message that was sent.

Type:

Message

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

before_dispatch()[source]

Called before handlers are invoked.

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

MessageUpdateEvent

class stoat.MessageUpdateEvent(*, is_canceled=False, shard, message, before, after)[source]

Dispatched when the message is updated.

This inherits from ShardEvent.

message

The fields that were updated.

Type:

PartialMessage

before

The message as it was before being updated, if available.

Type:

Optional[Message]

after

The message as it was updated, if available.

Type:

Optional[Message]

cache_context

The cache context used.

Type:

Union[UndefinedCacheContext, MessageUpdateEventCacheContext]

before_dispatch()[source]

Called before handlers are invoked.

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

MessageAppendEvent

class stoat.MessageAppendEvent(*, is_canceled=False, shard, data, message)[source]

Dispatched when embeds are appended to the message.

This inherits from ShardEvent.

data

The data that got appended to message.

Type:

MessageAppendData

message

The message as it was before being updated, if available.

Type:

Optional[Message]

cache_context

The cache context used.

Type:

Union[UndefinedCacheContext, MessageAppendEventCacheContext]

before_dispatch()[source]

Called before handlers are invoked.

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

MessageDeleteEvent

class stoat.MessageDeleteEvent(*, is_canceled=False, shard, channel_id, message_id, message)[source]

Dispatched when the message is deleted in channel.

This inherits from ShardEvent.

channel_id

The channel’s ID the message was in.

Type:

str

message_id

The deleted message’s ID.

Type:

str

message

The deleted message object, if available.

Type:

Optional[Message]

cache_context

The cache context used.

Type:

Union[UndefinedCacheContext, MessageDeleteEventCacheContext]

before_dispatch()[source]

Called before handlers are invoked.

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

MessageReactEvent

class stoat.MessageReactEvent(cache_context=NOTHING, *, is_canceled=False, shard, channel_id, message_id, user_id, emoji, message)[source]

Dispatched when someone reacts to message.

This inherits from ShardEvent.

channel_id

The channel’s ID the message is in.

Type:

str

message_id

The message’s ID that got a reaction.

Type:

str

user_id

The user’s ID that added a reaction to the message.

Type:

str

emoji

The emoji that was reacted with. May be either ULID or Unicode emoji.

Type:

str

message

The message as it was before being updated, if available.

Type:

Optional[Message]

cache_context

The cache context used.

Type:

Union[UndefinedCacheContext, MessageReactEventCacheContext]

before_dispatch()[source]

Called before handlers are invoked.

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

MessageUnreactEvent

class stoat.MessageUnreactEvent(*, is_canceled=False, shard, channel_id, message_id, user_id, emoji, message)[source]

Dispatched when someone removes their reaction from message.

This inherits from ShardEvent.

channel_id

The channel’s ID the message is in.

Type:

str

message_id

The message’s ID that lost a reaction.

Type:

str

user_id

The user’s ID that removed reaction from the message.

Type:

str

emoji

The emoji that was reacted with before. May be either ULID or Unicode emoji.

Type:

str

message

The message as it was before being updated, if available.

Type:

Optional[Message]

cache_context

The cache context used.

Type:

Union[UndefinedCacheContext, MessageUnreactEventCacheContext]

before_dispatch()[source]

Called before handlers are invoked.

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

MessageClearReactionEvent

class stoat.MessageClearReactionEvent(*, is_canceled=False, shard, channel_id, message_id, emoji, message)[source]

Dispatched when reactions for specific emoji are removed from message.

This inherits from ShardEvent.

channel_id

The channel’s ID the message is in.

Type:

str

message_id

The message’s ID that lost reactions.

Type:

str

emoji

The emoji whose reactions were removed. May be either ULID or Unicode emoji.

Type:

str

message

The message as it was before being updated, if available.

Type:

Optional[Message]

cache_context

The cache context used.

Type:

Union[UndefinedCacheContext, MessageClearReactionEventCacheContext]

before_dispatch()[source]

Called before handlers are invoked.

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

MessageDeleteBulkEvent

class stoat.MessageDeleteBulkEvent(*, is_canceled=False, shard, channel_id, message_ids, messages)[source]

Dispatched when multiple messages are deleted from channel.

This inherits from ShardEvent.

channel_id

The channel’s ID where messages got deleted from.

Type:

str

message_ids

The list of message’s IDs that got deleted.

Type:

List[str]

messages

The list of deleted messages, potentially retrieved from cache.

Unlike message_ids, some messages are not guaranteed to be here.

Type:

List[Message]

cache_context

The cache context used.

Type:

Union[UndefinedCacheContext, MessageDeleteBulkEventCacheContext]

before_dispatch()[source]

Called before handlers are invoked.

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

ServerCreateEvent

class stoat.ServerCreateEvent(*, is_canceled=False, shard, joined_at, server, emojis, voice_states)[source]

Dispatched when the server is created, or client joined server.

This inherits from ShardEvent.

joined_at

When the client got added to server, generated locally, and used internally.

Type:

datetime

server

The server that client was added to.

Type:

Server

emojis

The server emojis.

Type:

List[ServerEmoji]

voice_states

The voice states of the text/voice channels in the server.

Type:

List[ChannelVoiceStateContainer]

cache_context

The cache context used.

Type:

Union[UndefinedCacheContext, ServerCreateEventCacheContext]

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

before_dispatch()[source]

Called before handlers are invoked.

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

ServerEmojiCreateEvent

Attributes
Methods
class stoat.ServerEmojiCreateEvent(*, is_canceled=False, shard, emoji)[source]

Dispatched when emoji is created in server.

This inherits from ShardEvent.

emoji

The created emoji.

Type:

ServerEmoji

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

before_dispatch()[source]

Called before handlers are invoked.

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

ServerEmojiDeleteEvent

class stoat.ServerEmojiDeleteEvent(*, is_canceled=False, shard, server_id, emoji_id, emoji)[source]

Dispatched when emoji is deleted from the server.

This inherits from ShardEvent.

server_id

The server’s ID where emoji got deleted from.

Type:

str

emoji_id

The deleted emoji’s ID.

Type:

str

emoji

The deleted emoji object, if available.

Type:

Optional[ServerEmoji]

cache_context

The cache context used.

Type:

Union[UndefinedCacheContext, ServerEmojiDeleteEventCacheContext]

before_dispatch()[source]

Called before handlers are invoked.

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

ServerUpdateEvent

class stoat.ServerUpdateEvent(*, is_canceled=False, shard, server, before, after)[source]

Dispatched when the server details are updated.

This inherits from ShardEvent.

server

The fields that were updated.

Type:

PartialServer

before

The server as it was before being updated, if available.

Type:

Optional[Server]

after

The server as it was updated, if available.

Type:

Optional[Server]

cache_context

The cache context used.

Type:

Union[UndefinedCacheContext, ServerUpdateEventCacheContext]

before_dispatch()[source]

Called before handlers are invoked.

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

ServerDeleteEvent

class stoat.ServerDeleteEvent(*, is_canceled=False, shard, server_id, server)[source]

Dispatched when the server is deleted.

This inherits from ShardEvent.

server_id

The deleted server’s ID.

Type:

str

server

The deleted server object, if available.

Type:

Optional[Server]

cache_context

The cache context used.

Type:

Union[UndefinedCacheContext, ServerDeleteEventCacheContext]

before_dispatch()[source]

Called before handlers are invoked.

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

ServerMemberJoinEvent

class stoat.ServerMemberJoinEvent(*, is_canceled=False, shard, member)[source]

Dispatched when the user got added to the server.

This inherits from ShardEvent.

member

The joined member.

Type:

Member

cache_context

The cache context used.

Type:

Union[UndefinedCacheContext, ServerMemberJoinEventCacheContext]

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

before_dispatch()[source]

Called before handlers are invoked.

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

ServerMemberUpdateEvent

class stoat.ServerMemberUpdateEvent(*, is_canceled=False, shard, member, before, after)[source]

Dispatched when the member details are updated.

This inherits from ShardEvent.

member

The fields that were updated.

Type:

PartialMember

before

The member as it was before being updated, if available.

Type:

Optional[Member]

after

The member as it was updated, if available.

Type:

Optional[Member]

cache_context

The cache context used.

Type:

Union[UndefinedCacheContext, ServerMemberUpdateEventCacheContext]

before_dispatch()[source]

Called before handlers are invoked.

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

ServerMemberRemoveEvent

class stoat.ServerMemberRemoveEvent(*, is_canceled=False, shard, server_id, user_id, member, reason)[source]

Dispatched when the member (or client user) got removed from server.

This inherits from ShardEvent.

server_id

The server’s ID from which the user was removed from.

Type:

str

user_id

The removed user’s ID.

Type:

str

member

The removed member object, if available.

Type:

Optional[Member]

reason

The reason why member was removed.

Type:

MemberRemovalIntention

cache_context

The cache context used.

Type:

Union[UndefinedCacheContext, ServerMemberRemoveEventCacheContext]

before_dispatch()[source]

Called before handlers are invoked.

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

RawServerRoleUpdateEvent

class stoat.RawServerRoleUpdateEvent(*, is_canceled=False, shard, role, old_role, new_role, server)[source]

Dispatched when the role got created or updated in server.

This inherits from ShardEvent.

role

The fields that got updated.

Type:

PartialRole

old_role

The role as it was before being updated, if available.

Type:

Optional[Role]

new_role

The role as it was created or updated, if available.

Type:

Optional[Role]

server

The server the role got created or updated in.

Type:

Optional[Server]

cache_context

The cache context used.

Type:

Union[UndefinedCacheContext, RawServerRoleUpdateEventCacheContext]

before_dispatch()[source]

Called before handlers are invoked.

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

ServerRoleDeleteEvent

class stoat.ServerRoleDeleteEvent(*, is_canceled=False, shard, server_id, role_id, server, role)[source]

Dispatched when the role got deleted from server.

This inherits from ShardEvent.

server_id

The server’s ID the role was in.

Type:

str

role_id

The deleted role’s ID.

Type:

str

server

The server the role was deleted from, if available.

Type:

Optional[Server]

role

The deleted role object, if available.

Type:

Optional[Role]

cache_context

The cache context used.

Type:

Union[UndefinedCacheContext, ServerRoleDeleteEventCacheContext]

before_dispatch()[source]

Called before handlers are invoked.

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

ServerRoleRanksUpdateEvent

class stoat.ServerRoleRanksUpdateEvent(*, is_canceled=False, shard, server_id, role_ids, server)[source]

Dispatched when the server role ranks are updated.

This inherits from ShardEvent.

Added in version 1.2.

server_id

The server’s ID role ranks were updated in.

Type:

str

role_ids

The role’s IDs.

See ranks parameter on HTTPClient.bulk_edit_role_ranks() for details.

Type:

List[str]

server

The server role ranks were updated in, if available.

Type:

Optional[Server]

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

cache_context

The cache context used.

Type:

Union[UndefinedCacheContext, ServerRoleRanksUpdateEventCacheContext]

before_dispatch()[source]

Called before handlers are invoked.

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

ReportCreateEvent

class stoat.ReportCreateEvent(*, is_canceled=False, shard, report)[source]

Dispatched when the report was created.

This inherits from BaseEvent.

Warning

This event is not dispatched over WebSocket.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

before_dispatch()[source]

Called before handlers are invoked.

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

shard

The shard the event arrived on.

Type:

Optional[Shard]

report

The created report.

Type:

CreatedReport

UserUpdateEvent

class stoat.UserUpdateEvent(*, is_canceled=False, shard, user, before, after)[source]

Dispatched when the user details are updated.

This inherits from ShardEvent.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

user

The fields that were updated.

Type:

PartialUser

before

The user as it was before being updated, if available.

Type:

User

after

The user as it was updated, if available.

Type:

User

cache_context

The cache context used.

Type:

Union[UndefinedCacheContext, UserUpdateEventCacheContext]

before_dispatch()[source]

Called before handlers are invoked.

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

UserRelationshipUpdateEvent

class stoat.UserRelationshipUpdateEvent(*, is_canceled=False, shard, current_user_id, old_user, new_user, before)[source]

Dispatched when the relationship with user was updated.

This inherits from ShardEvent.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

current_user_id

The current user ID.

Type:

str

old_user

The user as it was before being updated, if available.

Type:

Optional[User]

new_user

The user as it was updated.

Type:

User

before

The old relationship found in cache.

Type:

Optional[RelationshipStatus]

cache_context

The cache context used.

Type:

Union[UndefinedCacheContext, UserRelationshipUpdateEventCacheContext]

property after[source]

The new relationship with the user.

Type:

RelationshipStatus

before_dispatch()[source]

Called before handlers are invoked.

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

UserSettingsUpdateEvent

class stoat.UserSettingsUpdateEvent(*, is_canceled=False, shard, current_user_id, partial, before, after)[source]

Dispatched when the user settings are changed, likely from remote device.

This inherits from ShardEvent.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

before_dispatch()[source]

Called before handlers are invoked.

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

current_user_id

The current user ID.

partial

The fields that were updated.

Type:

UserSettings

before

The settings as they were before being updated.

Note

This is populated properly only if user settings are available.

Type:

UserSettings

after

The settings as they were updated.

Type:

UserSettings

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

UserPlatformWipeEvent

class stoat.UserPlatformWipeEvent(*, is_canceled=False, shard, user_id, raw_flags, before, after)[source]

Dispatched when the user has been platform banned or deleted their account.

Clients should remove the following associated data: - DM Channels - Messages - Relationships - Server Memberships

User flags are specified to explain why a wipe is occurring though not all reasons will necessarily ever appear.

This inherits from ShardEvent.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

user_id

The wiped user’s ID.

Type:

str

raw_flags

The user’s flags raw value, explaining reason of the wipe.

Type:

int

before

The user as it would exist before, if available.

Type:

Optional[User]

after

The wiped user, if available.

Type:

Optional[User]

cache_context

The cache context used.

Type:

Union[UndefinedCacheContext, UserPlatformWipeEventCacheContext]

property flags[source]

The user’s flags, explaining reason of the wipe.

Type:

UserFlags

before_dispatch()[source]

Called before handlers are invoked.

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

WebhookCreateEvent

class stoat.WebhookCreateEvent(*, is_canceled=False, shard, webhook)[source]

Dispatched when the webhook is created in a channel.

This inherits from ShardEvent.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

before_dispatch()[source]

Called before handlers are invoked.

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

webhook

The created webhook.

Type:

Webhook

WebhookUpdateEvent

class stoat.WebhookUpdateEvent(*, is_canceled=False, shard, webhook)[source]

Dispatched when the webhook details are updated.

This inherits from ShardEvent.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

before_dispatch()[source]

Called before handlers are invoked.

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

webhook

The fields that were updated.

Type:

PartialWebhook

WebhookDeleteEvent

class stoat.WebhookDeleteEvent(*, is_canceled=False, shard, webhook_id, webhook)[source]

Dispatched when the webhook is deleted.

This inherits from ShardEvent.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

before_dispatch()[source]

Called before handlers are invoked.

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

webhook_id

The deleted webhook’s ID.

Type:

str

webhook

The deleted webhook object, if available.

Type:

Optional[Webhook]

AuthifierEvent

Attributes
Methods
class stoat.AuthifierEvent(*, is_canceled=False, shard)[source]

Dispatched when Authifier-related event happens.

This inherits from ShardEvent.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

before_dispatch()[source]

Called before handlers are invoked.

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

SessionCreateEvent

class stoat.SessionCreateEvent(*, is_canceled=False, shard, session)[source]

Bases: AuthifierEvent

Dispatched when new session is created.

This inherits from ShardEvent.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

before_dispatch()[source]

Called before handlers are invoked.

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

session

The created session.

Type:

Session

SessionDeleteEvent

class stoat.SessionDeleteEvent(*, is_canceled=False, shard, current_user_id, session_id)[source]

Bases: AuthifierEvent

Dispatched when session is deleted.

This inherits from ShardEvent.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

before_dispatch()[source]

Called before handlers are invoked.

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

current_user_id

The connected user’s ID.

Type:

str

session_id

The deleted session’s ID.

Type:

str

SessionDeleteAllEvent

class stoat.SessionDeleteAllEvent(*, is_canceled=False, shard, current_user_id, exclude_session_id)[source]

Bases: AuthifierEvent

Dispatched when all sessions are deleted (and optionally except one).

This inherits from ShardEvent.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

before_dispatch()[source]

Called before handlers are invoked.

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

current_user_id

The connected user’s ID.

Type:

str

exclude_session_id

The session’s ID that is excluded from deletion, if any.

Type:

Optional[str]

LogoutEvent

Attributes
Methods
class stoat.LogoutEvent(*, is_canceled=False, shard)[source]

Dispatched when the connected user got logged out.

This inherits from ShardEvent.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

before_dispatch()[source]

Called before handlers are invoked.

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

VoiceChannelJoinEvent

class stoat.VoiceChannelJoinEvent(*, is_canceled=False, shard, channel_id, state)[source]

Dispatched when an user joins a voice channel.

This inherits from ShardEvent.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

before_dispatch()[source]

Called before handlers are invoked.

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

channel_id

The channel’s ID the user joined to.

Type:

str

state

The user’s voice state.

Type:

UserVoiceState

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

VoiceChannelLeaveEvent

class stoat.VoiceChannelLeaveEvent(*, is_canceled=False, shard, channel_id, user_id, container, state)[source]

Dispatched when an user left voice channel.

This inherits from ShardEvent.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

channel_id

The channel’s ID the user left from.

Type:

str

user_id

The user’s ID that left the voice channel.

Type:

str

container

The channel’s voice state container.

Type:

Optional[ChannelVoiceStateContainer]

state

The user’s voice state.

Type:

Optional[UserVoiceState]

cache_context

The cache context used.

Type:

Union[UndefinedCacheContext, VoiceChannelLeaveEventCacheContext]

before_dispatch()[source]

Called before handlers are invoked.

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

VoiceChannelMoveEvent

class stoat.VoiceChannelMoveEvent(*, is_canceled=False, shard, user_id, from_, to, old_container, new_container, state)[source]

Dispatched when an user is moved from voice channel to another voice channel.

This inherits from ShardEvent.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

user_id

The user’s ID who was moved between two voice channels.

Type:

str

from_

The channel’s ID the user was in.

Type:

str

to

The channel’s ID the user is in now.

Type:

str

old_container

The voice state container for the previous voice channel the user was in.

Type:

Optional[ChannelVoiceStateContainer]

new_container

The voice state container for the voice channel the user is in.

Type:

Optional[ChannelVoiceStateContainer]

state

The user’s voice state.

Type:

UserVoiceState

cache_context

The cache context used.

Type:

Union[UndefinedCacheContext, VoiceChannelMoveEventCacheContext]

before_dispatch()[source]

Called before handlers are invoked.

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

UserVoiceStateUpdateEvent

class stoat.UserVoiceStateUpdateEvent(*, is_canceled=False, shard, channel_id, container, state, before, after)[source]

Dispatched when an user’s voice state is updated.

This inherits from ShardEvent.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

channel_id

The channel’s ID the user’s voice state is in.

Type:

str

container

The channel’s voice state container.

Type:

Optional[ChannelVoiceStateContainer]

state

The fields that were updated.

Type:

PartialUserVoiceState

before

The user’s voice state as it was before being updated, if available.

Type:

Optional[UserVoiceState]

after

The user’s voice state as it was updated, if available.

Type:

Optional[UserVoiceState]

cache_context

The cache context used.

Type:

Union[UndefinedCacheContext, UserVoiceStateUpdateEventCacheContext]

before_dispatch()[source]

Called before handlers are invoked.

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

UserMoveVoiceChannelEvent

class stoat.UserMoveVoiceChannelEvent(*, is_canceled=False, shard, node, from_id, to_id, token)[source]

Dispatched when the current user was moved between voice channels and might have potentially reconnect to another node.

This inherits from ShardEvent.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

before_dispatch()[source]

Called before handlers are invoked.

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

node

The node’s name to connect to.

from_id

The channel’s ID the user’s voice state was in.

Type:

str

to_id

The channel’s ID the user’s voice state is in.

Type:

str

token

The token for this node.

cache_context

The cache context used.

Type:

Union[UndefinedCacheContext, UserVoiceStateUpdateEventCacheContext]

AuthenticatedEvent

Attributes
Methods
class stoat.AuthenticatedEvent(*, is_canceled=False, shard)[source]

Dispatched when the WebSocket was successfully authenticated.

This inherits from ShardEvent.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

before_dispatch()[source]

Called before handlers are invoked.

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

BeforeConnectEvent

Attributes
Methods
class stoat.BeforeConnectEvent(*, is_canceled=False, shard)[source]

Dispatched before connection to Stoat WebSocket is made.

This inherits from ShardEvent.

Warning

Similarly to ReadyEvent, this event may be dispatched multiple times.

Consider subclassing Client and overriding setup_hook() if you wish to prepare before starting up.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

before_dispatch()[source]

Called before handlers are invoked.

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

AfterConnectEvent

class stoat.AfterConnectEvent(*, is_canceled=False, shard, socket)[source]

Dispatched after connection to Stoat WebSocket is made.

This inherits from ShardEvent.

Warning

Similarly to ReadyEvent, this event may be dispatched multiple times.

Consider subclassing Client and overriding setup_hook() if you wish to prepare before starting up.

await abefore_dispatch()[source]

This function is a coroutine.

Asynchronous version of before_dispatch().

await aprocess()[source]

This function is a coroutine.

Asynchronous version of process().

before_dispatch()[source]

Called before handlers are invoked.

cancel()[source]

Cancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

is_canceled

Whether the event is canceled.

Type:

bool

process()[source]

Any: Called when handlers got invoked and temporary subscriptions were handled and removed.

set_canceled(value, /)[source]

Whether to cancel event processing (updating cache) or not.

shard

The shard the event arrived on.

Type:

Shard

uncancel()[source]

Uncancels the event processing (updating cache).

Returns:

Whether the event was not canceled before.

Return type:

bool

socket

The connected WebSocket.

Type:

HTTPWebSocket