예제 #1
0
 def handle_keywords(self, message):
     text = 'keywords command'
     btn1 = btn('Зафиксировать местоимения, предлоги и пр.', callback_data=cn.kf_fixate_keywords)
     btn2 = btn('Сгруппировать неявные дубли', callback_data=cn.kf_group_duplicates)
     markup = types.InlineKeyboardMarkup(row_width=1)
     markup.add(btn1, btn2)
     self.send_message(message.chat.id, text=text, reply_markup=markup)
예제 #2
0
    def ch_list(self, user_id):
        channels = self.db.get_channel_id(user_id)

        ch_list = markup()
        ch_list.add(btn(text=ru['back'], callback_data='open main'),
                    btn(text=ru['add'], callback_data='open ch_add'))
        if not channels:
            return ru['ch_list_empty'], ch_list

        for ch in channels:
            try:
                try:
                    self.bot.get_chat(ch[0])
                    name = ch[1] + ' | ❌ OFF' if ch[2] == 'off' else ch[1]
                except Exception as e:
                    print('Error getchat: ', e)
                    name = ch[1] + ' | Не админ'

                ch_list.add(
                    btn(text=name,
                        callback_data='open ch_sett $ch_id=' + str(ch[0])))

            except Exception as e:
                print('Error create btns: ', e)

        return ru['list_ch'], ch_list
예제 #3
0
 def handle_vk(self, message):
     text = 'VK command'
     btn1 = btn('Получить id страницы VK по URL', callback_data=cn.vk_get_user_id_by_url)
     btn2 = btn('Собрать все группы участников группы', callback_data=cn.vk_get_common_groups_by_url)
     markup = types.InlineKeyboardMarkup(row_width=1)
     markup.add(btn1, btn2)
     self.send_message(message.chat.id, text=text, reply_markup=markup)
예제 #4
0
 def handle_actions(self, message):
     text = 'actions command'
     btn1 = btn('Предложить идею', callback_data=cn.act_feedback)
     #btn2 = btn('Проверить статус задач', callback_data=cn.act_get_user_queries)
     btn3 = btn('Связаться с разработчиком', callback_data=cn.act_give_contacts)
     markup = types.InlineKeyboardMarkup(row_width=1)
     markup.add(btn1, btn3)
     self.send_message(message.chat.id, text=text, reply_markup=markup)
예제 #5
0
 def handle_admin(self, message):
     if message.chat.id != 144581052:
         self.send_message(message.chat.id, text='Ты не мой хозяин!')
         return
     text = 'admin command'
     btn1 = btn('📣 - Дать сообщение всем', callback_data=cn.af_make_announcement)
     btn2 = btn('📊 - Статистика бота', callback_data=cn.af_get_bot_stats)
     markup = types.InlineKeyboardMarkup(row_width=1)
     markup.add(btn1, btn2)
     self.send_message(message.chat.id, text=text, reply_markup=markup)
예제 #6
0
    def photo_mark(self, user_id):
        photo_id = self.db.get_photo_mark_id(user_id)
        bts = markup()
        bts.add(
            btn(text=ru['back'], callback_data='open ch_sett $is_new=True'),
            btn(text=ru['new'], callback_data='open set_mark $is_new=True'))

        msg_id2 = self.bot.send_document(user_id, photo_id, reply_markup=bts)

        return msg_id2.message_id, None
예제 #7
0
 def help(self, user_id):
     bts = markup()
     bts.add(btn(text=ru['back'], callback_data='open main'))
     bts.add(
         btn(text=ru['instrukt_desktop'],
             callback_data='open instruct_desktop'))
     bts.add(
         btn(text=ru['instrukt_android'],
             callback_data='open instruct_android'))
     #bts.add(btn(text = 'Поддержка', callback_data='open support'))
     return ru['support'], bts
예제 #8
0
    def bot_info(self, user_id):
        count_edited_post = self.db.get_bot_info()

        bts = markup()
        bts.add(btn(text=ru['back'], callback_data='open main'))

        return ru['bot_info'].format(count_edited_post=count_edited_post), bts
