bot.http, the library’s shared HTTP client, and are async — you must await every call. The client automatically applies rate-limit management and realistic browser headers on every request, keeping your traffic consistent with a normal Discord session.
User Methods
fetch_me
Fetch the full User object for your own account.dict representing your own User object, including your id, username, global_name, discriminator, avatar, and account flags.
fetch_user
Retrieve publicly available information about any Discord user by their ID.int | str
required
The ID of the user to look up.
dict containing publicly visible fields only. You will not receive email, phone, or other private fields for other users.
fetch_profile
Retrieve a user’s full public profile, including mutual guilds, mutual friends, connected accounts, and premium (Nitro) status. Optionally scope the lookup to a specific guild for server-specific details like the member’s nickname and roles.int | str
required
The ID of the user whose profile you want to fetch.
int | str
When provided, the response includes guild-specific member data such as the user’s server nickname, roles, and join date for that guild.
dict containing the user’s user object, connected_accounts, mutual_guilds, mutual_friends, and premium information.
Profile fetches are rate-limited more aggressively than standard user lookups. Avoid fetching large numbers of profiles in rapid succession.
edit_me
Modify your own account’s username, display name, avatar, or other settings.str
Your new username. Must be unique across Discord and between 2 and 32 characters. Changing your username may alter your discriminator.
str
Your new display name (shown in place of your username in most UI surfaces). Between 1 and 32 characters.
str
A base64-encoded image string in the format
"data:image/png;base64,<data>". JPEG and GIF are also accepted. Pass null to remove your avatar.str
A base64-encoded image string for your profile banner. Requires an active Nitro subscription.
dict.
fetch_me_guilds
Retrieve a list of all guilds your account is currently a member of.list[dict] of partial Guild objects. Each entry includes the guild’s id, name, icon, owner flag, and your permission bitfield for that guild.
fetch_connections
Retrieve the list of third-party accounts (Twitch, YouTube, GitHub, Steam, etc.) connected to your Discord account.list[dict], each representing a connected account with fields like type, id, name, and verified.
DMs and Relationships
open_dm
Open (or re-open) a Direct Message channel with another user. If a DM channel already exists, Discord returns the existing one.int | str
required
The ID of the user you want to open a DM with.
dict of type 1 (DM). Use dm["id"] as the channel_id for subsequent send_message calls.
fetch_relationships
Retrieve all relationships on your account — friends, pending incoming/outgoing friend requests, and blocked users.list[dict], each containing a type integer and a partial user object.
add_friend
Send a friend request to another user.int | str
required
The ID of the user to send a friend request to.
None on success.
remove_friend
Unfriend a user or cancel a pending friend request.int | str
required
The ID of the user to remove from your friends list.
None on success.
block_user
Block a user. Blocked users cannot send you friend requests or DMs.int | str
required
The ID of the user to block.
None on success.
Raw Requests
When you need to call a Discord endpoint that alterself doesn’t yet wrap with a dedicated method, you can drop down to the rawrequest method. Construct an Endpoint object with the HTTP verb and path, then pass it directly to bot.http.request. All rate-limit management, header spoofing, and retry logic still applies — you get the full benefit of the client without being limited to the built-in helpers.
Endpoint
required
An
Endpoint instance created via Endpoint(method, path) where method is an HTTP verb string ("GET", "POST", "PATCH", "DELETE", etc.) and path is the Discord API path starting with /.dict
A JSON-serialisable dict to send as the request body. Used for
POST, PATCH, and PUT requests.dict
Query string parameters to append to the URL.
dict or list, depending on the endpoint. Returns None for endpoints that respond with 204 No Content.
Rate Limits
alterself’s HTTP client manages Discord’s complex per-route rate-limit buckets automatically. When a bucket is exhausted, the client sleeps until the reset time and retries — yourawait simply takes longer rather than raising an exception. You never need to write backoff logic yourself.
You can inspect the current state of the rate-limit manager at any time:
_rl is an internal attribute. Its interface may change between alterself releases. Use stats() for observability only — do not modify the rate-limit state directly.