Conditions | 6 |
Total Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Changes | 4 | ||
Bugs | 0 | Features | 1 |
1 | #!/usr/bin/python |
||
13 | def meme(bot, update): |
||
14 | meme_splitter = "@" |
||
15 | if update.message.reply_to_message is not None: |
||
16 | initial_text = "".join(update.message.text[6:]).upper() |
||
17 | else: |
||
18 | initial_text = "".join(update.message.caption[6:]).upper() |
||
19 | split_text = initial_text.split(meme_splitter) |
||
20 | try: |
||
21 | get_image(bot, update, meme_folder) |
||
22 | except: |
||
23 | update.message.reply_text("Can't get the image! :(") |
||
24 | return |
||
25 | if split_text[0] == "": |
||
26 | update.message.reply_text("Type in some text!") |
||
27 | return |
||
28 | elif len(split_text) > 1: |
||
29 | make_meme(split_text[0], split_text[1], meme_folder+"original.jpg") |
||
30 | else: |
||
31 | make_meme("", split_text[0], meme_folder+"original.jpg") |
||
32 | with open(meme_folder+"meme.jpg", "rb") as f: |
||
33 | update.message.reply_photo(f) |
||
34 | print (datetime.datetime.now(), ">>>", "Done meme", ">>>", |
||
35 | update.message.from_user.username) |