From 52d3985ec54cf0bf7d2ed7e967af84afbac4a684 Mon Sep 17 00:00:00 2001 From: the-superpirate Date: Tue, 6 Sep 2022 20:15:34 +0300 Subject: [PATCH] - [promotions] Export GitOrigin-RevId: 9450124ab0308c005508e24418e3c1753ea2fdba --- nexus/bot/application.py | 3 ++- nexus/bot/configs/base.yaml | 3 ++- nexus/promotions/BUILD.bazel | 15 +++++++++++++ nexus/promotions/__init__.py | 8 +++++++ nexus/promotions/promotions.yaml | 36 ++++++++++++++++++++++++++++++++ 5 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 nexus/promotions/BUILD.bazel create mode 100644 nexus/promotions/__init__.py create mode 100644 nexus/promotions/promotions.yaml diff --git a/nexus/bot/application.py b/nexus/bot/application.py index 7b815db..1b472e5 100644 --- a/nexus/bot/application.py +++ b/nexus/bot/application.py @@ -33,8 +33,9 @@ class TelegramApplication(AioRootThing): self.promotioner = Promotioner( promotions=get_promotions(), promotion_vars=dict( - related_channel=self.config['telegram']['related_channel'], + mutual_aid_group=self.config['telegram']['mutual_aid_group'], twitter_contact_url=self.config['twitter']['contact_url'], + related_channel=self.config['telegram']['related_channel'], ) ) self.user_manager = UserManager() diff --git a/nexus/bot/configs/base.yaml b/nexus/bot/configs/base.yaml index 285476f..4336080 100644 --- a/nexus/bot/configs/base.yaml +++ b/nexus/bot/configs/base.yaml @@ -100,7 +100,8 @@ telegram: - nexus.bot.handlers.search.SearchEditHandler - nexus.bot.handlers.search.SearchPagingHandler - nexus.bot.handlers.search.InlineSearchHandler + mutual_aid_group: nexus_aaron # Channel that will be shown in /help, /howtohelp and in promotions - related_channel: 'nexus_search' + related_channel: nexus_search twitter: contact_url: https://twitter.com/the_superpirate diff --git a/nexus/promotions/BUILD.bazel b/nexus/promotions/BUILD.bazel new file mode 100644 index 0000000..57f4422 --- /dev/null +++ b/nexus/promotions/BUILD.bazel @@ -0,0 +1,15 @@ +load("@rules_python//python:defs.bzl", "py_library") + +py_library( + name = "promotions", + srcs = glob( + ["**/*.py"], + exclude = ["tests/**"], + ), + data = ["promotions.yaml"], + srcs_version = "PY3", + visibility = ["//visibility:public"], + deps = [ + "//library/configurator", + ], +) diff --git a/nexus/promotions/__init__.py b/nexus/promotions/__init__.py new file mode 100644 index 0000000..4bd76b0 --- /dev/null +++ b/nexus/promotions/__init__.py @@ -0,0 +1,8 @@ +from library.configurator import Configurator + + +def get_promotions(): + return Configurator(['nexus/promotions/promotions.yaml'])['promotions'] + + +promotions = get_promotions() diff --git a/nexus/promotions/promotions.yaml b/nexus/promotions/promotions.yaml new file mode 100644 index 0000000..0c8b20b --- /dev/null +++ b/nexus/promotions/promotions.yaml @@ -0,0 +1,36 @@ +--- + +promotions: + - texts: + en: 💬 The victory of humanity is inevitable + weight: 1 + - texts: + en: 💬 Shall build Standard Template Construct + weight: 1 + - texts: + en: 💬 Gaining knowledge is the only purpose of life + weight: 1 + - texts: + en: 💬 Knowledge cannot belong + weight: 1 + - texts: + en: 💬 Obey the path of discovery + weight: 1 + - texts: + en: 💬 Research is the only and ultimate goal + weight: 1 + - texts: + en: ✋ Have a subscription to paid articles? [Help researchers!](https://t.me/{mutual_aid_group}) + ru: ✋ Есть доступ к платным статьям? [Помоги ученым!](https://t.me/{mutual_aid_group}) + weight: 25 + - texts: + en: ✋ Help us, become a seeder of books. Learn how in /seed + ru: ✋ Сохрани наследие, раздавай книги нуждающимся. Узнай как в /seed + weight: 25 + - texts: + en: ⤴️ Stay tuned with us at @{related_channel} and [Twitter]({twitter_contact_url}) + es: ⤴️ Mantente en contacto con nosotros en @{related_channel} y [Twitter]({twitter_contact_url}) + it: ⤴️ Resta aggiornato con noi su @{related_channel} e [Twitter]({twitter_contact_url}) + pb: ⤴️ Fique ligado conosco em @{related_channel} e [Twitter]({twitter_contact_url}) + ru: ⤴️ Оставайся на связи с нами на @{related_channel} и в [Twitter]({twitter_contact_url}) + weight: 25