forked from v2boardbot/v2boardbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MenuHandle.py
161 lines (142 loc) · 4.74 KB
/
MenuHandle.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup, KeyboardButton
from telegram.constants import ParseMode
from telegram.ext import (
Application,
CallbackQueryHandler,
CommandHandler,
ContextTypes,
ConversationHandler,
)
from Config import config
from keyboard import return_keyboard
from models import V2User
from v2board import _bind, _checkin, _traffic, _lucky, _sub, _node, _wallet, _mysub
from Utils import START_ROUTES, END_ROUTES, WAITING_INPUT
# 添加时长 - 管理员命令
async def menu_addtime(update: Update, context: ContextTypes.DEFAULT_TYPE):
query = update.callback_query
await query.answer()
keyboard = [
return_keyboard,
]
reply_markup = InlineKeyboardMarkup(keyboard)
await query.edit_message_text(
text='请输入发送需要添加的时长,单位:天', reply_markup=reply_markup
)
return 'addtime'
# 赌博模式
async def menu_gambling(update: Update, context: ContextTypes.DEFAULT_TYPE):
query = update.callback_query
await query.answer()
keyboard = [
return_keyboard,
]
reply_markup = InlineKeyboardMarkup(keyboard)
v2_user = V2User.select().where(V2User.telegram_id == update.effective_user.id).first()
if not v2_user:
await query.edit_message_text(
text=f'未绑定,请先绑定',
reply_markup=reply_markup
)
return START_ROUTES
# 总开关
if config.GAME.switch != True:
await query.message.reply_text(text='当前赌博模式关闭,请联系管理员!')
return ConversationHandler.END
await query.edit_message_text(
text=f'请发送🎰或🎲表情,可以连续发送\n当前赔率:🎰1赔{config.TIGER.rate} 🎲1赔{config.DICE.rate}\n发送"不玩了"退出赌博模式',
reply_markup=reply_markup
)
return WAITING_INPUT
# 钱包
async def menu_wallet(update: Update, context: ContextTypes.DEFAULT_TYPE):
query = update.callback_query
await query.answer()
text = _wallet(update.effective_user.id)
keyboard = [
return_keyboard,
]
reply_markup = InlineKeyboardMarkup(keyboard)
await query.edit_message_text(
text=text, reply_markup=reply_markup
)
return START_ROUTES
# 菜单签到
async def menu_checkin(update: Update, context: ContextTypes.DEFAULT_TYPE):
query = update.callback_query
await query.answer()
text = _checkin(update.effective_user.id)
keyboard = [
return_keyboard,
]
reply_markup = InlineKeyboardMarkup(keyboard)
await query.edit_message_text(
text=text, reply_markup=reply_markup
)
return START_ROUTES
async def menu_sub(update: Update, context: ContextTypes.DEFAULT_TYPE):
query = update.callback_query
await query.answer()
text = _sub(update.effective_user.id)
keyboard = [
return_keyboard,
]
reply_markup = InlineKeyboardMarkup(keyboard)
await query.edit_message_text(
text=text, reply_markup=reply_markup
)
return START_ROUTES
async def menu_mysub(update: Update, context: ContextTypes.DEFAULT_TYPE):
if update.effective_message.chat.type != 'private':
text = '查看订阅仅限私聊使用,请私聊机器人'
else:
text = _mysub(update.effective_user.id)
query = update.callback_query
await query.answer()
keyboard = [
return_keyboard,
]
reply_markup = InlineKeyboardMarkup(keyboard)
await query.edit_message_text(
text=text, reply_markup=reply_markup
)
return START_ROUTES
# 流量查询
async def menu_traffic(update: Update, context: ContextTypes.DEFAULT_TYPE):
query = update.callback_query
await query.answer()
text = _traffic(update.effective_user.id)
keyboard = [
return_keyboard,
]
reply_markup = InlineKeyboardMarkup(keyboard)
await query.edit_message_text(
text=text, reply_markup=reply_markup
)
return START_ROUTES
# 幸运抽奖
async def menu_lucky(update: Update, context: ContextTypes.DEFAULT_TYPE):
query = update.callback_query
await query.answer()
text = _lucky(update.effective_user.id)
keyboard = [
return_keyboard,
]
reply_markup = InlineKeyboardMarkup(keyboard)
await query.edit_message_text(
text=text, reply_markup=reply_markup
)
return START_ROUTES
# 节点状态
async def menu_node(update: Update, context: ContextTypes.DEFAULT_TYPE):
query = update.callback_query
await query.answer()
text = _node(update.effective_user.id)
keyboard = [
return_keyboard,
]
reply_markup = InlineKeyboardMarkup(keyboard)
await query.edit_message_text(
text=text, parse_mode=ParseMode.HTML, reply_markup=reply_markup
)
return START_ROUTES