Add more hashtags

This commit is contained in:
Davide Depau 2018-01-29 22:16:30 +01:00
parent 5c5bbe3abb
commit 7c7dd8fbba
Signed by: depau
GPG Key ID: C7D999B6A55EFE86
1 changed files with 31 additions and 19 deletions

View File

@ -3,15 +3,22 @@ import traceback
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',
'https://s9.postimg.org/p89n5hzz3/photo_2018-01-29_21-47-01.jpg',
'https://s9.postimg.org/hsadjpjzj/photo_2018-01-29_21-47-11.jpg',
'https://s9.postimg.org/50w7d7xcv/photo_2018-01-29_21-47-17.jpg',
'https://s9.postimg.org/iht5w2s8v/photo_2018-01-29_21-47-24.jpg',
'https://s9.postimg.org/r02m0f6hb/photo_2018-01-29_21-47-32.jpg',
'https://s9.postimg.org/dvx1nqtv3/photo_2018-01-29_21-47-39.jpg'
)
HASHTAGS = {
"#TeamElio": (
'https://s9.postimg.org/p89n5hzz3/photo_2018-01-29_21-47-01.jpg',
'https://s9.postimg.org/hsadjpjzj/photo_2018-01-29_21-47-11.jpg',
'https://s9.postimg.org/50w7d7xcv/photo_2018-01-29_21-47-17.jpg',
'https://s9.postimg.org/iht5w2s8v/photo_2018-01-29_21-47-24.jpg',
'https://s9.postimg.org/dvx1nqtv3/photo_2018-01-29_21-47-39.jpg',
),
"#TeamOliver": (
'http://filmmakermagazine.com/wp-content/uploads/2017/10/t-call-me-by-your-name.jpg',
'https://s9.postimg.org/r02m0f6hb/photo_2018-01-29_21-47-32.jpg',
),
"#CuloDiElio": (
'https://s9.postimg.org/dvx1nqtv3/photo_2018-01-29_21-47-39.jpg',
)
}
HELP_TEXT = """A bot that sends a picture of Elio whenever somebody types #TeamElio
Made with by @Depaulicious 🏳🌈
@ -31,18 +38,23 @@ def parse_message(token: AnyStr, msg: types.Message):
if not 'text' in msg:
return
if '#TeamElio' in msg.text:
send_photo = methods.sendPhoto(chat_id=msg.chat.id)
send_photo.reply_to_message_id = msg.message_id
send_photo.photo = random.choice(PHOTOS)
send_photo.caption = "#TeamElio"
send_photo(token)
elif "/help" in msg.text:
if "/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)
if msg.text == "/help@{}".format(username):
send_help(token, msg)
elif msg.text == "/help":
send_help(token, msg)
for hashtag in HASHTAGS:
if hashtag.lower() in msg.text.lower():
send_photo = methods.sendPhoto(chat_id=msg.chat.id)
send_photo.reply_to_message_id = msg.message_id
send_photo.photo = random.choice(HASHTAGS[hashtag])
send_photo.caption = hashtag
send_photo(token)
def parse_update(token: AnyStr, update: types.Update) -> int: