From 7bcb2aed36a1fefd590525f15af398ff955a4c2f Mon Sep 17 00:00:00 2001 From: Davide Depau Date: Sun, 28 Jan 2018 02:07:52 +0100 Subject: [PATCH] Add help command --- callmebyyourbot/__init__.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/callmebyyourbot/__init__.py b/callmebyyourbot/__init__.py index f926608..621f2d3 100644 --- a/callmebyyourbot/__init__.py +++ b/callmebyyourbot/__init__.py @@ -4,6 +4,17 @@ from typing import Sequence, AnyStr from depytg import types, methods, errors PHOTOS = ('http://filmmakermagazine.com/wp-content/uploads/2017/10/t-call-me-by-your-name.jpg',) +HELP_TEXT = """A bot that sends a picture of Elio whenever somebody types #TeamElio +Made with ❤ by @Depaulicious 🏳️‍🌈 + +Source code: https://git.depau.eu/Depaulicious/CallMeByYourBot +Based on DepyTG: https://github.com/Depaulicious/DepyTG""" + + +def send_help(token: AnyStr, msg: types.Message): + send_msg = methods.sendMessage(msg.chat.id, HELP_TEXT) + send_msg.reply_to_message_id = msg.message_id + send_msg(token) def parse_message(token: AnyStr, msg: types.Message): @@ -16,6 +27,12 @@ def parse_message(token: AnyStr, msg: types.Message): send_photo.photo = random.choice(PHOTOS) send_photo.caption = "#TeamElio" send_photo(token) + elif "/help" in msg.text: + if "group" in msg.chat.type: + username = methods.getMe()(token).username + if msg.text != "/help@{}".format(username): + return + send_help(token, msg) def parse_update(token: AnyStr, update: types.Update) -> int: