|
|
|
@ -1,5 +1,9 @@
|
|
|
|
|
import telebot
|
|
|
|
|
|
|
|
|
|
#Last CTIME
|
|
|
|
|
from datetime import datetime, timedelta
|
|
|
|
|
LCTIME = datetime.now()
|
|
|
|
|
|
|
|
|
|
#Keyboard
|
|
|
|
|
from telebot.types import ReplyKeyboardMarkup, KeyboardButton
|
|
|
|
|
|
|
|
|
@ -17,7 +21,6 @@ API_TOKEN = var.API_MAIN
|
|
|
|
|
|
|
|
|
|
bot = telebot.TeleBot(API_TOKEN)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bot.message_handler(commands=['start'])
|
|
|
|
|
def welcome(message):
|
|
|
|
|
markup = ReplyKeyboardMarkup(resize_keyboard=True)
|
|
|
|
@ -63,6 +66,17 @@ def passwd(message):
|
|
|
|
|
@bot.message_handler(commands=['balance'])
|
|
|
|
|
def balance(message):
|
|
|
|
|
read()
|
|
|
|
|
readtime()
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
fix = '\x1b[0m'
|
|
|
|
|
# time = int(list({var.dbtime[var.db[str(message.chat.id)] + fix]})[0])
|
|
|
|
|
time = int(var.dbtime[var.db[str(message.chat.id)] + fix])
|
|
|
|
|
hours = time//3600
|
|
|
|
|
minutes = (time - hours*3600)//60
|
|
|
|
|
seconds = time - (hours*3600 + minutes*60)
|
|
|
|
|
except:
|
|
|
|
|
hours=0; minutes=0; seconds=0
|
|
|
|
|
|
|
|
|
|
if checkauth(message):
|
|
|
|
|
name=var.db[str(message.chat.id)]
|
|
|
|
@ -70,9 +84,24 @@ def balance(message):
|
|
|
|
|
bot.reply_to(message,f"""
|
|
|
|
|
ID/Имя ➣ {var.db[str(message.chat.id)]}
|
|
|
|
|
Баланс ➣ {sum} CDM
|
|
|
|
|
Наиграно ➣ {hours}:{minutes}:{seconds}
|
|
|
|
|
""")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bot.message_handler(commands=['gbal'])
|
|
|
|
|
def global_balance(message):
|
|
|
|
|
if checkauth(message):
|
|
|
|
|
read()
|
|
|
|
|
|
|
|
|
|
gbal = 0
|
|
|
|
|
for i in var.db:
|
|
|
|
|
if str(type(var.db[i])) != "<class 'str'>":
|
|
|
|
|
gbal = gbal + var.db[i]
|
|
|
|
|
|
|
|
|
|
bot.reply_to(message,f"Общий баланс ➣ {gbal}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bot.message_handler(commands=['change'])
|
|
|
|
|
def change(message):
|
|
|
|
|
if checkauth(message):
|
|
|
|
@ -95,6 +124,133 @@ def pay(message):
|
|
|
|
|
bot.reply_to(message,"Сумма ➣")
|
|
|
|
|
var.steps[message.chat.id]="pay_num"
|
|
|
|
|
|
|
|
|
|
@bot.message_handler(commands=['fpadd'])
|
|
|
|
|
def createfastpay(message):
|
|
|
|
|
if checkauth(message):
|
|
|
|
|
#try:
|
|
|
|
|
readfp()
|
|
|
|
|
ets = message.text.split()
|
|
|
|
|
#parse all elements
|
|
|
|
|
name=var.db[str(message.chat.id)] ; id=ets[1] ; cost=float(ets[2])
|
|
|
|
|
#parse text message
|
|
|
|
|
ets.pop(0) ; ets.pop(0) ; ets.pop(0) ; text=''
|
|
|
|
|
for i in ets:
|
|
|
|
|
text=text+' '+i
|
|
|
|
|
#print('name: ',name,' id: ',id,' cost: ',cost,' text: ',text)
|
|
|
|
|
|
|
|
|
|
if id not in var.fp:
|
|
|
|
|
var.fp[id] = [name, cost, text]
|
|
|
|
|
writefp()
|
|
|
|
|
|
|
|
|
|
bot.reply_to(message,f"""
|
|
|
|
|
➣Счёт успешно создан.
|
|
|
|
|
~~~~~~~~~~
|
|
|
|
|
Имя/id: {id}
|
|
|
|
|
Сумма: {cost}
|
|
|
|
|
Сообщение: {text}
|
|
|
|
|
""")
|
|
|
|
|
else:
|
|
|
|
|
bot.reply_to(message,"Счёт с таким именем уже существует.")
|
|
|
|
|
|
|
|
|
|
@bot.message_handler(commands=['fpdel'])
|
|
|
|
|
def deletefastpay(message):
|
|
|
|
|
if checkauth(message):
|
|
|
|
|
readfp()
|
|
|
|
|
id = message.text.split()[1]
|
|
|
|
|
|
|
|
|
|
if id in var.fp:
|
|
|
|
|
if var.fp[id][0] == var.db[str(message.chat.id)]:
|
|
|
|
|
var.fp.pop(id)
|
|
|
|
|
writefp()
|
|
|
|
|
bot.reply_to(message,"Счёт успешно удалён")
|
|
|
|
|
else:
|
|
|
|
|
bot.reply_to(message,"У Вас нету прав на удаление этого счёта")
|
|
|
|
|
else:
|
|
|
|
|
bot.reply_to(message,"Счёта с таким именем не существует")
|
|
|
|
|
|
|
|
|
|
@bot.message_handler(commands=['fp'])
|
|
|
|
|
def fastpay(message):
|
|
|
|
|
if checkauth(message):
|
|
|
|
|
readfp()
|
|
|
|
|
read()
|
|
|
|
|
id = message.text.split()[1]
|
|
|
|
|
|
|
|
|
|
if id in var.fp:
|
|
|
|
|
name=var.fp[id][0] ; sum=var.fp[id][1] ; mes=var.fp[id][2]
|
|
|
|
|
|
|
|
|
|
bot.reply_to(message,f"""
|
|
|
|
|
Ник ➣ {name}
|
|
|
|
|
Сумма ➣ {sum}
|
|
|
|
|
Для подтверждения напишите 'да' """)
|
|
|
|
|
|
|
|
|
|
var.steps[message.chat.id]='pay_valid'
|
|
|
|
|
|
|
|
|
|
var.pnick[message.chat.id] = name
|
|
|
|
|
var.pnum[message.chat.id] = sum
|
|
|
|
|
var.pmes[message.chat.id] = mes
|
|
|
|
|
var.tpmes[message.chat.id] = True
|
|
|
|
|
|
|
|
|
|
write()
|
|
|
|
|
else:
|
|
|
|
|
bot.reply_to(message,"Счёта с таким именем не существует")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bot.message_handler(commands=['fplist'])
|
|
|
|
|
def fastpaylist(message):
|
|
|
|
|
if checkauth(message):
|
|
|
|
|
readfp()
|
|
|
|
|
tmes = '' ; name=var.db[str(message.chat.id)]
|
|
|
|
|
for i in var.fp:
|
|
|
|
|
if var.fp[i][0] == name:
|
|
|
|
|
tmes=tmes+' '+i
|
|
|
|
|
|
|
|
|
|
bot.reply_to(message,f"Ваши счета: \n {tmes}")
|
|
|
|
|
|
|
|
|
|
@bot.message_handler(commands=['fpinfo'])
|
|
|
|
|
def fastpayinfo(message):
|
|
|
|
|
if checkauth(message):
|
|
|
|
|
readfp()
|
|
|
|
|
|
|
|
|
|
id = message.text.split()[1]
|
|
|
|
|
name=var.fp[id][0] ; cost=var.fp[id][1]
|
|
|
|
|
|
|
|
|
|
if id in var.fp:
|
|
|
|
|
bot.reply_to(message,f"""
|
|
|
|
|
Информация о счёте.
|
|
|
|
|
~~~~~~~~~~
|
|
|
|
|
Имя/id: {id}
|
|
|
|
|
Ник: {name}
|
|
|
|
|
Сумма: {cost}""")
|
|
|
|
|
else:
|
|
|
|
|
bot.reply_to(message,"Счёта с таким именем не существует")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bot.message_handler(commands=['ctime'])
|
|
|
|
|
def ctime(message):
|
|
|
|
|
readtime()
|
|
|
|
|
read()
|
|
|
|
|
global LCTIME
|
|
|
|
|
time_delta = datetime.now() - LCTIME
|
|
|
|
|
#print(time_delta)
|
|
|
|
|
if time_delta.seconds > 5:
|
|
|
|
|
fix = '\x1b[0m'
|
|
|
|
|
time = int(var.dbtime[var.db[str(message.chat.id)] + fix])
|
|
|
|
|
nick = var.db[str(message.chat.id)]
|
|
|
|
|
money = time*0.0001
|
|
|
|
|
|
|
|
|
|
var.dbtime[var.db[str(message.chat.id)] + fix] = 0
|
|
|
|
|
var.db[var.db[str(message.chat.id)]] = var.db[var.db[str(message.chat.id)]] + money
|
|
|
|
|
|
|
|
|
|
bot.reply_to(message,f"➣ Ваше время успешно конвертированно в {money} CDM")
|
|
|
|
|
|
|
|
|
|
writetime()
|
|
|
|
|
write()
|
|
|
|
|
LCTIME = datetime.now()
|
|
|
|
|
else:
|
|
|
|
|
bot.reply_to(message,f"➣ Превышено ограничение частоты запросов")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bot.message_handler(func=lambda message: True)
|
|
|
|
|
def checks(message):
|
|
|
|
@ -242,6 +398,13 @@ ___________
|
|
|
|
|
║Вам перевели ➣ {sum} CDM
|
|
|
|
|
╚════════════════════════
|
|
|
|
|
""")
|
|
|
|
|
try:
|
|
|
|
|
if var.tpmes[message.chat.id] == True:
|
|
|
|
|
bot.send_message(getid,f"➣ {var.pmes[message.chat.id]}")
|
|
|
|
|
var.tpmes[message.chat.id] = False
|
|
|
|
|
except:
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
pass
|
|
|
|
|
write()
|
|
|
|
|