Add help command

This commit is contained in:
Davide Depau 2018-01-28 02:07:52 +01:00
parent b7cd25cb46
commit 7bcb2aed36
Signed by: depau
GPG key ID: C7D999B6A55EFE86

View file

@ -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: