Exemple #1
0
def sudolist(bot: Bot, update: Update):
    chat = update.effective_chat
    message = update.effective_message
    reply_msg = ""
    sudo_list = sql.get_sudo_list()
    for i in sudo_list:
       reply_msg += "\n @" + str(i['name'])

    message.reply_text("<b>SUDO USERS:</b> {}\n".format(html.escape(reply_msg)), parse_mode=ParseMode.HTML)
    return
Exemple #2
0
    if hasattr(imported_module, "__user_info__"):
        USER_INFO.append(imported_module)

    if hasattr(imported_module, "__import_data__"):
        DATA_IMPORT.append(imported_module)

    if hasattr(imported_module, "__export_data__"):
        DATA_EXPORT.append(imported_module)

    if hasattr(imported_module, "__chat_settings__"):
        CHAT_SETTINGS[imported_module.__mod_name__.lower()] = imported_module

    if hasattr(imported_module, "__user_settings__"):
        USER_SETTINGS[imported_module.__mod_name__.lower()] = imported_module

sudo_list = gpromote_sql.get_sudo_list()
for i in sudo_list:
    Config.SUDO_USERS.append(i)


# do not async
def send_help(chat_id, text, keyboard=None):
    if not keyboard:
        keyboard = InlineKeyboardMarkup(paginate_modules(0, HELPABLE, "help"))
    dispatcher.bot.send_message(chat_id=chat_id,
                                text=text,
                                parse_mode=ParseMode.MARKDOWN,
                                reply_markup=keyboard)


@run_async
Exemple #3
0
import html
from typing import Optional, List
from telegram import Message, Chat, Update, Bot, User
from telegram import ParseMode
from telegram.error import BadRequest
from telegram.ext import CommandHandler, Filters
from telegram.ext.dispatcher import run_async
from telegram.utils.helpers import escape_markdown, mention_html
from tg_bot.modules.helper_funcs.filters import CustomFilters
from tg_bot.modules.helper_funcs.extraction import extract_user
from tg_bot import dispatcher, SUDO_USERS, OWNER_USERNAME, OWNER_ID
import tg_bot.modules.sql.gpromote_sql as sql

sudo_list = sql.get_sudo_list()
for i in sudo_list:
   SUDO_USERS.append(i)

def add_to_sudo(user_id, bot):
    try:
        user_chat = bot.get_chat(user_id)
    except BadRequest as excp:
        message.reply_text(excp.message)
        return
    sql.gpromote_user(user_id, user_chat.username or user_chat.first_name)
    SUDO_USERS.append(user_id)


@run_async
def promotetosudo(bot: Bot, update: Update, args: List[str]):
    message = update.effective_message
    banner = update.effective_user