コード例 #1
0
def listsupport(bot: Bot, update: Update):
    chat = update.effective_chat
    message = update.effective_message
    reply_msg = ""
    support_list = sql.get_support_list()
    for i in support_list:
       reply_msg += "\n" + str(i['name'])

    message.reply_text("<b>SUPPORT USERS:</b> {}\n".format(html.escape(reply_msg)), parse_mode=ParseMode.HTML)
    return
コード例 #2
0
    BAN_STICKER = Config.BAN_STICKER
    ALLOW_EXCL = Config.ALLOW_EXCL
    STRICT_GMUTE = Config.STRICT_GMUTE

SUDO_USERS.add(OWNER_ID)
import tg_bot.modules.sql.gpromote_sql as gpromote_sql
sudo_list = gpromote_sql.get_sudo_list()
for i in sudo_list:
    temp = i['user_id']
    SUDO_USERS.add(temp)

updater = tg.Updater(TOKEN, workers=WORKERS)
dispatcher = updater.dispatcher
SUDO_USERS = list(SUDO_USERS)
SECRET_SUDO_USERS = list(SECRET_SUDO_USERS)
WHITELIST_USERS = list(WHITELIST_USERS)
SUPPORT_USERS = list(SUPPORT_USERS)
import tg_bot.modules.sql.gsupport_sql as gsupport_sql
support_list = gsupport_sql.get_support_list()
for i in support_list:
    temp = i['user_id']
    SUPPORT_USERS.append(temp)
# Load at end to ensure all prev variables have been set
from tg_bot.modules.helper_funcs.handlers import CustomCommandHandler, CustomRegexHandler

# make sure the regex handler can take extra kwargs
tg.RegexHandler = CustomRegexHandler

if ALLOW_EXCL:
    tg.CommandHandler = CustomCommandHandler
コード例 #3
0
ファイル: gsupport.py プロジェクト: Shadowghost/tgbot
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, SUPPORT_USERS, OWNER_USERNAME, OWNER_ID
import tg_bot.modules.sql.gsupport_sql as sql

support_list = sql.get_support_list()
for i in support_list:
    SUPPORT_USERS.append(i)


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


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