예제 #9
0
 def instruct_android(self, user_id):
     bts = markup()
     bts.add(btn(text=ru['back'], callback_data='open help $is_new=True'))
     msg_id = self.bot.send_video(user_id,
                                  'BAADAgADNQMAAiyPeUhFeyeXLMOadQI',
                                  reply_markup=bts)
     return msg_id.message_id, None
예제 #10
0
    def instruct_desktop(self, user_id):
        bts = markup()
        bts.add(btn(text=ru['back'], callback_data='open help $is_new=True'))

        # ============= МАГИЯ НЕ ТРОГАТЬ!!! ======  FILE_ID
        msg_id = self.bot.send_document(user_id,
                                        'CgADAgADPQMAAiyPeUj1Zvh-g7paNwI',
                                        reply_markup=bts)
        # =================================================
        return msg_id.message_id, None
예제 #11
0
 def handle_seo(self, message):
     text = 'seo command'
     btn1 = btn('Проверить список ссылок на доступность и редиректы', callback_data=cn.seo_check_urls_status_code)
     markup = types.InlineKeyboardMarkup(row_width=1)
     markup.add(btn1)
     self.send_message(message.chat.id, text=text, reply_markup=markup)
예제 #12
0
 def welcom(self, user_id):
     bts = markup()
     bts.add(btn(text='OK', callback_data='open main'))
     return ru['welkom_menu'], bts
예제 #13
0
    def color_mark(self, user_id):
        bts = markup()
        bts.add(btn(text=ru['back'], callback_data='open ch_sett'))

        return ru['set_color_mark'], bts
예제 #14
0
 def del_ch_sett(self, user_Id):
     bts = markup()
     bts.add(btn(text=ru['back'], callback_data='open ch_sett'))
     bts.add(btn(text=ru['del'], callback_data='del ch_sett'))
     return ru['del_ch'], bts
예제 #15
0
    def ch_setting(self, user_id):
        bts = markup()
        ch_info = self.db.get_ch(user_id=user_id)

        try:
            title = self.bot.get_chat(ch_info.id).title
            if not title == ch_info.past_name_ch:
                self.db.channel_set(user_id, 'past_name_ch', title)
                ch_info.past_name_ch = title

        except Exception as e:
            print('Error get chat title: ', e)
            bts.add(btn(text=ru['update'], callback_data='open ch_sett'))
            bts.add(btn(text=ru['back'], callback_data='open ch_list'))
            return ru['del_bot'].format(channel_name=ch_info.past_name_ch), bts

        if ch_info.photo_id == 'off' and ch_info.text_mark == 'off':
            bts.add(btn(text=ru['back'], callback_data='open ch_list'))
            self.db.user_set(user_id, 'menu_select', 'set_mark')
            return ru['add_watermark'], bts

        status = '✅' if ch_info.status == 'on' else '❌'
        transparent = str(abs(ch_info.transparent - 100)) + '%'
        bts.add(btn(text=ru['back'], callback_data='open ch_list'),
                btn(text=ru['status'] + status, callback_data='set ch status'))
        bts.add(
            btn(text=ru['size'] + str(ch_info.mark_size) + '%',
                callback_data='open mark_size'),
            btn(text=ru['position'] + self.view_position(ch_info.pos_mark),
                callback_data='open pos_mark'))
        bts.add(
            btn(text='Прозрa-ть: ' + transparent,
                callback_data='open transparent_mark'),
            btn(text=ru['margin'] + str(ch_info.margin_mark) + "px",
                callback_data='open margin_mark'))

        if not ch_info.photo_id == 'off':
            bts.add(
                btn(text=ru['change_mark'], callback_data='open photo_mark'))
        else:
            bts.add(
                btn(text=ru['text'] + ch_info.text_mark,
                    callback_data='open set_mark'))
            bts.add(
                btn(text=ru['color'] + ch_info.color_mark,
                    callback_data='open color_mark'),
                btn(text=ru['font_style'] + ch_info.font_style,
                    callback_data='open font_style '))
        bts.add(btn(text=ru['del_setting'], callback_data='open del_ch_sett'))

        return ru['channel_setting'].format(
            channel_name=ch_info.past_name_ch), bts
예제 #16
0
 def ch_add(self, user_id):
     bts = markup()
     bts.add(btn(text=ru['back'], callback_data='open ch_list'))
     return ru['add_ch'], bts