This repository has been archived on 2024-08-21. You can view files and clone it, but cannot push or open issues or pull requests.
BWTAqua/plugins/commands/topup.py

31 lines
939 B
Python

import logging
from pyrogram import filters
from pyrogram.types import Message
from classes.pyroclient import PyroClient
logger = logging.getLogger(__name__)
@PyroClient.on_message(
~filters.scheduled
& filters.command(["topup", "refill", "поповнити"], prefixes=["/", ""]) # type: ignore
)
async def command_topup(app: PyroClient, message: Message):
user = await app.find_user(message.from_user)
if user.card is None:
logger.info("User %s tried to get card's top-up link, but it's null", user.id)
await message.reply_text(
app._("card_not_linked", "messages", locale=user.locale).format(
notice=app._("get_number", "messages", locale=user.locale)
)
)
return
logger.info("User %s requested top-up link", user.id)
await message.reply_text(
app._("top_up", "messages", locale=user.locale).format(card_id=user.card)
)