From e84c2badad901cc80100f43758be98e56814d2b1 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 7 Dec 2024 20:51:58 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20CDM=20-=20/add=20;=20=D1=81=D0=B6=D0=B8?= =?UTF-8?q?=D0=B3=D0=B0=D0=BD=D0=B8=D0=B5=20CDM=20-=20/burn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tg.py | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/tg.py b/tg.py index 5afbc6b..1bb7380 100644 --- a/tg.py +++ b/tg.py @@ -96,8 +96,9 @@ def help(message): /pay ник сумма - Перевод /stats - Статистика /gen_token - (Ре)генерация токена API -/chat_id - Айди чата -/user_id - Айди пользователя` +/chat_id - Айди чата +/user_id - Айди пользователя +/burn - Сжечь CDM` [Исходный код](https://gitea.del.pw/justuser/CryptoDM) [Документация UserAPI](https://gitea.del.pw/justuser/cdm_example_user_api) @@ -275,6 +276,27 @@ def set_course(message): CDM в час: `{conf['time2cdm']*3600}`''', parse_mode = 'Markdown') +@bot.message_handler(commands=['add']) +def add(message): + conf = read('conf.json') + if message.from_user.id == conf['owner']: + id = user_in_db(API_TOKEN, tg=message.chat.id) + amount = message.text.split()[1] + if add_coins(API_TOKEN, id, amount) == 'OK': + bot.reply_to(message, f'''Начислено `{amount}` CDM.''', parse_mode='Markdown') + else: + bot.reply_to(message, 'Что-то пошло не так...') + +@bot.message_handler(commands=['burn']) +def burn(message): + conf = read('conf.json') + if message.from_user.id == conf['owner']: + id = user_in_db(API_TOKEN, tg=message.chat.id) + amount = message.text.split()[1] + if del_coins(API_TOKEN, id, amount) == 'OK': + bot.reply_to(message, f'''🔥Вы безвозвратно сожгли `{amount}` CDM.''', parse_mode='Markdown') + else: + bot.reply_to(message, 'Что-то пошло не так...') @bot.message_handler(commands=['gen_token']) def gen_token_tg(message):