Defectio Models#
Models are classes that are received from Revolt and are not meant to be created by the user of the library.
Danger
The classes listed below are not intended to be created by users and are also read-only.
For example, this means that you should not make your own User
instances
nor should you modify the User
instance yourself.
If you want to get one of these model classes instances they’d have to be through
the cache, and a common way of doing so is through the utils.find()
function
or attributes of model classes that you receive from the events specified in the
Event Reference.
Note
Nearly all classes here have __slots__ defined which means that it is impossible to have dynamic attributes to the data classes.
User#
- asynccreate_dm
- asyncfetch_message
- defget_relationship
- defmentioned_in
- class defectio.User[source]#
- property display_name#
Returns the user’s display name.
For regular users this is just their username, but if they have a server specific nickname then that is returned instead.
- Type
- await fetch_message(id)#
This function is a coroutine.
Retrieves a single
Message
from the destination.
- get_relationship(user_id)#
Get the relationship with a user
- Parameters
user_id (str) – User ID
- Returns
Our relationship with them
- Return type
Optional[Relationship]
- mentioned_in(message)#
Checks if the user is mentioned in the specified message.
- property dm_channel#
Returns the channel associated with this user if it exists.
If this returns
None
, you can create a DM channel by calling thecreate_dm()
coroutine function.- Type
Optional[
DMChannel
]
Message#
Server#
- class defectio.Server[source]#
-
- property text_channels#
All text channels in the server
- Returns
list of all text channels
- Return type
[type]
- property voice_channels#
All voice channels in the server
- Returns
list of all voice channels
- Return type
[type]
- property members#
All cached members in the server.
Member#
- asyncfetch_message
Role#
TextChannel#
- asyncfetch_message
DMChannel#
- asyncfetch_message
GroupChannel#
- asyncfetch_message
RawMessageDeleteEvent#
- class defectio.RawMessageDeleteEvent[source]#
Represents the event payload for a
on_raw_message_delete()
event. .. attribute:: channel_idThe channel ID where the deletion took place.
- type
RawMessageUpdateEvent#
- class defectio.RawMessageUpdateEvent[source]#
Represents the payload for a
on_raw_message_edit()
event.- data#
The raw data given by the gateway https://developers.revolt.chat/api#tag/Messaging/paths/~1channels~1:channel~1messages/get
- Type
- cached_message#
The cached message, if found in the internal message cache. Represents the message before it is modified by the data in
RawMessageUpdateEvent.data
.- Type
Optional[
Message
]