Spaces:
Running
Running
| #!/usr/bin/env python3 | |
| # -*- coding: utf-8 -*- | |
| # (c) Shrimadhav U K | |
| # the logging things | |
| from pyrogram import enums | |
| import logging | |
| logging.basicConfig(level=logging.DEBUG, | |
| format='%(asctime)s - %(name)s - %(levelname)s - %(message)s') | |
| logger = logging.getLogger(__name__) | |
| import os | |
| import sqlite3 | |
| # the secret configuration specific things | |
| if bool(os.environ.get("WEBHOOK", False)): | |
| from sample_config import Config | |
| else: | |
| from config import Config | |
| # the Strings used for this "thing" | |
| from translation import Translation | |
| #allowed=[359599949] | |
| import pyrogram | |
| logging.getLogger("pyrogram").setLevel(logging.WARNING) | |
| #from helper_funcs.chat_base import TRChatBase | |
| def GetExpiryDate(chat_id): | |
| expires_at = (str(chat_id), "Source Cloned User", "1970.01.01.12.00.00") | |
| #Config.AUTH_USERS.add(683538773) | |
| return expires_at | |
| async def help_user(bot, update): | |
| if update.from_user.id in Translation.ALLOWED: | |
| # logger.info(update) | |
| #TRChatBase(update.from_user.id, update.text, "/help") | |
| await bot.send_message( | |
| chat_id=update.chat.id, | |
| text=Translation.HELP_USER, | |
| parse_mode=enums.ParseMode.HTML, | |
| disable_web_page_preview=True, | |
| reply_to_message_id=update.id | |
| ) | |
| else: | |
| await bot.send_message( | |
| chat_id=update.chat.id, | |
| text=Translation.REPLY_TO_UNALLOWED, | |
| reply_to_message_id=update.id) | |
| async def get_me_info(bot, update): | |
| # logger.info(update) | |
| if update.from_user.id in Translation.ALLOWED: | |
| #TRChatBase(update.from_user.id, update.text, "/me") | |
| chat_id = str(update.from_user.id) | |
| chat_id, plan_type, expires_at = GetExpiryDate(chat_id) | |
| await bot.send_message( | |
| chat_id=update.chat.id, | |
| text=Translation.CURENT_PLAN_DETAILS.format(chat_id, plan_type, expires_at), | |
| parse_mode=enums.ParseMode.HTML, | |
| disable_web_page_preview=True, | |
| reply_to_message_id=update.id | |
| ) | |
| else: | |
| await bot.send_message( | |
| chat_id=update.chat.id, | |
| text=Translation.REPLY_TO_UNALLOWED, | |
| reply_to_message_id=update.id) | |
| async def start(bot, update): | |
| if update.from_user.id in Translation.ALLOWED: | |
| # logger.info(update) | |
| #TRChatBase(update.from_user.id, update.text, "/start") | |
| await bot.send_message( | |
| chat_id=update.chat.id, | |
| text=Translation.START_TEXT, | |
| reply_to_message_id=update.id | |
| ) | |
| else: | |
| await bot.send_message( | |
| chat_id=update.chat.id, | |
| text=Translation.REPLY_TO_UNALLOWED, | |
| reply_to_message_id=update.id) | |
| async def upgrade(bot, update): | |
| # logger.info(update) | |
| if update.from_user.id in Translation.ALLOWED: | |
| #TRChatBase(update.from_user.id, update.text, "/upgrade") | |
| await bot.send_message( | |
| chat_id=update.chat.id, | |
| text=Translation.UPGRADE_TEXT, | |
| parse_mode=enums.ParseMode.HTML, | |
| reply_to_message_id=update.id, | |
| disable_web_page_preview=True | |
| ) | |
| else: | |
| await bot.send_message( | |
| chat_id=update.chat.id, | |
| text=Translation.REPLY_TO_UNALLOWED, | |
| reply_to_message_id=update.id) | |