-
Notifications
You must be signed in to change notification settings - Fork 2
/
commands.py
47 lines (39 loc) · 1.51 KB
/
commands.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from telegram import Update
from telegram.ext import ContextTypes
from Pay import pay
from utils import read_config, save_config
from datetime import datetime
async def info(update: Update, context: ContextTypes.DEFAULT_TYPE):
info = pay.query_info()
money = pay.query_money()
text = ''
if isinstance(info, dict):
if isinstance(money, dict):
info.update(money)
for k, v in info.items():
text += f'{k}: {v}\n'
else:
text = info
await update.message.reply_text(text=text)
async def money(update: Update, context: ContextTypes.DEFAULT_TYPE):
data = pay.query_money()
text = ''
if isinstance(data, dict):
for k, v in data.items():
text += f'{k}: {v}\n'
else:
text = data
await update.message.reply_text(text=text)
async def cash_out(update: Update, context: ContextTypes.DEFAULT_TYPE):
await update.message.reply_text(text=f'提现结果: {pay.cash_out()}')
async def on(update: Update, context: ContextTypes.DEFAULT_TYPE):
config = read_config()
run_time = datetime.strptime(config.get('pay').get('time'), "%H:%M:%S").time()
config['pay']['auto'] = 'on'
save_config(config)
await update.message.reply_text(text=f'开启自动提现成功,自动提现时间:{run_time}')
async def off(update: Update, context: ContextTypes.DEFAULT_TYPE):
config = read_config()
config['pay']['auto'] = 'off'
save_config(config)
await update.message.reply_text(text=f'关闭自动提现成功')