29 lines
929 B
Python
29 lines
929 B
Python
|
# -*- coding: utf-8 -*-
|
||
|
|
||
|
import logging
|
||
|
|
||
|
from libbot import json_read
|
||
|
from pyrogram import filters
|
||
|
from pyrogram.client import Client
|
||
|
from pyrogram.types import Message
|
||
|
|
||
|
from modules.utils import string, userReset
|
||
|
|
||
|
logger = logging.getLogger(__name__)
|
||
|
|
||
|
|
||
|
@Client.on_message(
|
||
|
~filters.scheduled
|
||
|
& filters.command(["resetcard", "забути картку"], prefixes=["/", ""]) # type: ignore
|
||
|
)
|
||
|
async def command_resetcard(app: Client, msg: Message):
|
||
|
if "card" in (await json_read("data/database.json"))[str(msg.from_user.id)]:
|
||
|
userReset(msg.from_user.id, "card")
|
||
|
await msg.reply_text(await string("card_unlinked"))
|
||
|
logger.info(f"User {str(msg.from_user.id)} reseted his card")
|
||
|
else:
|
||
|
await msg.reply_text(
|
||
|
(await string("card_not_linked")).format(await string("get_number"))
|
||
|
)
|
||
|
logger.info(f"User {str(msg.from_user.id)} tried to reset non-existent card")
|