discord-authority 🦀
A fast, async Discord selfbot library written in Rust.
⚠️ Heads up: Using selfbots violates Discord's ToS and can get your account banned. Use at your own risk.
Features
- WebSocket gateway with real-time events
- Full REST API coverage (messages, reactions, guilds, members, roles, bans, invites, polls, DMs)
- Rich Presence, Spotify RPC, and custom status
- Embeds and polls with builder APIs
- Async/await powered by Tokio
- Clean
on_*event handler naming
Installation
Add to your Cargo.toml:
[]
= { = "https://github.com/trophal/discord-authority" }
Or if working locally:
[]
= { = "." }
Quick Start
use ;
use Arc;
use async_trait;
;
async
Examples
Send a message
client.send_message.await?;
Send a DM
client.send_dm.await?;
Send an embed
use Embed;
let embed = new
.title
.description
.color
.field
.footer;
client.send_embed.await?;
Message history
let messages = client.get_messages.await?;
Reactions
client.add_reaction.await?;
client.remove_reaction.await?;
client.clear_reactions.await?;
Pin / unpin
client.pin_message.await?;
client.unpin_message.await?;
Bulk delete
client.bulk_delete_messages.await?;
Guild management
// Members
let member = client.get_member.await?;
client.kick_member.await?;
client.ban_member.await?;
client.unban_member.await?;
let bans = client.get_bans.await?;
// Roles
client.add_role.await?;
client.remove_role.await?;
let roles = client.get_roles.await?;
// Nickname
client.set_nickname.await?;
// Leave
client.leave_guild.await?;
Invites
let invite = client.create_invite.await?;
println!;
Polls
use ;
let poll = new
.add_answer
.add_answer
.duration_hours
.allow_multiselect;
let msg = client.send.await?;
client.vote_poll.await?;
client.unvote_poll.await?;
Rich Presence
use RichPresence;
let presence = new
.details
.state
.large_image
.large_text
.party
.start_timestamp
.add_button
.to_activity;
client.set_activity.await?;
Custom Status
use CustomStatus;
let status = new
.emoji
.state
.to_activity;
client.set_activity.await?;
client.clear_activity.await?;
Message helpers
message.reply.await?;
message.reply_embed.await?;
message.react.await?;
message.edit.await?;
message.pin.await?;
message.delete.await?;
All Events
All Client Methods
| Method | Description |
|---|---|
send_message(channel_id, content) |
Send a plain text message |
send(channel_id, builder) |
Send via MessageBuilder |
send_embed(channel_id, embed) |
Send an embed |
send_message_with_embed(channel_id, content, embed) |
Send content + embed |
send_dm(user_id, content) |
Open DM and send a message |
edit_message(channel_id, message_id, content) |
Edit a message |
delete_message(channel_id, message_id) |
Delete a message |
bulk_delete_messages(channel_id, ids) |
Bulk delete messages |
get_message(channel_id, message_id) |
Fetch a message |
get_messages(channel_id, limit, before, after) |
Fetch message history |
pin_message(channel_id, message_id) |
Pin a message |
unpin_message(channel_id, message_id) |
Unpin a message |
get_pinned_messages(channel_id) |
Fetch pinned messages |
add_reaction(channel_id, message_id, emoji) |
Add a reaction |
remove_reaction(channel_id, message_id, emoji) |
Remove your reaction |
clear_reactions(channel_id, message_id) |
Clear all reactions |
get_channel(channel_id) |
Fetch a channel |
create_dm(user_id) |
Open a DM channel |
start_typing(channel_id) |
Show typing indicator |
create_invite(channel_id, max_age, max_uses, temporary) |
Create an invite |
vote_poll(channel_id, message_id, answer_id) |
Vote on a poll |
unvote_poll(channel_id, message_id, answer_id) |
Remove poll vote |
get_guild(guild_id) |
Fetch a guild |
get_my_guilds() |
Fetch all your guilds |
leave_guild(guild_id) |
Leave a guild |
get_member(guild_id, user_id) |
Fetch a guild member |
kick_member(guild_id, user_id) |
Kick a member |
ban_member(guild_id, user_id, delete_secs, reason) |
Ban a member |
unban_member(guild_id, user_id) |
Unban a user |
get_bans(guild_id) |
Fetch ban list |
add_role(guild_id, user_id, role_id) |
Add role to member |
remove_role(guild_id, user_id, role_id) |
Remove role from member |
set_nickname(guild_id, user_id, nick) |
Set member nickname |
get_roles(guild_id) |
Fetch all roles |
delete_role(guild_id, role_id) |
Delete a role |
get_user(user_id) |
Fetch a user |
set_presence(activities, status) |
Set full presence |
set_activity(activity) |
Set a single activity |
set_status(status) |
Set status only |
clear_activity() |
Clear all activities |
current_user() |
Get cached current user |
fetch_me() |
Fetch current user from API |
listen() |
Start the event loop |
Publishing to crates.io
- Make sure you have a crates.io account and have run
cargo login - Double-check
Cargo.toml— name, version, description, license, repository - Run
cargo publish --dry-runto catch any issues before publishing - Run
cargo publishto push it live
Your crate will then be installable as:
[]
= "0.1"
Getting Your Token
Open Discord in the browser or desktop app, press Ctrl + Shift + I, go to Console, and paste:
window..;
window..;
Your token is now in your clipboard. Keep it secret.
Requirements
- Rust 1.70+
- Tokio runtime
License
MIT — do whatever you want with it.
This project is for educational purposes. Selfbots violate Discord's ToS. You've been warned. ⚠️