.ping command with live latency data. The whole process takes about five minutes.
1
Install alterself
Make sure you have Python 3.10 or newer, then install alterself from PyPI:Verify the installation by checking the version:You should see the current version number printed to your terminal. If you see a
ModuleNotFoundError instead, double-check that you are running the pip that belongs to the Python interpreter you intend to use.2
Retrieve your Discord token
alterself connects to Discord as your user account, so it needs your personal user token: not a bot token.
- Open Discord in your web browser (discord.com) and log in.
- Press F12 (or Cmd + Option + I on macOS) to open DevTools.
- Click the Application tab, then expand Storage → Local Storage in the left sidebar.
- Click the
https://discord.comentry to open the key/value table. - Find the row with the key
tokenand copy its value. That value is your token.
3
Create your first selfbot
Create a new file called Here is what each part does:
bot.py and paste in the following code, replacing YOUR_USER_TOKEN with the token you copied in the previous step:bot.py
alterself.Client: the central object that owns the gateway connection, the HTTP session, and the spoofing engine.prefix = ".": every message starting with.will be checked against your registered commands.@bot.on_event/on_ready: runs once the gateway handshake is complete andbot.meis populated.@bot.command()/ping: registers.pingas a command.ctx.reply()sends a message in the same channel.bot.run(): starts the event loop, connects to the gateway, and blocks until you stop the process.
4
Run it and verify
Start the selfbot from your terminal:You should see output similar to this within a few seconds:Now open Discord, navigate to any channel your account can write in, and send Press Ctrl + C in your terminal to stop the selfbot gracefully.
.ping. The selfbot will reply with something like:What to try next
Now that your selfbot is running, here are the natural next steps:- Understand the Client: learn about the gateway lifecycle, session state, and the properties available on
bot.mein the Client concept guide. - Build more commands: explore argument parsing, error handling, and checks in the Commands concept guide.
- See real examples: browse complete, copy-paste-ready selfbot scripts in the Examples guide.