A powerful Discord selfbot library written in Rust. Fast, safe, and easy to use.
β οΈ HEADS UP: Using selfbots violates Discord's ToS and can get your account banned. Use at your own risk!
This is a Rust library that lets you control your Discord account programmatically. Think of it as discord.js but for selfbots and written in Rust. It's blazingly fast thanks to Rust's performance and has a clean API that won't make you cry.
- β WebSocket Gateway - Real-time events, just works
- β REST API - Everything you need from Discord's API
- β Rich Presence - Flex with custom activities
- β Custom Status - Show off what you're doing
- β Spotify RPC - Fake or real, your choice
- β Embeds - Pretty messages that stand out
- β Polls - Create and vote on polls
- β Async/Await - Powered by Tokio
- β Type Safe - Rust's got your back
Add this to your Cargo.toml:
[dependencies]
discord-selfbot = { path = "." }Or if you're working locally:
[dependencies]
discord-selfbot = { git = "https://github.com/ege0x77czz/rust-discord-selfbot" }use discord_selfbot::{Client, ClientBuilder, EventHandler, Message, User};
use std::sync::Arc;
use async_trait::async_trait;
struct Handler;
#[async_trait]
impl EventHandler for Handler {
async fn ready(&self, user: User) {
println!("{} is ready!", user.username);
}
async fn message_create(&self, message: Message) {
if message.content == "ping" {
println!("Got ping from {}", message.author.username);
}
}
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = ClientBuilder::new("YOUR_TOKEN_HERE")
.event_handler(Arc::new(Handler))
.build()
.await?;
client.listen().await?;
Ok(())
}let channel_id = "123456789".into();
client.send_message(channel_id, "yo what's up").await?;use discord_selfbot::{Embed, MessageBuilder};
let embed = Embed::new()
.title("Check This Out")
.description("Pretty cool right?")
.color(0xFF0000)
.field("Field 1", "Value 1", true)
.footer("Made with Rust")
.image("https://example.com/image.png");
let payload = MessageBuilder::new()
.content("Look at this embed:")
.embed(embed)
.build();
client.send_message_advanced(channel_id, payload).await?;use discord_selfbot::RichPresence;
let presence = RichPresence::new("Minecraft")
.state("Building stuff")
.details("Survival Mode")
.large_image("minecraft_icon")
.large_text("Version 1.20")
.party(2, 10)
.start_timestamp(discord_selfbot::utils::now())
.add_button("Join Me", "https://example.com/join")
.to_activity();
client.set_activity(presence).await?;use discord_selfbot::CustomStatus;
let status = CustomStatus::new()
.emoji("π₯")
.state("grinding in Rust")
.to_activity();
client.set_activity(status).await?;use discord_selfbot::{Poll, MessageBuilder};
let poll = Poll::new("What's your favorite language?")
.add_answer("Rust", Some("π¦".to_string()))
.add_answer("Python", Some("π".to_string()))
.add_answer("JavaScript", Some("π©".to_string()))
.duration_hours(24)
.allow_multiselect(false);
let payload = MessageBuilder::new().poll(poll).build();
let message = client.send_message_advanced(channel_id, payload).await?;
// Vote for Rust obviously
client.vote_poll(channel_id, message.id, 1).await?;Check out the examples/ folder for more:
basic.rs- Simple bot to get startedembed.rs- Sending fancy embedsrich_presence.rs- Show off with Rich Presencepoll.rs- Polls and voting
Run them like this:
cargo run --example basic
cargo run --example rich_presenceNote: Don't forget to replace "token" with your actual Discord token in the code!
Open Discord, press Ctrl + Shift + I to open DevTools, go to Console, and paste this:
window.webpackChunkdiscord_app.push([
[Symbol()],
{},
req => {
if (!req.c) return;
for (let m of Object.values(req.c)) {
try {
if (!m.exports || m.exports === window) continue;
if (m.exports?.getToken) return copy(m.exports.getToken());
for (let ex in m.exports) {
if (m.exports?.[ex]?.getToken && m.exports[ex][Symbol.toStringTag] !== 'IntlMessagesProxy')
return copy(m.exports[ex].getToken());
}
} catch {}
}
},
]);
window.webpackChunkdiscord_app.pop();Your token will be copied to clipboard. Keep it secret!
Here's everything you can listen to:
#[async_trait]
impl EventHandler for Handler {
async fn ready(&self, user: User) {}
async fn message_create(&self, message: Message) {}
async fn message_update(&self, old: Option<Message>, new: Message) {}
async fn message_delete(&self, channel_id: Snowflake, message_id: Snowflake) {}
async fn guild_create(&self, guild: Guild) {}
async fn guild_delete(&self, guild_id: Snowflake) {}
async fn channel_create(&self, channel: Channel) {}
async fn channel_delete(&self, channel: Channel) {}
async fn presence_update(&self, presence: Presence) {}
async fn typing_start(&self, channel_id: Snowflake, user_id: Snowflake) {}
async fn poll_vote_add(&self, user_id: Snowflake, channel_id: Snowflake, message_id: Snowflake, answer_id: u32) {}
async fn poll_vote_remove(&self, user_id: Snowflake, channel_id: Snowflake, message_id: Snowflake, answer_id: u32) {}
async fn raw(&self, event: serde_json::Value) {}
}send_message(channel_id, content)- Send a quick messagesend_message_advanced(channel_id, payload)- Send message with embeds, polls, etc.edit_message(channel_id, message_id, content)- Edit your messagesdelete_message(channel_id, message_id)- Delete messagesget_message(channel_id, message_id)- Fetch a messageadd_reaction(channel_id, message_id, emoji)- React to messagesremove_reaction(channel_id, message_id, emoji)- Remove reactionsvote_poll(channel_id, message_id, answer_id)- Vote on pollstyping(channel_id)- Show typing indicatorset_presence(activities, status)- Set your presenceset_activity(activity)- Set a single activityset_status(status)- Just change your status
message.reply(http, "sup").await?;
message.react(http, "π").await?;
message.delete(http).await?;
message.edit(http, "fixed typo").await?;- Rust 1.70+ (probably works on older versions too but haven't tested)
- Tokio runtime
Found a bug? Want to add something cool? PRs are welcome! Just open an issue first if it's something big.
This is for educational purposes. Using selfbots is against Discord's Terms of Service. Your account might get banned. We're not responsible if that happens. You've been warned!
Also, this project is licensed under MIT. Do whatever you want with it.
Open an issue on GitHub if you're stuck or something's broken.
Remember: This breaks Discord's ToS. Use responsibly (or don't get caught π)