add shepherd

This commit is contained in:
2020-01-24 13:12:46 +03:00
parent f38fce1550
commit 5b86c49447
7 changed files with 127 additions and 112 deletions
+9 -1
View File
@@ -22,7 +22,7 @@ from config import BOT_TOKEN, SENTRY_DSN, MANAGEMENT_CHAT, DEBUG
from db import get_conn, Subscriber, PersistentMapping, commit
from morj import draw_morj
from send_users_list import send_users_list
from shepherd import draw_shepherd
logging.basicConfig(level=logging.WARNING)
queue = Queue()
@@ -246,6 +246,14 @@ def morj(bot: Bot, update: Update):
os.unlink(fname)
def shepherd(bot: Bot, update: Update):
text = update.effective_message.text[10:]
fname = '/tmp/shepherd{}.png'.format(uuid4())
draw_shepherd(text, fname)
update.effective_message.reply_photo(open(fname, 'rb'))
os.unlink(fname)
def _process_message(bot: Bot, m: Message):
if m.sticker or m.animation:
delta = datetime.now() - conn.root.last_media