Взял скрипт за основу - https://lolz.live/threads/8262982/ xaoc import asyncio import aiohttp import sqlite3 import time from colorama import Fore, Style import os print(Fore.RED + Style.BRIGHT + r""" _____ ____ _ |_ _| __ _ _ ___| __ ) ___ | |_ | || '__| | | |/ _ \ _ \ / _ \| __| | || | | |_| | __/ |_) | (_) | |_ |_||_| \__,_|\___|____/ \___/ \__| Доработал by.0O0 — lolz.live/soft | Async Discord Messenger """ + Style.RESET_ALL) def log_console(level, message): timestamp = time.strftime("%H:%M:%S") colors = { "INFO": Fore.CYAN, "SUCCESS": Fore.GREEN, "ERROR": Fore.RED, "WARNING": Fore.YELLOW } color = colors.get(level, Fore.WHITE) print(color + f"[{timestamp}] [{level}] {message}" + Fore.RESET) def init_db(): conn = sqlite3.connect("tokens.db") cursor = conn.cursor() cursor.execute(""" CREATE TABLE IF NOT EXISTS tokens ( token TEXT PRIMARY KEY, added_at TEXT DEFAULT CURRENT_TIMESTAMP ) """) conn.commit() return conn def import_tokens_to_db(conn, filename): cursor = conn.cursor() try: with open(filename, 'r', encoding='utf-8') as file: raw_tokens = [line.strip() for line in file if line.strip()] for token in raw_tokens: try: cursor.execute("INSERT INTO tokens (token) VALUES (?)", (token,)) except sqlite3.IntegrityError: pass conn.commit() except FileNotFoundError: log_console("ERROR", "Файл 'token.txt' не найден.") def get_tokens_from_db(conn): cursor = conn.cursor() cursor.execute("SELECT token FROM tokens") return [row[0] for row in cursor.fetchall()] async def validate_token(session, token, proxy=None): headers = {"Authorization": token} try: async with session.get("https://discord.com/api/v9/users/@me", headers=headers, proxy=proxy, timeout=10) as resp: if resp.status == 200: log_console("SUCCESS", f"Валидный токен: {token[:10]}...") return token else: log_console("ERROR", f"Невалидный токен: {token[:10]}...") except Exception as e: log_console("ERROR", f"Ошибка проверки токена: {e}") return None async def get_friends(session, token, proxy=None): headers = {"Authorization": token} try: async with session.get("https://discord.com/api/v9/users/@me/relationships", headers=headers, proxy=proxy, timeout=10) as resp: if resp.status == 200: return await resp.json() except Exception as e: log_console("ERROR", f"Ошибка получения друзей: {e}") return [] async def get_guild_channels(session, token, proxy=None): headers = {"Authorization": token} try: async with session.get("https://discord.com/api/v9/users/@me/guilds", headers=headers, proxy=proxy, timeout=10) as resp: if resp.status != 200: return [] guilds = await resp.json() channels = [] for guild in guilds: guild_id = guild["id"] url = f"https://discord.com/api/v9/guilds/{guild_id}/channels" try: async with session.get(url, headers=headers, proxy=proxy, timeout=10) as c_resp: if c_resp.status == 200: c_list = await c_resp.json() for ch in c_list: if ch.get("type") == 0 and int(ch.get("permissions", 0)) & 0x800: channels.append(ch.get("id")) except: continue return channels except: return [] async def open_dm(session, token, user_id, proxy=None): url = "https://discord.com/api/v9/users/@me/channels" headers = { "Authorization": token, "Content-Type": "application/json" } payload = {"recipient_id": user_id} try: async with session.post(url, headers=headers, json=payload, proxy=proxy, timeout=10) as resp: if resp.status == 200: return (await resp.json()).get("id") except Exception: pass return None async def send_message(session, token, channel_id, message, proxy=None): url = f"https://discord.com/api/v9/channels/{channel_id}/messages" headers = { "Authorization": token, "Content-Type": "application/json" } payload = {"content": message} try: async with session.post(url, headers=headers, json=payload, proxy=proxy, timeout=10) as resp: if resp.status == 200: log_console("SUCCESS", f"Сообщение отправлено в канал {channel_id}") elif resp.status == 429: data = await resp.json() retry = float(data.get("retry_after", 1)) log_console("WARNING", f"Rate limit. Жду {retry} сек...") await asyncio.sleep(retry) await send_message(session, token, channel_id, message, proxy) elif resp.status == 403: log_console("WARNING", f"Нет доступа к каналу {channel_id}") else: log_console("ERROR", f"Ошибка отправки: {resp.status}") except Exception as e: log_console("ERROR", f"Ошибка соединения: {e}") async def process_token(session, token, message, delay, proxy=None): friends = await get_friends(session, token, proxy) for friend in friends: if friend.get("type") == 1: dm_channel = await open_dm(session, token, friend["id"], proxy) if dm_channel: await send_message(session, token, dm_channel, message, proxy) await asyncio.sleep(delay) channels = await get_guild_channels(session, token, proxy) for channel_id in channels: await send_message(session, token, channel_id, message, proxy) await asyncio.sleep(delay) async def main(): use_proxy = input("Использовать proxy? (y/n): ").strip().lower() == "y" proxy_url = None if use_proxy: proxy_url = input("Введите proxy (http://user:pass@ip:port): ").strip() conn = init_db() import_tokens_to_db(conn, "token.txt") tokens = get_tokens_from_db(conn) message = input("Введите сообщение для рассылки: ") try: delay = float(input("Введите задержку между сообщениями (сек): ")) except ValueError: log_console("ERROR", "Некорректная задержка.") return async with aiohttp.ClientSession() as session: for token in tokens: is_valid = await validate_token(session, token, proxy_url) if not is_valid: continue log_console("INFO", f"Начинаю обработку токена: {token[:10]}...") await process_token(session, token, message, delay, proxy_url) log_console("INFO", f"Закончил токен: {token[:10]}...") await asyncio.sleep(5) if __name__ == "__main__": asyncio.run(main()) Python import asyncio import aiohttp import sqlite3 import time from colorama import Fore, Style import os print(Fore.RED + Style.BRIGHT + r""" _____ ____ _ |_ _| __ _ _ ___| __ ) ___ | |_ | || '__| | | |/ _ \ _ \ / _ \| __| | || | | |_| | __/ |_) | (_) | |_ |_||_| \__,_|\___|____/ \___/ \__| Доработал by.0O0 — lolz.live/soft | Async Discord Messenger """ + Style.RESET_ALL) def log_console(level, message): timestamp = time.strftime("%H:%M:%S") colors = { "INFO": Fore.CYAN, "SUCCESS": Fore.GREEN, "ERROR": Fore.RED, "WARNING": Fore.YELLOW } color = colors.get(level, Fore.WHITE) print(color + f"[{timestamp}] [{level}] {message}" + Fore.RESET) def init_db(): conn = sqlite3.connect("tokens.db") cursor = conn.cursor() cursor.execute(""" CREATE TABLE IF NOT EXISTS tokens ( token TEXT PRIMARY KEY, added_at TEXT DEFAULT CURRENT_TIMESTAMP ) """) conn.commit() return conn def import_tokens_to_db(conn, filename): cursor = conn.cursor() try: with open(filename, 'r', encoding='utf-8') as file: raw_tokens = [line.strip() for line in file if line.strip()] for token in raw_tokens: try: cursor.execute("INSERT INTO tokens (token) VALUES (?)", (token,)) except sqlite3.IntegrityError: pass conn.commit() except FileNotFoundError: log_console("ERROR", "Файл 'token.txt' не найден.") def get_tokens_from_db(conn): cursor = conn.cursor() cursor.execute("SELECT token FROM tokens") return [row[0] for row in cursor.fetchall()] async def validate_token(session, token, proxy=None): headers = {"Authorization": token} try: async with session.get("https://discord.com/api/v9/users/@me", headers=headers, proxy=proxy, timeout=10) as resp: if resp.status == 200: log_console("SUCCESS", f"Валидный токен: {token[:10]}...") return token else: log_console("ERROR", f"Невалидный токен: {token[:10]}...") except Exception as e: log_console("ERROR", f"Ошибка проверки токена: {e}") return None async def get_friends(session, token, proxy=None): headers = {"Authorization": token} try: async with session.get("https://discord.com/api/v9/users/@me/relationships", headers=headers, proxy=proxy, timeout=10) as resp: if resp.status == 200: return await resp.json() except Exception as e: log_console("ERROR", f"Ошибка получения друзей: {e}") return [] async def get_guild_channels(session, token, proxy=None): headers = {"Authorization": token} try: async with session.get("https://discord.com/api/v9/users/@me/guilds", headers=headers, proxy=proxy, timeout=10) as resp: if resp.status != 200: return [] guilds = await resp.json() channels = [] for guild in guilds: guild_id = guild["id"] url = f"https://discord.com/api/v9/guilds/{guild_id}/channels" try: async with session.get(url, headers=headers, proxy=proxy, timeout=10) as c_resp: if c_resp.status == 200: c_list = await c_resp.json() for ch in c_list: if ch.get("type") == 0 and int(ch.get("permissions", 0)) & 0x800: channels.append(ch.get("id")) except: continue return channels except: return [] async def open_dm(session, token, user_id, proxy=None): url = "https://discord.com/api/v9/users/@me/channels" headers = { "Authorization": token, "Content-Type": "application/json" } payload = {"recipient_id": user_id} try: async with session.post(url, headers=headers, json=payload, proxy=proxy, timeout=10) as resp: if resp.status == 200: return (await resp.json()).get("id") except Exception: pass return None async def send_message(session, token, channel_id, message, proxy=None): url = f"https://discord.com/api/v9/channels/{channel_id}/messages" headers = { "Authorization": token, "Content-Type": "application/json" } payload = {"content": message} try: async with session.post(url, headers=headers, json=payload, proxy=proxy, timeout=10) as resp: if resp.status == 200: log_console("SUCCESS", f"Сообщение отправлено в канал {channel_id}") elif resp.status == 429: data = await resp.json() retry = float(data.get("retry_after", 1)) log_console("WARNING", f"Rate limit. Жду {retry} сек...") await asyncio.sleep(retry) await send_message(session, token, channel_id, message, proxy) elif resp.status == 403: log_console("WARNING", f"Нет доступа к каналу {channel_id}") else: log_console("ERROR", f"Ошибка отправки: {resp.status}") except Exception as e: log_console("ERROR", f"Ошибка соединения: {e}") async def process_token(session, token, message, delay, proxy=None): friends = await get_friends(session, token, proxy) for friend in friends: if friend.get("type") == 1: dm_channel = await open_dm(session, token, friend["id"], proxy) if dm_channel: await send_message(session, token, dm_channel, message, proxy) await asyncio.sleep(delay) channels = await get_guild_channels(session, token, proxy) for channel_id in channels: await send_message(session, token, channel_id, message, proxy) await asyncio.sleep(delay) async def main(): use_proxy = input("Использовать proxy? (y/n): ").strip().lower() == "y" proxy_url = None if use_proxy: proxy_url = input("Введите proxy (http://user:pass@ip:port): ").strip() conn = init_db() import_tokens_to_db(conn, "token.txt") tokens = get_tokens_from_db(conn) message = input("Введите сообщение для рассылки: ") try: delay = float(input("Введите задержку между сообщениями (сек): ")) except ValueError: log_console("ERROR", "Некорректная задержка.") return async with aiohttp.ClientSession() as session: for token in tokens: is_valid = await validate_token(session, token, proxy_url) if not is_valid: continue log_console("INFO", f"Начинаю обработку токена: {token[:10]}...") await process_token(session, token, message, delay, proxy_url) log_console("INFO", f"Закончил токен: {token[:10]}...") await asyncio.sleep(5) if __name__ == "__main__": asyncio.run(main()) Функции скрипта: Асинхронная отправка сообщений через aiohttp Поддержка ****** (по желанию) Проверка валидности токенов (/users/@me) Отправка сообщений друзьям (DM) Отправка в доступные текстовые каналы серверов Обработка по одному токену за раз Цветное логирование в консоли Работа с базой SQLite (tokens.db) для хранения уникальных токенов
0О0, пробанивает токен после спама, ну сессию сбивает типо невалидом становится, есть способы как оживить его? И не разобрался как ДМ спам работает, проспамило ток по серверам и оффнулось