From 7c1c9802c64375b96d5cd028a2f688742ec03e80 Mon Sep 17 00:00:00 2001 From: t Date: Mon, 15 Jan 2024 02:17:37 +0300 Subject: [PATCH] Init --- fastreg.py | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 fastreg.py diff --git a/fastreg.py b/fastreg.py new file mode 100644 index 0000000..b3f3837 --- /dev/null +++ b/fastreg.py @@ -0,0 +1,73 @@ + +import telebot +from telebot import types,util + + +### LOAD TOKEN ### +import json, os + +if not os.path.exists('db.json'): + db = {"token": "None"} + js = json.dumps(db, indent=2) + with open("db.json", "w") as outfile: + outfile.write(js) + + print('Input token in "None" (db.json)') + exit() +with open('db.json', 'r') as openfile: + db = json.load(openfile) + +API_TOKEN = db["token"] +bot = telebot.TeleBot(API_TOKEN) +################## + + +@bot.message_handler(commands=['help', 'start']) +def send_welcome(message): + bot.reply_to(message, """Приветствую! +Это бот для верификации аккаунта на сайте ss14top.404.mn + +__ Инструкция +1. Зарегистрируйтесь на ss14top.404.mn +2. Отправьте сюда свой ник с сайта +3. Ожидайте, скоро вашу запись одобрят! + +__ Правила +1. Не больше 1 аккаунта +2. Состоять в чате @ss14_chat +3. Не пытаться нарушить правила + +Бот собирает: ник ТГ, ID, ник на форуме. +Ник ТГ и ID никому кроме админа не передаётся ни при каких условиях. +""") + +# LOAD ID +global own_id +own_id = db["own_id"] +### + + +@bot.message_handler(commands=['a']) +def accept(message): + if message.chat.id == own_id: + id = message.text[3:] + bot.send_message(id, "Ваш аккаунт одобрен!") + bot.reply_to(message, f"Заявка {telebot.formatting.hcode( str(id) )} одобрена.", parse_mode="HTML") + +@bot.message_handler(commands=['d']) +def deny(message): + if message.chat.id == own_id: + id = message.text[3:] + reason = ' '.join(message.text.split()[2:]) + bot.send_message(id, f"Ваша заявка отклонена, причина: \n\n {reason}") + bot.reply_to(message, f"Заявка {telebot.formatting.hcode( str(id) )} отклонена.", parse_mode="HTML") + +@bot.message_handler(func=lambda message: True) +def echo_message(message): + global own_id + bot.send_message(own_id, f"Пользователь: {telebot.util.user_link(message.from_user)} \nTG: {message.from_user.username} \nID: {telebot.formatting.hcode(str(message.chat.id))} \nНик: {message.text}", parse_mode="HTML") + bot.reply_to(message, "Ваши данные отправлены на модерацию.\nПодождите, пожалуйста.") + + + +bot.infinity_polling()