generated from zhanymkanov/fastapi_production_template
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
85 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from datetime import datetime | ||
|
||
from prefect import flow | ||
from telegram.constants import ParseMode | ||
|
||
from src import localizer | ||
from src.tgbot.bot import bot | ||
from src.tgbot.handlers.treasury.constants import PAYOUTS, TrxType | ||
from src.tgbot.handlers.treasury.payments import pay_if_not_paid | ||
from src.tgbot.logs import log | ||
from src.tgbot.user_info import get_user_info | ||
|
||
|
||
@flow | ||
async def reward_user_for_daily_activity(user_id: int): | ||
user_info = await get_user_info(user_id) | ||
if user_info["memes_watched_today"] == 10: | ||
res = await pay_if_not_paid( | ||
user_id, | ||
TrxType.DAILY_REWARD, | ||
external_id=datetime.today().strftime("%Y-%m-%d"), | ||
) | ||
if res: | ||
msg = ( | ||
localizer.t( | ||
"rewards.daily_reward", | ||
user_info["interface_lang"], | ||
).format(amount=PAYOUTS[TrxType.DAILY_REWARD]), | ||
) | ||
await bot.send_message( | ||
user_id, | ||
msg, | ||
parse_mode=ParseMode.HTML, | ||
) | ||
await log(msg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
rewards.daily_reward: | ||
en: |- | ||
💳 /b: +<b>{amount} 🍔</b>. It's your daily reward for watching memes ❤️ | ||
ru: |- | ||
💳 /b: +<b>{amount} 🍔</b> за то, что посмотрели мемы сегодня ❤️ | ||
uk: |- | ||
💳 /b: +<b>{amount} 🍔</b> за те, що переглянули меми сьогодні ❤️ | ||
kz: |- | ||
💳 /b: +<b>{amount} 🍔</b> бұл сіздің мемелерді көру үшін күндізгі мүшелеріңіз ❤️ | ||
be: |- | ||
💳 /b: +<b>{amount} 🍔</b> за тое, што паглядзелі мемы сёння ❤️ | ||
kk: |- | ||
💳 /b: +<b>{amount} 🍔</b> сіздің мемелерді көру үшін күндізгі мүшелеріңіз ❤️ | ||
uz: |- | ||
💳 /b: +<b>{amount} 🍔</b>. Siz bugungi kunda memlarni ko'rganingiz uchun ❤️ | ||
tr: |- | ||
💳 /b: +<b>{amount} 🍔</b>. Bugün memelere baktığınız için ❤️ | ||
es: |- | ||
💳 /b: +<b>{amount} 🍔</b>. Es tu recompensa diaria por ver memes ❤️ | ||
pt-br: |- | ||
💳 /b: +<b>{amount} 🍔</b>. É a sua recompensa diária por ver memes ❤️ | ||
pl: |- | ||
💳 /b: +<b>{amount} 🍔</b>. To twoja codzienna nagroda za oglądanie memów ❤️ | ||
de: |- | ||
💳 /b: +<b>{amount} 🍔</b>. Es ist deine tägliche Belohnung für das Ansehen von Memes ❤️ | ||
fr: |- | ||
💳 /b: +<b>{amount} 🍔</b>. C'est votre récompense quotidienne pour avoir regardé des mèmes ❤️ | ||
id: |- | ||
💳 /b: +<b>{amount} 🍔</b>. Ini adalah hadiah harian Anda untuk menonton meme ❤️ | ||
ar: |- | ||
💳 /b: +<b>{amount} 🍔</b>. إنها مكافأتك اليومية لمشاهدة الصور الساخرة ❤️ | ||
fa: |- | ||
💳 /b: +<b>{amount} 🍔</b>. این پاداش روزانه شما برای تماشای میمهاست ❤️ | ||
ja: |- | ||
💳 /b: +<b>{amount} 🍔</b>。これはミームを見るための毎日の報酬です ❤️ | ||
zh: |- | ||
💳 /b: +<b>{amount} 🍔</b>。这是您每天观看表情包的奖励 ❤️ | ||
ko: |- | ||
💳 /b: +<b>{amount} 🍔</b>. 미미를 보는 것에 대한 매일 보상입니다 ❤️ | ||
vi: |- | ||
💳 /b: +<b>{amount} 🍔</b>. Đây là phần thưởng hàng ngày của bạn vì đã xem meme ❤️ | ||