discord-py-self

raw JSON →
2.1.0 verified Fri May 01 auth: no python

A Python wrapper for the Discord user (self-bot) API, allowing automation of user accounts. Version 2.1.0 supports Python >=3.10. This library is not officially supported by Discord and is against Discord's Terms of Service, often leading to account bans. It uses a similar API to discord.py but for user accounts.

pip install discord-py-self
error TypeError: __init__() missing 1 required positional argument: 'intents'
cause Intents are mandatory starting in version 2.0.0.
fix
Add intents=discord.Intents.default() to your Client or Bot constructor.
error AttributeError: 'Bot' object has no attribute 'login'
cause The login method was removed in later versions of 2.x.
fix
Use bot.run(token) or await bot.start(token) instead.
breaking In version 2.0+, Intents are required and must be passed explicitly. Old code without intents will fail with a TypeError.
fix Add intents=discord.Intents.default() (or custom) when creating Client or Bot.
deprecated The 'login' method is deprecated in favor of 'start' or 'run'. Using login() may break in future versions.
fix Use bot.run(token) or await bot.start(token) instead of bot.login(token).
gotcha This library violates Discord's Terms of Service. Using it for self-botting can lead to permanent account suspension. Use at your own risk.
fix Consider using a bot account with discord.py instead.

Minimal self-bot using commands.Bot with self_bot=True and message content intents.

import discord
from discord.ext import commands

intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix='!', self_bot=True, intents=intents)

@bot.event
async def on_ready():
    print(f'Logged in as {bot.user}')

bot.run(os.environ.get('TOKEN', ''))