Skip to main content

Discord user account API wrapper - Cross-platform support including Termux

Project description

Discord Selfbot API

⚠️ WARNING: Selfbots violate Discord's Terms of Service. Using selfbots may result in your account being terminated. This library is for educational purposes only. Use at your own risk.

A cross-platform Discord selfbot API wrapper that works on Termux and other platforms.

Installation

pip install discord-selfbot-api

Ouick Start

import asyncio import os from discord_selfbot import Client

Get your Discord token (see instructions below)

TOKEN = os.getenv('DISCORD_TOKEN') or "your_token_here"

client = Client(TOKEN)

@client.event async def on_ready(): print(f"Logged in as {client.user}") print("Selfbot is ready!")

async def main(): await client.start()

# Keep the client running
while True:
    await asyncio.sleep(3600)

if name == "main": asyncio.run(main())

How to Get Your Discord Token

  1. Open Discord in your web browser

  2. Press F12 to open Developer Tools

  3. Go to the Network tab

  4. Reload the page and look for any request

  5. Find the Authorization header in request headers

  6. Copy the token (starts with letters)

Important: Never share your token with anyone!

Basic Usage Examples

Sending Messages

from discord_selfbot import Client

client = Client("your_token")

@client.event async def on_ready(): # Send a message to a channel channel_id = "1234567890" # Replace with actual channel ID await client.send_message(channel_id, "Hello from selfbot!")

Reading Messages

@client.event async def on_ready(): # Get recent messages from a channel channel_id = "1234567890" messages = await client.get_messages(channel_id, limit=10)

for message in messages:
    print(f"{message.author}: {message.content}")

User Information

@client.event async def on_ready(): # Get current user info user = await client.get_current_user() print(f"Username: {user.username}#{user.discriminator}") print(f"User ID: {user.id}")

# Get user's servers
guilds = await client.get_guilds()
print(f"Joined {len(guilds)} servers")

Advanced Examples

Autoresponder

from discord_selfbot import Client

client = Client("your_token")

@client.event async def on_ready(): print("Auto responder started!")

# Check messages periodically
while True:
    channel_id = "1234567890"
    messages = await client.get_messages(channel_id, limit=5)
    
    for message in messages:
        if "hello" in message.content.lower():
            await client.send_message(channel_id, "Hello there!")
    
    await asyncio.sleep(30)  # Check every 30 seconds     

Message Logger

from datetime import datetime

@client.event async def on_ready(): print("Message logger started!")

channels = ["1234567890", "0987654321"]  # Your channel IDs

for channel_id in channels:
    messages = await client.get_messages(channel_id, limit=20)
    
    for message in messages:
        timestamp = datetime.fromisoformat(message.timestamp.replace('Z', '+00:00'))
        print(f"[{timestamp}] {message.author}: {message.content}")

API References

Client Class

client = Client(token, intents=0) await client.start() # Start the client await client.close() # Close connections await client.get_current_user() # Get current user info await client.get_guilds() # Get user's servers
Message Methods

await client.send_message(channel_id, content) # Send message await client.get_messages(channel_id, limit=50) # Get messages await client.edit_message(channel_id, message_id, new_content) # Edit message await client.delete_message(channel_id, message_id) # Delete message

User Methods

await client.get_current_user() # Get current user await client.modify_current_user(username="new_name") # Change username

Common Issues

Token Not Working

Make sure you're using a user token, not bot token

Token should NOT start with "Bot "

Check if token has expired

Rate Limiting

The library handles basic rate limiting automatically

Avoid making too many requests too quickly

Import Errors

If you get import errors, check installation

pip uninstall discord-selfbot-api pip install discord-selfbot-api --upgrade

Disclaimer

This project is for educational purposes only. I am not responsible for any actions taken against your Discord account for using selfbots. Use at your own risk.

Support

If you encounter issues:

  1. Check this README first

  2. Ensure you're using the latest version

  3. Verify your token is correct

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

discord_self_api-1.0.0.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

discord_self_api-1.0.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file discord_self_api-1.0.0.tar.gz.

File metadata

  • Download URL: discord_self_api-1.0.0.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for discord_self_api-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c8d12029f806039ed8f77e1e8c2cd797357ce36671711b93aae47d6a4018958f
MD5 581c4371d395cade8970cb1be58cd86f
BLAKE2b-256 76d3987ecc939e761c37a0d2bf6fd987117b950f96f38ff4ee464460b2b83057

See more details on using hashes here.

File details

Details for the file discord_self_api-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for discord_self_api-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4539abf41dd21bd2c383b765eaf2605aa6498ee888ec55f266d0de200cecafdd
MD5 b0a817e73bf3e859151eb05b6ef8a7f7
BLAKE2b-256 6d37f773e8030cddc1b175cd6147d68f39ef08900c6181b50c73d094ce09b6b2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page