# -*- 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)+'')
pyvenv .venv
python3 -m venv .venv
python3 --help
-m mod : run library module as a script (terminates option list)
/headheight=0.5cm % Место для контитула
/headsep=0.5cm % Отступ для контитула
/usepackage [right=1cm, left=2.5cm, top=2cm, bottom=2cm]{geometry}
почему для этой цели (как я читал на других источниках) язык Си выбирают чаще чем свой более развитый аналог - Java
dict1 = {1: "один", 2: "два"}
dict2 = dict1 # Так делать НЕЛЬЗЯ!
dict1 = {1: "один", 2: "два"}
dict2 = dict1.copy() # Так делать ПРАВИЛЬНО!
dict1 = {1: "один", 2: "два"}
dict2 = {}
for key in dict1:
dict2[key] = dict1[key]
dict1 = {1: "один", 2: "два"}
dict2 = {}
for key, item in dict1.items():
dict2[key] = item
dict1 = {1: "один", 2: "два"}
dict2 = {}
for keys in dict1:
dict2[keys] = dict1[keys] * 2
href="([^"]+)"
потом открваете все найденные и ищите там. Не эффективно, но работает.