alterself represents every Discord resource as a typed model object. These objects behave like Python dataclasses. Each attribute is strongly typed and populated automatically when the gateway dispatches an event or when an HTTP method returns a response. In addition to raw attributes, most models expose computed properties that derive useful values (such as CDN URLs, mentions, and creation timestamps) without requiring extra API calls.
User
The User model represents any Discord account: a human user, a bot, or the account your selfbot is logged into. You receive User objects from gateway events such as READY, MESSAGE_CREATE, and relationship events.
Attributes
Properties
Use display_name instead of username when presenting a user to humans. It always returns the most visible name regardless of whether the account has migrated to the new system.
Guild
The Guild model represents a Discord server. alterself populates guild objects from GUILD_CREATE events and caches them for the lifetime of the session.
Attributes
Properties
member_count reflects the count at the time the guild payload was received. It is not updated incrementally as members join or leave. Use GUILD_MEMBER_ADD and GUILD_MEMBER_REMOVE events to track live changes.
Channel
The Channel model represents any Discord channel: text, voice, category, thread, or DM. The kind attribute tells you which type you are dealing with.
Attributes
Properties
Subclasses
DMChannel
DMChannel extends Channel and is returned for private messages between you and another user.
GroupChannel
GroupChannel extends Channel and represents a group DM.
Check channel.guild_id is None to quickly determine whether a channel is a DM rather than importing ChannelKind and comparing against every DM variant.
Message
The Message model represents a Discord message. You receive message objects primarily from MESSAGE_CREATE and MESSAGE_UPDATE gateway events, and from HTTP fetch methods.
Attributes
Properties
channel and guild resolve against the in-memory cache. If alterself has not yet received the corresponding CHANNEL_CREATE or GUILD_CREATE event, for example immediately after connecting, these properties may return None even when channel_id and guild_id are set.
Member
The Member model represents a user’s membership within a specific guild. It combines guild-specific metadata with a reference back to the underlying User object.
Attributes
Properties
Flake
Flake is alterself’s wrapper around a Discord snowflake ID. Every model’s id attribute is a Flake, not a plain integer, but Flake compares and hashes as an integer, so you can use it wherever an int is expected.
The real value of Flake is the structured data it exposes directly from the 64-bit snowflake value.
Flake objects are safe to use as dictionary keys and in sets. Two Flake objects with the same integer value are considered equal and produce the same hash.