all repos — python-meme-bot @ 881781f58f4949319ef6afcbd6421c43e8a6ae24

Telegram Bot that uses PIL to compute light image processing.

python_meme_bot/effects/checks.py (view raw)

 1
 2def tt_check(info):
 3    reply = info['reply']['text']
 4    content = info['content']['text']
 5
 6    input_text = f"{reply} {content}".replace("\n", " ")
 7
 8    if input_text.strip() == "":
 9        return None
10
11    return input_text
12
13
14def ttbt_check(info):
15    reply = info['reply']['text'].strip()
16    content = info['content']['text'].strip()
17
18    if len(content.split("\n")) > 1:
19        input_text = content
20    else:
21        input_text = f"{reply}\n{content}"
22
23    if input_text.strip() == "":
24        return None
25
26    return input_text
27
28
29def splash_check(info):
30    reply = info['reply']['text']
31    content = info['content']['text']
32
33    if content.strip() == "":
34        author = info['reply']['author']
35        input_text = f"{author}\n{reply}"
36    else:
37        author = info['content']['author']
38        input_text = f"{author}\n{content}"
39
40    if len(input_text.strip().split("\n")) < 2:
41        return None
42
43    return input_text
44
45
46def wot_check(info):
47    reply = info['reply']['text']
48    content = info['content']['text']
49
50    input_text = f"{reply}\n{content}"
51
52    if input_text.strip() == "":
53        return None
54
55    return input_text