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
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
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
def main(): bts = markup(row_width=1) list_group = button(text="Список каналов", callback_data='open ch_list') help = button(text="Помощь", callback_data='open help') info = button(text="О боте", callback_data='open bot_info') bts.add(list_group, help, info) return bts
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
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
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
def mark_size(): bts = markup() bts.add(button(text='⬅️ Назад', callback_data='open ch_sett'), button(text='7%', callback_data='set ch mark_size 7'), button(text='9%', callback_data='set ch mark_size 9')) bts.add(button(text='11%', callback_data='set ch mark_size 11'), button(text='13%', callback_data='set ch mark_size 13'), button(text='15%', callback_data='set ch mark_size 15')) bts.add(button(text='18%', callback_data='set ch mark_size 18'), button(text='22%', callback_data='set ch mark_size 22'), button(text='28%', callback_data='set ch mark_size 28')) return bts
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
def transparent_mark(): bts = markup() bts.add(button(text='⬅️ Назад', callback_data='open ch_sett')) bts.add(button(text='0%', callback_data='set ch transparent_mark 100'), button(text='5%', callback_data='set ch transparent_mark 95'), button(text='10%', callback_data='set ch transparent_mark 90')) bts.add(button(text='15%', callback_data='set ch transparent_mark 85'), button(text='20%', callback_data='set ch transparent_mark 80'), button(text='25%', callback_data='set ch transparent_mark 75')) bts.add(button(text='40%', callback_data='set ch transparent_mark 60'), button(text='50%', callback_data='set ch transparent_mark 50'), button(text='60%', callback_data='set ch transparent_mark 40')) return bts
def margin_mark(): bts = markup() bts.add(button(text='⬅️ Назад', callback_data='open ch_sett')) bts.add(button(text='0 px', callback_data='set ch margin_mark 0'), button(text='1 px', callback_data='set ch margin_mark 1'), button(text='2 px', callback_data='set ch margin_mark 2')) bts.add(button(text='3 px', callback_data='set ch margin_mark 3'), button(text='5 px', callback_data='set ch margin_mark 5'), button(text='7 px', callback_data='set ch margin_mark 7')) bts.add(button(text='10 px', callback_data='set ch margin_mark 10'), button(text='15 px', callback_data='set ch margin_mark 15'), button(text='20 px', callback_data='set ch margin_mark 20')) return bts
def pos_mark(): bts = markup() bts.add(button(text='⬅️ Назад', callback_data='open ch_sett')) bts.add(button(text='↖️', callback_data='set ch position_mark top_left'), button(text='⬆️', callback_data='set ch position_mark top'), button(text='↗️', callback_data='set ch position_mark top_right')) bts.add( button(text='⬅️', callback_data='set ch position_mark center_left'), button(text='⬛', callback_data='set ch position_mark center'), button(text='➡️', callback_data='set ch position_mark center_right')) bts.add(button(text='↙️', callback_data='set ch position_mark down_left'), button(text='⬇️', callback_data='set ch position_mark down'), button(text='↘️', callback_data='set ch position_mark down_right')) return bts
def font_style(): bts = markup() bts.add(button(text='⬅️ Назад', callback_data='open ch_sett')) bts.add( button(text='OpenSans', callback_data='set ch font_style_mark OpenSans')) bts.add( button(text='Raleway', callback_data='set ch font_style_mark Raleway')) bts.add(button(text='Pixel', callback_data='set ch font_style_mark Pixel')) bts.add( button(text='Caveat', callback_data='set ch font_style_mark Caveat')) bts.add( button(text='Lobster', callback_data='set ch font_style_mark Lobster')) bts.add( button(text='Oswald', callback_data='set ch font_style_mark Oswald')) bts.add( button(text='Pacifico', callback_data='set ch font_style_mark Pacifico')) bts.add( button(text='Rubik Mono', callback_data='set ch font_style_mark RubikMonoOne')) return bts
def welcom(self, user_id): bts = markup() bts.add(btn(text='OK', callback_data='open main')) return ru['welkom_menu'], bts
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
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
def ch_add(self, user_id): bts = markup() bts.add(btn(text=ru['back'], callback_data='open ch_list')) return ru['add_ch'], bts