forked from JosXa/BotListBot
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhelp.py
More file actions
68 lines (55 loc) · 2.4 KB
/
Copy pathhelp.py
File metadata and controls
68 lines (55 loc) · 2.4 KB
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
import captions
import const
import helpers
import settings
import util
from actions import Actions
from dialog import messages
from flow.actionbutton import ActionButton
from flow.context import FlowContext
from helpers import reroute_private_chat
from telegram import InlineKeyboardButton, Update
from telegram import InlineKeyboardMarkup
from telegram import ParseMode
from telegram.ext import ConversationHandler, CallbackContext
from models import track_activity
from util import track_groups
def available_commands(bot, update):
update.message.reply_text('*Available commands:*\n' + helpers.get_commands(), parse_mode=ParseMode.MARKDOWN)
@track_groups
@track_activity('command', 'help')
def help(update: Update, context: FlowContext):
mid = update.effective_message.message_id
cid = update.effective_chat.id
context.bot.send_or_edit(cid, messages.HELP_MESSAGE_ENGLISH, to_edit=mid, reply_markup=_help_markup())
return ConversationHandler.END
@track_activity('command', 'contributing')
def contributing(update: Update, context: FlowContext):
mid = update.effective_message.message_id
cid = update.effective_chat.id
context.bot.send_or_edit(cid, messages.CONTRIBUTING, to_edit=mid, reply_markup=_help_markup())
return ConversationHandler.END
@track_activity('command', 'examples')
def examples(update: Update, context: FlowContext):
mid = update.effective_message.message_id
cid = update.effective_chat.id
context.bot.send_or_edit(cid, messages.EXAMPLES, to_edit=mid, reply_markup=_help_markup())
return ConversationHandler.END
@track_activity('command', 'rules')
def rules(update: Update, context: FlowContext, quote=True):
chat_id = update.effective_chat.id
if chat_id == settings.BOTLISTCHAT_ID or util.is_private_message(update):
reroute_private_chat(context.bot, update, quote, const.DeepLinkingActions.RULES, messages.BOTLISTCHAT_RULES)
else:
update.message.reply_text("Sorry, but I don't know the rules in this group 👻\n\n" + messages.PROMOTION_MESSAGE,
parse_mode=ParseMode.MARKDOWN)
return ConversationHandler.END
def _help_markup():
buttons = [[
ActionButton(Actions.HELP),
ActionButton(Actions.CONTRIBUTING),
ActionButton(Actions.EXAMPLES),
], [
InlineKeyboardButton('Try me inline!', switch_inline_query_current_chat='')
]]
return InlineKeyboardMarkup(buttons)