|
|
@ -0,0 +1,261 @@
|
|
|
|
|
|
|
|
import telebot
|
|
|
|
|
|
|
|
API_TOKEN = ''
|
|
|
|
|
|
|
|
bot = telebot.TeleBot(API_TOKEN)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#Keyboard
|
|
|
|
|
|
|
|
from telebot.types import ReplyKeyboardMarkup, KeyboardButton
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#SHA256 for sign
|
|
|
|
|
|
|
|
import hashlib
|
|
|
|
|
|
|
|
#Date&Time
|
|
|
|
|
|
|
|
from datetime import date
|
|
|
|
|
|
|
|
import time
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#JSON for database
|
|
|
|
|
|
|
|
import json
|
|
|
|
|
|
|
|
db = {"Nick":10}
|
|
|
|
|
|
|
|
def read():
|
|
|
|
|
|
|
|
#Read db and push
|
|
|
|
|
|
|
|
global db
|
|
|
|
|
|
|
|
with open('db.json', 'r') as openfile:
|
|
|
|
|
|
|
|
db = json.load(openfile)
|
|
|
|
|
|
|
|
def write():
|
|
|
|
|
|
|
|
#Read db and write
|
|
|
|
|
|
|
|
js = json.dumps(db, indent=4)
|
|
|
|
|
|
|
|
with open("db.json", "w") as outfile:
|
|
|
|
|
|
|
|
outfile.write(js)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#Create new table
|
|
|
|
|
|
|
|
#write()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#Step(reg / pay / other)
|
|
|
|
|
|
|
|
steps = {}
|
|
|
|
|
|
|
|
#Pay number
|
|
|
|
|
|
|
|
pnum = 0
|
|
|
|
|
|
|
|
#Pay nick
|
|
|
|
|
|
|
|
pnick = ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bot.message_handler(commands=['start'])
|
|
|
|
|
|
|
|
def welcome(message):
|
|
|
|
|
|
|
|
markup = ReplyKeyboardMarkup(resize_keyboard=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
markup.add('Баланс')
|
|
|
|
|
|
|
|
markup.add('Ввести/Вывести')
|
|
|
|
|
|
|
|
markup.add('Перевод')
|
|
|
|
|
|
|
|
markup.add('Помощь')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bot.reply_to(message, """
|
|
|
|
|
|
|
|
Start message
|
|
|
|
|
|
|
|
""",reply_markup=markup)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bot.message_handler(commands=['help'])
|
|
|
|
|
|
|
|
def help(message):
|
|
|
|
|
|
|
|
bot.reply_to(message, """
|
|
|
|
|
|
|
|
Help message
|
|
|
|
|
|
|
|
""")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def err_reg(message):
|
|
|
|
|
|
|
|
bot.reply_to(message,"""
|
|
|
|
|
|
|
|
Пожалуйста,авторизуйстесь.
|
|
|
|
|
|
|
|
Для этого введите свой игровой ник.""")
|
|
|
|
|
|
|
|
global steps
|
|
|
|
|
|
|
|
steps[message.chat.id]="reg"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bot.message_handler(commands=['change'])
|
|
|
|
|
|
|
|
def change(message):
|
|
|
|
|
|
|
|
bot.reply_to(message,"""
|
|
|
|
|
|
|
|
Сейчас недоступен обмен в любое время,приносим извинения за временные неудобства.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Чтобы продать/купить валюту Вы должны назначить время от 17:00 до 22:00 ПО МОСКВЕ(Оффициальный способ)
|
|
|
|
|
|
|
|
Или поменять валюту у игроков(Неоффициальный способ,не безопасно)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Введите время,пожалуйста:
|
|
|
|
|
|
|
|
""")
|
|
|
|
|
|
|
|
global steps
|
|
|
|
|
|
|
|
steps[message.chat.id]="change"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def checkauth(message):
|
|
|
|
|
|
|
|
read()
|
|
|
|
|
|
|
|
id=str(message.chat.id)
|
|
|
|
|
|
|
|
if id in db:
|
|
|
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
elif not id in db:
|
|
|
|
|
|
|
|
err_reg(message)
|
|
|
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bot.message_handler(commands=['balance'])
|
|
|
|
|
|
|
|
def balance(message):
|
|
|
|
|
|
|
|
read()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if checkauth(message):
|
|
|
|
|
|
|
|
name=db[str(message.chat.id)]
|
|
|
|
|
|
|
|
bot.reply_to(message,"Ваш баланс >> "+str(db[name])+" dM")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bot.message_handler(commands=['unreg'])
|
|
|
|
|
|
|
|
def unreg(message):
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
id=str(message.chat.id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print(id)
|
|
|
|
|
|
|
|
db.pop(id,None)
|
|
|
|
|
|
|
|
print(db)
|
|
|
|
|
|
|
|
write()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bot.reply_to(message,"""
|
|
|
|
|
|
|
|
Вы успешно вышли из своего аккаунта.
|
|
|
|
|
|
|
|
ВНИМАНИЕ: ВАШ НИК БОЛЬШЕ НЕ ПРИВЯЗАН НИ К ОДНОМУ ТЕЛЕГРАМ АККАУНТУ.
|
|
|
|
|
|
|
|
ЕГО МОГУТ УКРАСТЬ,РЕКОМЕНДУЕМ ПРИВЯЗАТЬ ОБРАТНО.""")
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
bot.reply_to(message,"Что-то пошло не так.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bot.message_handler(commands=['pay'])
|
|
|
|
|
|
|
|
def pay(message):
|
|
|
|
|
|
|
|
if checkauth(message):
|
|
|
|
|
|
|
|
bot.reply_to(message,"Введите сумму,которую хотите перевести")
|
|
|
|
|
|
|
|
global steps
|
|
|
|
|
|
|
|
steps[message.chat.id]="pay_num"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bot.message_handler(func=lambda message: True)
|
|
|
|
|
|
|
|
def checks(message):
|
|
|
|
|
|
|
|
global steps
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if message.text == 'Баланс':
|
|
|
|
|
|
|
|
balance(message)
|
|
|
|
|
|
|
|
db['breakme']
|
|
|
|
|
|
|
|
elif message.text == 'Ввести/Вывести':
|
|
|
|
|
|
|
|
change(message)
|
|
|
|
|
|
|
|
db['breakme']
|
|
|
|
|
|
|
|
elif message.text == 'Перевод':
|
|
|
|
|
|
|
|
pay(message)
|
|
|
|
|
|
|
|
db['breakme']
|
|
|
|
|
|
|
|
elif message.text == 'Помощь':
|
|
|
|
|
|
|
|
help(message)
|
|
|
|
|
|
|
|
db['breakme']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print(111111111111111111111111)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
print(steps[message.chat.id])
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
steps[message.chat.id] = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if steps[message.chat.id] == "reg":
|
|
|
|
|
|
|
|
id=message.chat.id
|
|
|
|
|
|
|
|
nick=message.text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print(type(not nick in db))
|
|
|
|
|
|
|
|
#Check id(get id by nick owner) in db
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
getid = list(db.keys())[list(db.values()).index(nick)]
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
getid=None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not getid in db:
|
|
|
|
|
|
|
|
print(nick)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
db[id]=nick
|
|
|
|
|
|
|
|
if nick in db:
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
db[nick]=0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
write()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bot.reply_to(message,"Поздравляю,Вы успешно авторизовались.")
|
|
|
|
|
|
|
|
#elif nick in db:
|
|
|
|
|
|
|
|
elif getid in db:
|
|
|
|
|
|
|
|
bot.reply_to(message,"""Вы пытаетесь зайти под именем другого игрока или с нового аккаунта?
|
|
|
|
|
|
|
|
Поддержка больше чем 1 аккаунта не реализована,напишите администратору - @kirill638355""")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
steps[message.chat.id]=None
|
|
|
|
|
|
|
|
elif steps[message.chat.id] == "pay_num":
|
|
|
|
|
|
|
|
global pnum
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
read()
|
|
|
|
|
|
|
|
pnum = int(message.text)
|
|
|
|
|
|
|
|
if int(pnum) > 0:
|
|
|
|
|
|
|
|
if db[db[str(message.chat.id)]] > int(pnum):
|
|
|
|
|
|
|
|
bot.reply_to(message,"Введите ник адресата")
|
|
|
|
|
|
|
|
steps[message.chat.id]="pnick"
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
bot.reply_to(message,"Что-то пошло не так,отмена операции")
|
|
|
|
|
|
|
|
steps[message.chat.id]=None
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
bot.reply_to(message,"Что-то пошло не так,отмена операции")
|
|
|
|
|
|
|
|
steps[message.chat.id]=None
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
bot.reply_to(message,"Что-то пошло не так,отмена операции")
|
|
|
|
|
|
|
|
steps[message.chat.id]=None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
elif steps[message.chat.id] == "pnick":
|
|
|
|
|
|
|
|
global pnick
|
|
|
|
|
|
|
|
pnick = message.text
|
|
|
|
|
|
|
|
bot.reply_to(message,"Ник: "+pnick+"\nСумма: "+str(pnum)+"\nВы уверены? Для подтверждения напишите 'да'(без ковычек и маленькими буквами)")
|
|
|
|
|
|
|
|
steps[message.chat.id] = "pay_valid"
|
|
|
|
|
|
|
|
elif steps[message.chat.id] == "pay_valid":
|
|
|
|
|
|
|
|
if message.text == 'да':
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
read()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print(db)
|
|
|
|
|
|
|
|
print(str(db[pnick])+" "+str(db[pnick]))
|
|
|
|
|
|
|
|
db[pnick] = db[pnick]+pnum
|
|
|
|
|
|
|
|
db[db[str(message.chat.id)]] = db[db[str(message.chat.id)]]-pnum
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#Date
|
|
|
|
|
|
|
|
today = date.today()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
payer=db[str(message.chat.id)]
|
|
|
|
|
|
|
|
payer_bill=str(message.chat.id)
|
|
|
|
|
|
|
|
sum=str(pnum)
|
|
|
|
|
|
|
|
dttm=today.strftime("%d.%m.%Y_"+time.strftime("%H:%M", time.localtime()))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
signstr=payer+pnick+dttm
|
|
|
|
|
|
|
|
sign=str(hashlib.sha256(str.encode(signstr)).hexdigest())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bot.reply_to(message,"Успешно")
|
|
|
|
|
|
|
|
bot.reply_to(message,f"""
|
|
|
|
|
|
|
|
-----ЧЕК----
|
|
|
|
|
|
|
|
Плательщик: {payer}
|
|
|
|
|
|
|
|
Номер счёта: {payer_bill}
|
|
|
|
|
|
|
|
Сумма: {sum}
|
|
|
|
|
|
|
|
~~~~~~~~~~
|
|
|
|
|
|
|
|
Получатель: {pnick}
|
|
|
|
|
|
|
|
Время&Дата: {dttm}
|
|
|
|
|
|
|
|
------------
|
|
|
|
|
|
|
|
ЧАСТНЫЙ БАНК ИГРОКА _SAN5_SkeLet0n_
|
|
|
|
|
|
|
|
ПОДПИСЬ: {sign}
|
|
|
|
|
|
|
|
___________
|
|
|
|
|
|
|
|
""")
|
|
|
|
|
|
|
|
f=open('signs.sha256','a')
|
|
|
|
|
|
|
|
f.write(sign+" "+dttm+"\n")
|
|
|
|
|
|
|
|
f.close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
write()
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
bot.reply_to(message,"Что-то пошло не так,отмена операции")
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
steps[message.chat.id] = None
|
|
|
|
|
|
|
|
bot.reply_to(message,"Вы отменили операцию")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
elif steps[message.chat.id] == "change":
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
read()
|
|
|
|
|
|
|
|
#print(message)
|
|
|
|
|
|
|
|
bot.send_message(2057834471,"#######################\nИгрок "+str(db[str(message.chat.id)])+" (@"+message.from_user.username+")"+" просит встречу в "+message.text+"\n#######################\n")
|
|
|
|
|
|
|
|
bot.reply_to(message,"Запрос успешно отправлен!")
|
|
|
|
|
|
|
|
steps[message.chat.id]=None
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
bot.reply_to(message,"Что-то пошло не так,отмена операции")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bot.infinity_polling()
|
|
|
|
|
|
|
|
|