-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathresources.py
77 lines (67 loc) · 4.15 KB
/
resources.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import random
from aiogram import types
from locales_dict import LocalesDict
from models import PostMode
class QueryResults:
def __init__(self, locales: LocalesDict):
self.locales = locales
def message_too_long(self, lang: str):
message_content = types.InputTextMessageContent(self.locales[lang].too_long_message)
return types.InlineQueryResultArticle(
id = '1', title = self.locales[lang].too_long_title,
input_message_content = message_content,
description = self.locales[lang].too_long_description,
thumb_url = 'https://i.imgur.com/xblMvAx.png')
def mode_for(self, lang: str, post_id, body, scope_string):
keyboard = types.InlineKeyboardMarkup(inline_keyboard =
[[types.InlineKeyboardButton(self.locales[lang].view, callback_data = str(post_id) +
' ' + PostMode.parse_key(PostMode.FOR))]])
message_content = types.InputTextMessageContent(self.locales[lang].for_message % scope_string)
return types.InlineQueryResultArticle(
id = str(PostMode.FOR), title = self.locales[lang].for_title % scope_string,
input_message_content = message_content,
reply_markup = keyboard,
description = body,
thumb_url = 'https://i.imgur.com/hHIkDSu.png')
def mode_except(self, lang: str, post_id, body, scope_string):
keyboard = types.InlineKeyboardMarkup(inline_keyboard =
[[types.InlineKeyboardButton(self.locales[lang].view, callback_data = str(post_id) +
' ' + PostMode.parse_key(PostMode.EXCEPT))]])
message_content = types.InputTextMessageContent(self.locales[lang].except_message % scope_string)
return types.InlineQueryResultArticle(
id = str(PostMode.EXCEPT), title = self.locales[lang].except_title % scope_string,
input_message_content = message_content,
reply_markup = keyboard,
description = body,
thumb_url = 'https://i.imgur.com/S6OZMHd.png')
def mode_spoiler(self, lang: str, post_id, body):
keyboard = types.InlineKeyboardMarkup(inline_keyboard =
[[types.InlineKeyboardButton(self.locales[lang].view, callback_data = str(post_id) +
' ' + PostMode.parse_key(PostMode.SPOILER))]])
message_content = types.InputTextMessageContent(self.locales[lang].spoiler_message)
return types.InlineQueryResultArticle(
id = str(PostMode.SPOILER), title = self.locales[lang].spoiler_title,
input_message_content = message_content,
reply_markup = keyboard,
description = body,
thumb_url = 'https://i.imgur.com/mS2ir0T.png')
class Keyboards:
def info_keyboard(self):
return types.InlineKeyboardMarkup(inline_keyboard=
[[types.InlineKeyboardButton('🇺🇸 English', url='https://teletype.in/@undrcrxwn/hidethisbot_en'),
types.InlineKeyboardButton('🇵🇱 Polski', url='https://teletype.in/@undrcrxwn/hidethisbot_pl')],
[types.InlineKeyboardButton('🇷🇺 Русский', url='https://teletype.in/@undrcrxwn/hidethisbot_ru'),
types.InlineKeyboardButton('🇺🇦 Українська', url='https://teletype.in/@undrcrxwn/hidethisbot_ua')],
[types.InlineKeyboardButton('🇮🇹 Italiano', url='https://teletype.in/@undrcrxwn/hidethisbot_it'),
types.InlineKeyboardButton('🇨🇿 Čeština', url='https://teletype.in/@undrcrxwn/hidethisbot_cz')],
[types.InlineKeyboardButton('🇪🇸 Español', url='https://teletype.in/@undrcrxwn/hidethisbot_es')]])
class Media:
def group_greeting_sticker_id(self):
return random.choice(('CAACAgIAAxkBAAECkihg7Y5tYnlKz9jRe6QCNOyvEZri2wACSQ4AAliyaUuDPYCgY_2GXiAE',
'CAACAgIAAxkBAAECkilg7Y5tzJPtIX4UMDgYaoxD6zcrogAC8Q0AAvMraEvkpXQDG5qEbyAE',
'CAACAgIAAxkBAAECkipg7Y5tQk6MZlccqoudX9PEnxPbUwACfBAAAhJpcEuU9SdfdRAPdiAE'))
class Resources:
def __init__(self, locales: LocalesDict):
self.query_results = QueryResults(locales)
self.keyboards = Keyboards()
self.media = Media()