Invites¶
The following section documents everything related to invites.
Models¶
BaseInvite¶
- class stoat.BaseInvite(*, state, code)[source]¶
Represents an invite on Stoat.
- await accept(*, http_overrides=None)[source]¶
This function is a coroutine.
Accepts an invite.
Fires either
PrivateChannelCreateEventorServerCreateEventfor the current user, and fires eitherGroupRecipientAddEventorServerMemberJoinEvent, andMessageCreateEvent(optional in server context), both for all group recipients/server members.Note
This can only be used by non-bot accounts.
- Parameters:
http_overrides (Optional[
HTTPOverrideOptions]) – The HTTP request overrides.- Raises:
HTTPException– Possible values fortype:Value
Reason
IsBotThe current token belongs to bot account.
TooManyServersYou’re participating in too many servers.
Unauthorized– Possible values fortype:Value
Reason
InvalidSessionThe current bot/user token is invalid.
Forbidden– Possible values fortype:Value
Reason
BannedYou’re banned from server.
GroupTooLargeThe group exceeded maximum count of recipients.
NotFound– Possible values fortype:Value
Reason
NotFoundThe invite/channel/server was not found.
Conflict– Possible values fortype:Value
Reason
AlreadyInGroupThe user is already in group.
AlreadyInServerThe user is already in server.
InternalServerError– Possible values fortype:Value
Reason
Populated attributes
DatabaseErrorSomething went wrong during querying database.
- Returns:
The joined server or group.
- Return type:
Union[
Server,GroupChannel]
- await delete(*, http_overrides=None)[source]¶
This function is a coroutine.
Deletes the invite.
You must have
manage_serverif deleting server invite.There is an alias for this called
revoke().- Parameters:
http_overrides (Optional[
HTTPOverrideOptions]) – The HTTP request overrides.- Raises:
Unauthorized– Possible values fortype:Value
Reason
InvalidSessionThe current bot/user token is invalid.
Forbidden– Possible values fortype:Value
Reason
MissingPermissionYou do not have the proper permissions to delete this invite.
NotFound– Possible values fortype:Value
Reason
NotFoundThe invite was not found.
InternalServerError– Possible values fortype:Value
Reason
Populated attributes
DatabaseErrorSomething went wrong during querying database.
- await revoke(*, http_overrides=None)[source]¶
This function is a coroutine.
Deletes the invite.
You must have
manage_serverif deleting server invite.This is an alias of
delete().- Parameters:
http_overrides (Optional[
HTTPOverrideOptions]) – The HTTP request overrides.- Raises:
Unauthorized– Possible values fortype:Value
Reason
InvalidSessionThe current bot/user token is invalid.
Forbidden– Possible values fortype:Value
Reason
MissingPermissionYou do not have the proper permissions to delete this invite.
NotFound– Possible values fortype:Value
Reason
NotFoundThe invite was not found.
InternalServerError– Possible values fortype:Value
Reason
Populated attributes
DatabaseErrorSomething went wrong during querying database.
ServerPublicInvite¶
- async accept
- async delete
- def get_channel
- def get_server
- def get_user
- async revoke
- class stoat.ServerPublicInvite(*, state, code, server_id, server_name, internal_server_icon, internal_server_banner, raw_server_flags, channel_id, channel_name, channel_description, user_name, internal_user_avatar, member_count)[source]¶
Represents a public invite to server channel.
This inherits from
BaseInvite.- internal_server_icon¶
The server’s stateless icon.
- Type:
Optional[
StatelessAsset]
- internal_server_banner¶
The server’s stateless banner..
- Type:
Optional[
StatelessAsset]
- internal_user_avatar¶
The user’s stateless avatar who created this invite.
- Type:
Optional[
StatelessAsset]
- get_channel()[source]¶
Optional[
ServerChannel]: The destination channel.
- get_user()[source]¶
Optional[
User]: The (guessed) user who created this invite.This always will return accurate user if user has avatar, but might incorrectly find user if avatar is missing.
- property user[source]¶
The (guessed) user who created this invite.
This always will return accurate user if user has avatar, but might incorrectly find user if avatar is missing.
- Type:
- await accept(*, http_overrides=None)[source]¶
This function is a coroutine.
Accepts an invite.
Fires
ServerCreateEventfor the current user,ServerMemberJoinEventand optionallyMessageCreateEvent, both for all server members.Note
This can only be used by non-bot accounts.
- Parameters:
http_overrides (Optional[
HTTPOverrideOptions]) – The HTTP request overrides.- Raises:
HTTPException– Possible values fortype:Value
Reason
IsBotThe current token belongs to bot account.
TooManyServersYou’re participating in too many servers.
Unauthorized– Possible values fortype:Value
Reason
InvalidSessionThe current bot/user token is invalid.
Forbidden– Possible values fortype:Value
Reason
BannedYou’re banned from server.
NotFound– Possible values fortype:Value
Reason
NotFoundThe invite/channel/server was not found.
Conflict– Possible values fortype:Value
Reason
AlreadyInServerThe user is already in server.
InternalServerError– Possible values fortype:Value
Reason
Populated attributes
DatabaseErrorSomething went wrong during querying database.
- Returns:
The joined server.
- Return type:
- await delete(*, http_overrides=None)[source]¶
This function is a coroutine.
Deletes the invite.
You must have
manage_serverif deleting server invite.There is an alias for this called
revoke().- Parameters:
http_overrides (Optional[
HTTPOverrideOptions]) – The HTTP request overrides.- Raises:
Unauthorized– Possible values fortype:Value
Reason
InvalidSessionThe current bot/user token is invalid.
Forbidden– Possible values fortype:Value
Reason
MissingPermissionYou do not have the proper permissions to delete this invite.
NotFound– Possible values fortype:Value
Reason
NotFoundThe invite was not found.
InternalServerError– Possible values fortype:Value
Reason
Populated attributes
DatabaseErrorSomething went wrong during querying database.
- await revoke(*, http_overrides=None)[source]¶
This function is a coroutine.
Deletes the invite.
You must have
manage_serverif deleting server invite.This is an alias of
delete().- Parameters:
http_overrides (Optional[
HTTPOverrideOptions]) – The HTTP request overrides.- Raises:
Unauthorized– Possible values fortype:Value
Reason
InvalidSessionThe current bot/user token is invalid.
Forbidden– Possible values fortype:Value
Reason
MissingPermissionYou do not have the proper permissions to delete this invite.
NotFound– Possible values fortype:Value
Reason
NotFoundThe invite was not found.
InternalServerError– Possible values fortype:Value
Reason
Populated attributes
DatabaseErrorSomething went wrong during querying database.
GroupPublicInvite¶
- async accept
- async delete
- def get_channel
- def get_user
- async revoke
- class stoat.GroupPublicInvite(*, state, code, channel_id, channel_name, channel_description, user_name, internal_user_avatar)[source]¶
Represents a public invite to group channel.
This inherits from
BaseInvite.- internal_user_avatar¶
The user’s stateless avatar who created this invite.
- Type:
Optional[
StatelessAsset]
- get_channel()[source]¶
Optional[
GroupChannel]: The destination channel.
- get_user()[source]¶
Optional[
User]: The (guessed) user who created this invite.This always will return accurate user if user has avatar, but might incorrectly find user if avatar is missing.
- property user[source]¶
The (guessed) user who created this invite.
This always will return accurate user if user has avatar, but might incorrectly find user if avatar is missing.
- Type:
- await accept(*, http_overrides=None)[source]¶
This function is a coroutine.
Accepts an invite.
Fires
PrivateChannelCreateEventfor the current user,GroupRecipientAddEventandMessageCreateEvent, both for all group recipients.Note
This can only be used by non-bot accounts.
- Parameters:
http_overrides (Optional[
HTTPOverrideOptions]) – The HTTP request overrides.- Raises:
HTTPException– Possible values fortype:Value
Reason
IsBotThe current token belongs to bot account.
Unauthorized– Possible values fortype:Value
Reason
InvalidSessionThe current bot/user token is invalid.
Forbidden– Possible values fortype:Value
Reason
GroupTooLargeThe group exceeded maximum count of recipients.
NotFound– Possible values fortype:Value
Reason
NotFoundThe invite/channel was not found.
Conflict– Possible values fortype:Value
Reason
AlreadyInGroupThe user is already in group.
InternalServerError– Possible values fortype:Value
Reason
Populated attributes
DatabaseErrorSomething went wrong during querying database.
- Returns:
The joined group.
- Return type:
- await delete(*, http_overrides=None)[source]¶
This function is a coroutine.
Deletes the invite.
You must have
manage_serverif deleting server invite.There is an alias for this called
revoke().- Parameters:
http_overrides (Optional[
HTTPOverrideOptions]) – The HTTP request overrides.- Raises:
Unauthorized– Possible values fortype:Value
Reason
InvalidSessionThe current bot/user token is invalid.
Forbidden– Possible values fortype:Value
Reason
MissingPermissionYou do not have the proper permissions to delete this invite.
NotFound– Possible values fortype:Value
Reason
NotFoundThe invite was not found.
InternalServerError– Possible values fortype:Value
Reason
Populated attributes
DatabaseErrorSomething went wrong during querying database.
- await revoke(*, http_overrides=None)[source]¶
This function is a coroutine.
Deletes the invite.
You must have
manage_serverif deleting server invite.This is an alias of
delete().- Parameters:
http_overrides (Optional[
HTTPOverrideOptions]) – The HTTP request overrides.- Raises:
Unauthorized– Possible values fortype:Value
Reason
InvalidSessionThe current bot/user token is invalid.
Forbidden– Possible values fortype:Value
Reason
MissingPermissionYou do not have the proper permissions to delete this invite.
NotFound– Possible values fortype:Value
Reason
NotFoundThe invite was not found.
InternalServerError– Possible values fortype:Value
Reason
Populated attributes
DatabaseErrorSomething went wrong during querying database.
UnknownPublicInvite¶
- class stoat.UnknownPublicInvite(*, state, code, payload)[source]¶
Represents a public invite that is not recognized by library yet.
This inherits from
BaseInvite.- await accept(*, http_overrides=None)[source]¶
This function is a coroutine.
Accepts an invite.
Fires either
PrivateChannelCreateEventorServerCreateEventfor the current user, and fires eitherGroupRecipientAddEventorServerMemberJoinEvent, andMessageCreateEvent(optional in server context), both for all group recipients/server members.Note
This can only be used by non-bot accounts.
- Parameters:
http_overrides (Optional[
HTTPOverrideOptions]) – The HTTP request overrides.- Raises:
HTTPException– Possible values fortype:Value
Reason
IsBotThe current token belongs to bot account.
TooManyServersYou’re participating in too many servers.
Unauthorized– Possible values fortype:Value
Reason
InvalidSessionThe current bot/user token is invalid.
Forbidden– Possible values fortype:Value
Reason
BannedYou’re banned from server.
GroupTooLargeThe group exceeded maximum count of recipients.
NotFound– Possible values fortype:Value
Reason
NotFoundThe invite/channel/server was not found.
Conflict– Possible values fortype:Value
Reason
AlreadyInGroupThe user is already in group.
AlreadyInServerThe user is already in server.
InternalServerError– Possible values fortype:Value
Reason
Populated attributes
DatabaseErrorSomething went wrong during querying database.
- Returns:
The joined server or group.
- Return type:
Union[
Server,GroupChannel]
- await delete(*, http_overrides=None)[source]¶
This function is a coroutine.
Deletes the invite.
You must have
manage_serverif deleting server invite.There is an alias for this called
revoke().- Parameters:
http_overrides (Optional[
HTTPOverrideOptions]) – The HTTP request overrides.- Raises:
Unauthorized– Possible values fortype:Value
Reason
InvalidSessionThe current bot/user token is invalid.
Forbidden– Possible values fortype:Value
Reason
MissingPermissionYou do not have the proper permissions to delete this invite.
NotFound– Possible values fortype:Value
Reason
NotFoundThe invite was not found.
InternalServerError– Possible values fortype:Value
Reason
Populated attributes
DatabaseErrorSomething went wrong during querying database.
- await revoke(*, http_overrides=None)[source]¶
This function is a coroutine.
Deletes the invite.
You must have
manage_serverif deleting server invite.This is an alias of
delete().- Parameters:
http_overrides (Optional[
HTTPOverrideOptions]) – The HTTP request overrides.- Raises:
Unauthorized– Possible values fortype:Value
Reason
InvalidSessionThe current bot/user token is invalid.
Forbidden– Possible values fortype:Value
Reason
MissingPermissionYou do not have the proper permissions to delete this invite.
NotFound– Possible values fortype:Value
Reason
NotFoundThe invite was not found.
InternalServerError– Possible values fortype:Value
Reason
Populated attributes
DatabaseErrorSomething went wrong during querying database.
PublicInvite¶
- class stoat.PublicInvite¶
An union of all public invites.
The following classes are included in this union:
PrivateBaseInvite¶
- class stoat.PrivateBaseInvite(*, state, code, creator_id)[source]¶
Represents a private invite on Stoat.
This inherits from
BaseInvite.- await accept(*, http_overrides=None)[source]¶
This function is a coroutine.
Accepts an invite.
Fires either
PrivateChannelCreateEventorServerCreateEventfor the current user, and fires eitherGroupRecipientAddEventorServerMemberJoinEvent, andMessageCreateEvent(optional in server context), both for all group recipients/server members.Note
This can only be used by non-bot accounts.
- Parameters:
http_overrides (Optional[
HTTPOverrideOptions]) – The HTTP request overrides.- Raises:
HTTPException– Possible values fortype:Value
Reason
IsBotThe current token belongs to bot account.
TooManyServersYou’re participating in too many servers.
Unauthorized– Possible values fortype:Value
Reason
InvalidSessionThe current bot/user token is invalid.
Forbidden– Possible values fortype:Value
Reason
BannedYou’re banned from server.
GroupTooLargeThe group exceeded maximum count of recipients.
NotFound– Possible values fortype:Value
Reason
NotFoundThe invite/channel/server was not found.
Conflict– Possible values fortype:Value
Reason
AlreadyInGroupThe user is already in group.
AlreadyInServerThe user is already in server.
InternalServerError– Possible values fortype:Value
Reason
Populated attributes
DatabaseErrorSomething went wrong during querying database.
- Returns:
The joined server or group.
- Return type:
Union[
Server,GroupChannel]
- await delete(*, http_overrides=None)[source]¶
This function is a coroutine.
Deletes the invite.
You must have
manage_serverif deleting server invite.There is an alias for this called
revoke().- Parameters:
http_overrides (Optional[
HTTPOverrideOptions]) – The HTTP request overrides.- Raises:
Unauthorized– Possible values fortype:Value
Reason
InvalidSessionThe current bot/user token is invalid.
Forbidden– Possible values fortype:Value
Reason
MissingPermissionYou do not have the proper permissions to delete this invite.
NotFound– Possible values fortype:Value
Reason
NotFoundThe invite was not found.
InternalServerError– Possible values fortype:Value
Reason
Populated attributes
DatabaseErrorSomething went wrong during querying database.
- await revoke(*, http_overrides=None)[source]¶
This function is a coroutine.
Deletes the invite.
You must have
manage_serverif deleting server invite.This is an alias of
delete().- Parameters:
http_overrides (Optional[
HTTPOverrideOptions]) – The HTTP request overrides.- Raises:
Unauthorized– Possible values fortype:Value
Reason
InvalidSessionThe current bot/user token is invalid.
Forbidden– Possible values fortype:Value
Reason
MissingPermissionYou do not have the proper permissions to delete this invite.
NotFound– Possible values fortype:Value
Reason
NotFoundThe invite was not found.
InternalServerError– Possible values fortype:Value
Reason
Populated attributes
DatabaseErrorSomething went wrong during querying database.
GroupInvite¶
- async accept
- async delete
- def get_channel
- def get_creator
- async revoke
- class stoat.GroupInvite(*, state, code, creator_id, channel_id)[source]¶
Represents a group invite on Stoat.
This inherits from
PrivateBaseInvite.- await delete(*, http_overrides=None)[source]¶
This function is a coroutine.
Deletes the invite.
You must have
manage_serverif deleting server invite.There is an alias for this called
revoke().- Parameters:
http_overrides (Optional[
HTTPOverrideOptions]) – The HTTP request overrides.- Raises:
Unauthorized– Possible values fortype:Value
Reason
InvalidSessionThe current bot/user token is invalid.
Forbidden– Possible values fortype:Value
Reason
MissingPermissionYou do not have the proper permissions to delete this invite.
NotFound– Possible values fortype:Value
Reason
NotFoundThe invite was not found.
InternalServerError– Possible values fortype:Value
Reason
Populated attributes
DatabaseErrorSomething went wrong during querying database.
- get_channel()[source]¶
Optional[
GroupChannel]: The group channel this invite points to.
- await revoke(*, http_overrides=None)[source]¶
This function is a coroutine.
Deletes the invite.
You must have
manage_serverif deleting server invite.This is an alias of
delete().- Parameters:
http_overrides (Optional[
HTTPOverrideOptions]) – The HTTP request overrides.- Raises:
Unauthorized– Possible values fortype:Value
Reason
InvalidSessionThe current bot/user token is invalid.
Forbidden– Possible values fortype:Value
Reason
MissingPermissionYou do not have the proper permissions to delete this invite.
NotFound– Possible values fortype:Value
Reason
NotFoundThe invite was not found.
InternalServerError– Possible values fortype:Value
Reason
Populated attributes
DatabaseErrorSomething went wrong during querying database.
- await accept(*, http_overrides=None)[source]¶
This function is a coroutine.
Accepts an invite.
Fires
PrivateChannelCreateEventfor the current user,GroupRecipientAddEventandMessageCreateEvent, both for all group recipients.Note
This can only be used by non-bot accounts.
- Parameters:
http_overrides (Optional[
HTTPOverrideOptions]) – The HTTP request overrides.- Raises:
HTTPException– Possible values fortype:Value
Reason
IsBotThe current token belongs to bot account.
Unauthorized– Possible values fortype:Value
Reason
InvalidSessionThe current bot/user token is invalid.
Forbidden– Possible values fortype:Value
Reason
GroupTooLargeThe group exceeded maximum count of recipients.
NotFound– Possible values fortype:Value
Reason
NotFoundThe invite/channel was not found.
Conflict– Possible values fortype:Value
Reason
AlreadyInGroupThe user is already in group.
InternalServerError– Possible values fortype:Value
Reason
Populated attributes
DatabaseErrorSomething went wrong during querying database.
- Returns:
The joined group.
- Return type:
ServerInvite¶
- async accept
- async delete
- def get_channel
- def get_creator
- def get_creator_as_member
- def get_creator_as_user
- def get_server
- async revoke
- class stoat.ServerInvite(*, state, code, creator_id, server_id, channel_id)[source]¶
Represents a server invite on Stoat.
This inherits from
PrivateBaseInvite.- await delete(*, http_overrides=None)[source]¶
This function is a coroutine.
Deletes the invite.
You must have
manage_serverif deleting server invite.There is an alias for this called
revoke().- Parameters:
http_overrides (Optional[
HTTPOverrideOptions]) – The HTTP request overrides.- Raises:
Unauthorized– Possible values fortype:Value
Reason
InvalidSessionThe current bot/user token is invalid.
Forbidden– Possible values fortype:Value
Reason
MissingPermissionYou do not have the proper permissions to delete this invite.
NotFound– Possible values fortype:Value
Reason
NotFoundThe invite was not found.
InternalServerError– Possible values fortype:Value
Reason
Populated attributes
DatabaseErrorSomething went wrong during querying database.
- await revoke(*, http_overrides=None)[source]¶
This function is a coroutine.
Deletes the invite.
You must have
manage_serverif deleting server invite.This is an alias of
delete().- Parameters:
http_overrides (Optional[
HTTPOverrideOptions]) – The HTTP request overrides.- Raises:
Unauthorized– Possible values fortype:Value
Reason
InvalidSessionThe current bot/user token is invalid.
Forbidden– Possible values fortype:Value
Reason
MissingPermissionYou do not have the proper permissions to delete this invite.
NotFound– Possible values fortype:Value
Reason
NotFoundThe invite was not found.
InternalServerError– Possible values fortype:Value
Reason
Populated attributes
DatabaseErrorSomething went wrong during querying database.
- get_channel()[source]¶
Optional[
ServerChannel]: The server channel this invite points to.
- await accept(*, http_overrides=None)[source]¶
This function is a coroutine.
Accepts an invite.
Fires
ServerCreateEventfor the current user,ServerMemberJoinEventand optionallyMessageCreateEvent, both for all server members.Note
This can only be used by non-bot accounts.
- Parameters:
http_overrides (Optional[
HTTPOverrideOptions]) – The HTTP request overrides.- Raises:
HTTPException– Possible values fortype:Value
Reason
IsBotThe current token belongs to bot account.
TooManyServersYou’re participating in too many servers.
Unauthorized– Possible values fortype:Value
Reason
InvalidSessionThe current bot/user token is invalid.
Forbidden– Possible values fortype:Value
Reason
BannedYou’re banned from server.
NotFound– Possible values fortype:Value
Reason
NotFoundThe invite/channel/server was not found.
Conflict– Possible values fortype:Value
Reason
AlreadyInServerThe user is already in server.
InternalServerError– Possible values fortype:Value
Reason
Populated attributes
DatabaseErrorSomething went wrong during querying database.
- Returns:
The joined server.
- Return type:
Invite¶
- stoat.Invite¶
alias of
GroupInvite|ServerInvite