Beispiel #1
0
def terms_of_use_f(**kwargs):
    markup = get_terms_of_use_markup()
    if 'id' in kwargs:
        db.set_state(kwargs['id'], terms_of_use)
        for file_id, caption in db.get_termsofuse_files():
            bot.send_document(chat_id=kwargs['id'],
                              data=file_id,
                              caption=caption,
                              reply_markup=markup)
Beispiel #2
0
def search_magnet(message):
    all_part_magnet = part_magnet.search(message.text)
    if all_part_magnet is None:
        raise NoResultError()
    with SearchDB('main.db') as d:
        res = d.magnet(all_part_magnet.group().lower())
    res_file = query_response(res,
                              exc_type=MagnetNoReuslt,
                              query=all_part_magnet.group())
    bot.send_document(message.chat.id, res_file, caption='执行成功,并返回查询结果')
Beispiel #3
0
def search_tag(message):
    tags = []
    for entity in message.entities:
        if entity.type == 'hashtag':
            start, end = entity.offset + 1, entity.offset + entity.length
            tags.append(message.text[start:end].lower())
    with SearchDB('main.db') as d:
        res = d.tag(tags)
    res_file = query_response(res, exc_type=TagNoResult, query=tags)
    bot.send_document(message.chat.id, res_file, caption='执行成功,并返回查询结果')
Beispiel #4
0
def intro_2_f(**kwargs):
    if 'id' in kwargs and 'state' in kwargs:
        if kwargs['state'] < menu:
            # print(bot.send_document(kwargs['id'], open('Презентация.pdf', 'rb')), 'Презентация.pdf')
            for file_id, caption in db.get_presentation_files():
                bot.send_document(chat_id=kwargs['id'],
                                  data=file_id,
                                  caption=caption,
                                  reply_markup=get_intro_2_markup())
            #bot.send_document(kwargs['id'], 'BQADAgADFQIAAn8ZCEpzWvPIxfNrGgI')
            db.set_state(kwargs['id'], intro_2)
Beispiel #5
0
def exec_sql(message):
    try:
        with db.Handler('main.db') as d:
            sql = message.text[5:]
            d.cursor.execute(sql)
            res = d.cursor.fetchall()
    except Exception as e:
        logger.warning(e)
        traceback.print_exc()
        bot.send_message(message.chat.id, 'SQL 执行遇到失败,数据库已回滚')
    else:
        res_file = query_response(res, exc_type=NoResultError, query=sql)
        bot.send_document(message.chat.id, res_file, caption='执行成功,并返回查询结果')
Beispiel #6
0
 def logs(m):  ##№
     if bot.get_chat_member(m.chat.id, m.from_user.id).status in [
             "administrator", "creator"
     ]:
         bot.delete_message(m.chat.id, m.message_id)
         keyboard = types.InlineKeyboardMarkup()
         keyboard_delete = types.InlineKeyboardButton(
             text="❌", callback_data="delete")
         keyboard.add(keyboard_delete)
         FILE = open("/app/plugins/log-error.txt", "rb")
         bot.send_document(m.chat.id,
                           FILE,
                           reply_markup=keyboard,
                           parse_mode="Markdown")
         FILE.close()
     else:
         Error(m, bot).error_permission()
Beispiel #7
0
def proxy(m):
    bot.delete_message(m.chat.id, m.message_id)
    try:
        keyboard = types.InlineKeyboardMarkup()
        keyboard_delete = types.InlineKeyboardButton(text="❌",
                                                     callback_data="delete")
        keyboard.add(keyboard_delete)

        url = requests.get('https://us-proxy.org/')
        soup = BeautifulSoup(url.text, features="lxml")
        text = soup.find('textarea', class_='form-control')

        FILE = open("/app/plugins/proxy_list", "r+")
        print(text, file=FILE)
        FILE.close()

        FILE = open("/app/plugins/proxy_list", "r+")
        bot.send_document(m.chat.id, FILE, reply_markup=keyboard)
    except:
        Error(m, bot).error()
Beispiel #8
0
def learning_f(**kwargs):
    if 'id' in kwargs:
        db.set_state(kwargs['id'], learning)
        #bot.send_message(kwargs['id'], msgs.learning, reply_markup=get_learning_markup())
        for file_id, caption in db.get_signal_files():
            bot.send_document(chat_id=kwargs['id'],
                              data=file_id,
                              caption=caption,
                              reply_markup=get_learning_markup())
        bot.send_message(
            kwargs['id'], '''Как делать ставку в приложении 1xBet
            https://youtu.be/a6QEXixoj9o
            ''')
        bot.send_message(
            kwargs['id'], '''Как установить приложение 1xbet на IOS
            https://youtu.be/OFGabxNqTqc
            ''')
        bot.send_message(
            kwargs['id'], '''Как установить приложение 1xbet на ANDROID
            https://youtu.be/gU-l1yFRpUQ
            ''')
Beispiel #9
0
def get_file_id(filename):
    return bot.send_document(128109574, open(filename, 'rb')).document.file_id
Beispiel #10
0
def learning_2_f(**kwargs):
    if 'id' in kwargs:
        for file_id, caption in db.get_franchise_files():
            bot.send_document(chat_id=kwargs['id'],
                              data=file_id,
                              caption=caption)
Beispiel #11
0
def msg_info(message):
    f = StringIO()
    f.name = "Response.txt"
    json.dump(message, f, default=lambda obj: obj.__dict__)
    f.seek(0)
    bot.send_document(const.GOD, f)