Skip to content

Instantly share code, notes, and snippets.

@HueRtx
Created May 31, 2022 12:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HueRtx/09cd68b5e6f543e3edf898cb631c5d33 to your computer and use it in GitHub Desktop.
Save HueRtx/09cd68b5e6f543e3edf898cb631c5d33 to your computer and use it in GitHub Desktop.
__version__ = (0, 1, 0)
""""
___ _ _ _
| __| |___ __| |_ _ __ _| |_
| _|| / _ \/ _` | || / _` | _|
|_| |_\___/\__,_|\_,_\__,_|\__|
GPL v3.0, this module opensource
"""
# requires: qiwipy
# scope: hikka_only
# meta developer: @Alobzbz, @shadow_hikka
import logging
from .. import loader, utils, main
from typing import Union
import pyqiwi
from ..inline.types import InlineCall
from ..inline.types import InlineQuery
from telethon.tl.types import Message
logger = logging.getLogger(__name__)
class QiwiBalanceMod(loader.Module):
strings = {
"name": "QiwiBalance",
"noapi": "<b>😰 API token not specified, used in </b><code>.config</code>",
"nonumber": "<b>😥 Phone number not specified, please specify in </b><code>.config</code>",
}
strings_ru = {
"noapi": "<b>😰 Токен API не указан, укажите в </b><code>.config</code>",
"nonumber": "<b>😥 Номер телефона не указан, укажите в </b><code>.config</code>",
}
def __init__(self):
self.config = loader.ModuleConfig(
loader.ConfigValue(
"qiwitoken",
None,
lambda: "Ваш QIWI API токен",
),
loader.ConfigValue(
"phonenumber",
None,
lambda: "Ваш номер телефона привязанный к QIWI",
),
)
@loader.unrestricted
async def qwbalcmd(self, message: Message):
"""
Get balance
"""
wallet = pyqiwi.Wallet(
token={self.config["qiwitoken"]}, number={self.config["phonenumber"]}
)
if self.config["qiwitoken"] is None:
await utils.answer(
message,
"<b>Токен API не указан, укажите в </b><code>.config</code>",
)
else:
await utils.answer(message, f"Баланс киви {wallet.balance()}")
if self.config["phonenumber"] is None:
await utils.answer(
message,
"<b>😥 Номер телефона не указан, укажите в </b><code>.config</code>",
)
else:
await utils.answer(message, f"Баланс киви {wallet.balance()}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment