âš¡Server Events#
🚀 Events are designed for handling server-related tasks, with a total of 8 events created specifically for this purpose. These events are dispatched to decorators that are subscribed to them.
Note
You are sought to not change or create a custom event, since it still needs to be tested. Without testing, the execution of a custom event might cause problems that server implementations may not be able to deal it causing the server to eventually die.
🚀 Events#
Module for events that get triggered in the Mail.tm server.
This module contains a set of classes representing different events that get triggered
in the Mail.tm
server. These events can be used to create callbacks for when certain
actions happen in the server.
NewMessage
: Triggered when a new message is received.MessageDelete
: Triggered when a message is deleted using the server instance.DomainChange
: Triggered when the email domain is changed.AccountSwitched
: Triggered when the account is switched to a different account.NewAccountCreated
: Triggered when a new account is created.AccountDeleted
: Triggered when an account is deleted.ServerStarted
: Triggered when the server is started.ServerCalledOff
: Triggered when the server is ended.
BaseEvent
#
BaseEvent(
event: str, client: AsyncMail, _server: AttachServer
)
Represents a set of Discord UI components attached to a message.
PARAMETER | DESCRIPTION |
---|---|
event |
A string attached to the BaseEvent that represents the event.
TYPE:
|
client |
An instance AsyncMail that represents the client. You can use this to operate the interactions with the AsyncClient
TYPE:
|
_server |
This is not supposed to be used by the user. This attaches a server instance to dispatch events within from events.
TYPE:
|
client
property
#
client: AsyncMail
Client attached to the server context.
RETURNS | DESCRIPTION |
---|---|
AsyncMail
|
an instance of AsyncMail attached to the server in the context of the interaction. |
server
property
#
server: AttachServer
An instance of AttachServer, which basically has the MailServer attached to it.
RETURNS | DESCRIPTION |
---|---|
AttachServer
|
an instance of AttachServer, which can be used like |
NewMessage
#
NewMessage(
event: str,
client: AsyncMail,
_server: AttachServer,
new_message: Message,
)
Bases: BaseEvent
Event triggered when a message is received.
PARAMETER | DESCRIPTION |
---|---|
new_message |
The message that was received.
TYPE:
|
client
property
#
client: AsyncMail
Client attached to the server context.
RETURNS | DESCRIPTION |
---|---|
AsyncMail
|
an instance of AsyncMail attached to the server in the context of the interaction. |
server
property
#
server: AttachServer
An instance of AttachServer, which basically has the MailServer attached to it.
RETURNS | DESCRIPTION |
---|---|
AttachServer
|
an instance of AttachServer, which can be used like |
event
property
#
event: str
The event string associated with the dispatched class.
RETURNS | DESCRIPTION |
---|---|
str
|
The event string associated with the dispatched class |
MessageDelete
#
MessageDelete(
event: str,
client: AsyncMail,
deleted_message: Message,
_server: AttachServer,
)
Bases: BaseEvent
Event triggered when a message gets deleted using the server instance. Note: This won't get triggered if the client is used to delete any message
PARAMETER | DESCRIPTION |
---|---|
deleted_message |
The message that was deleted.
TYPE:
|
client
property
#
client: AsyncMail
Client attached to the server context.
RETURNS | DESCRIPTION |
---|---|
AsyncMail
|
an instance of AsyncMail attached to the server in the context of the interaction. |
server
property
#
server: AttachServer
An instance of AttachServer, which basically has the MailServer attached to it.
RETURNS | DESCRIPTION |
---|---|
AttachServer
|
an instance of AttachServer, which can be used like |
DomainChange
#
DomainChange(
new_domain: Domain,
event: str,
client: AsyncMail,
_server: AttachServer,
)
Bases: BaseEvent
Event triggered when the email domain is changed.
Parameter
new_domain : Domain The new domain that was set.
client
property
#
client: AsyncMail
Client attached to the server context.
RETURNS | DESCRIPTION |
---|---|
AsyncMail
|
an instance of AsyncMail attached to the server in the context of the interaction. |
server
property
#
server: AttachServer
An instance of AttachServer, which basically has the MailServer attached to it.
RETURNS | DESCRIPTION |
---|---|
AttachServer
|
an instance of AttachServer, which can be used like |
AccountSwitched
#
AccountSwitched(
event: str,
client: AsyncMail,
_server: AttachServer,
last_account_auth: ServerAuth,
)
Bases: BaseEvent
Event triggered when the account is switched to a different account.
Parameter
last_account_auth: ServerAuth An instance of ServerAuth that represents the last account.
client
property
#
client: AsyncMail
Client attached to the server context.
RETURNS | DESCRIPTION |
---|---|
AsyncMail
|
an instance of AsyncMail attached to the server in the context of the interaction. |
server
property
#
server: AttachServer
An instance of AttachServer, which basically has the MailServer attached to it.
RETURNS | DESCRIPTION |
---|---|
AttachServer
|
an instance of AttachServer, which can be used like |
event
property
#
event: str
The event string associated with the dispatched class.
RETURNS | DESCRIPTION |
---|---|
str
|
The event string associated with the dispatched class |
last_account_auth
property
#
last_account_auth: ServerAuth
Get the ServerAuth of the last account.
Returns:
ServerAuth An instance of ServerAuth that represents the last account.
NewAccountCreated
#
NewAccountCreated(
new_account_auth: ServerAuth,
new_account: Account,
event: str,
client: AsyncMail,
_server: AttachServer,
)
Bases: BaseEvent
Event triggered when a new account is created.
PARAMETER | DESCRIPTION |
---|---|
new_account_auth |
An instance of ServerAuth that represents the new account.
TYPE:
|
new_account |
An instance of Account that represents the new account.
TYPE:
|
client
property
#
client: AsyncMail
Client attached to the server context.
RETURNS | DESCRIPTION |
---|---|
AsyncMail
|
an instance of AsyncMail attached to the server in the context of the interaction. |
server
property
#
server: AttachServer
An instance of AttachServer, which basically has the MailServer attached to it.
RETURNS | DESCRIPTION |
---|---|
AttachServer
|
an instance of AttachServer, which can be used like |
event
property
#
event: str
The event string associated with the dispatched class.
RETURNS | DESCRIPTION |
---|---|
str
|
The event string associated with the dispatched class |
new_account_auth
property
#
new_account_auth: ServerAuth
The server authentication related to the new account.
RETURNS | DESCRIPTION |
---|---|
ServerAuth
|
An instance representing the details used in server authentication.
TYPE:
|
AccountDeleted
#
AccountDeleted(
event: str, client: AsyncMail, _server: AttachServer
)
Bases: BaseEvent
Event triggered when an account is deleted.
client
property
#
client: AsyncMail
Client attached to the server context.
RETURNS | DESCRIPTION |
---|---|
AsyncMail
|
an instance of AsyncMail attached to the server in the context of the interaction. |
server
property
#
server: AttachServer
An instance of AttachServer, which basically has the MailServer attached to it.
RETURNS | DESCRIPTION |
---|---|
AttachServer
|
an instance of AttachServer, which can be used like |
ServerStarted
#
ServerStarted(
event: str, client: AsyncMail, _server: AttachServer
)
Bases: BaseEvent
Event triggered when the server is started.
client
property
#
client: AsyncMail
Client attached to the server context.
RETURNS | DESCRIPTION |
---|---|
AsyncMail
|
an instance of AsyncMail attached to the server in the context of the interaction. |
server
property
#
server: AttachServer
An instance of AttachServer, which basically has the MailServer attached to it.
RETURNS | DESCRIPTION |
---|---|
AttachServer
|
an instance of AttachServer, which can be used like |
ServerCalledOff
#
ServerCalledOff(
event: str, client: AsyncMail, _server: AttachServer
)
Bases: BaseEvent
Event triggered when the server is ended.
client
property
#
client: AsyncMail
Client attached to the server context.
RETURNS | DESCRIPTION |
---|---|
AsyncMail
|
an instance of AsyncMail attached to the server in the context of the interaction. |
server
property
#
server: AttachServer
An instance of AttachServer, which basically has the MailServer attached to it.
RETURNS | DESCRIPTION |
---|---|
AttachServer
|
an instance of AttachServer, which can be used like |