Telegram
2
Вклад в тег
# -*- coding: utf-8 -*-
import sett
import telebot
import random
import menu
from telebot import types
import time
import traceback
bot = telebot.TeleBot(sett.token)
joinedFile = open('/root/users.txt', 'r')
joinedUser = set()
for line in joinedFile:
joinedUser.add(line.strip())
joinedFile.close()
@bot.message_handler(commands=['start'])
def start(message):
try:
if not str(message.chat.id) in joinedUser:
file = open('/root/users.txt', 'a')
file.write(str(message.chat.id) + '\n')
file.close()
except Exception as e:
print(e)
bot.send_message(sett.admin_id, 'Произошла ошибка, отправьте кодеру!!!\n'+str(e)+'')
@bot.message_handler(commands=['spam'])
def spam(message):
try:
if message.chat.id == sett.admin_id:
for user in joinedUser:
bot.send_message(user, message.text[message.text.find(' '):])
except Exception as e:
print(e)
bot.send_message(sett.admin_id, 'Произошла ошибка, отправьте кодеру!!!\n'+str(e)+'')
@bot.message_handler(commands=['stats'])
def stats(message):
try:
if message.chat.id == sett.admin_id:
joinedFile = open('/root/users.txt', 'r')
bot.send_message(message.chat.id, 'Пользователей: *'+str(len(joinedFile.readlines()))'*, parse_mode='markdown')
joinedFile.close
except Exception as e:
print(e)
bot.send_message(sett.admin_id, 'Произошла ошибка, отправьте кодеру!!!\n'+str(e)+'')
def ban1(message):
ban = message.text
try:
int(ban)
func.ban(ban)
bot.send_message(message.chat.id, '✅ Человек успешно забанен!', )
bot.send_message(chat_id=f'-100{CHANNEL_ID}', f'✅ Человек успешно забанен!\n\n')
except:
bot.send_message(message.chat.id,text=canel_operation)