def on_set_signos(message):
    bot.send_chat_action(message.chat.id, 'typing')

    parts = re.match(
        r"^(registrar signos|rs) ([0-9]*) ([0-9]*) ([0-9]*) ([0-9]*[.]?[0-9]*) ([0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1]) (0[0-9]|1[0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]))$",
        message.text,
        flags=re.IGNORECASE)

    pas = int(parts[2])
    pad = int(parts[3])
    fc = int(parts[4])
    peso = float(parts[5])
    fecha_toma = parts[6]

    id_usuario = message.from_user.id

    #Pasa todas las validaciones pruebas
    if check_user(message, id_usuario):
        bot.send_message(
            message.chat.id,
            GestorConversacion.get_registro_signos(
                message.chat.first_name + " " + message.chat.last_name, pas,
                pad, fc, peso, fecha_toma),
            parse_mode="Markdown")
        bot.register_next_step_handler(message,
                                       GestorMediciones.step_2_registro_signos,
                                       pas, pad, fc, peso, fecha_toma)
示例#2
0
def editing11(call):
    if call.data[-1] == '%':
        keyboard = telebot.types.ReplyKeyboardMarkup(one_time_keyboard=True, resize_keyboard=True)
        new_project = "Создать новый проект"
        edit_project = "Редактировать проект"
        list_project = "Список проектов"
        exit = "Назад"
        flag = True
        if isRang(GetRangs(call.from_user.id, cursor), [7, 9, 10]):
            keyboard.add(new_project)
            keyboard.add(edit_project)
            flag = False
        if IsUserTeamlead(call.from_user.id, cursor) and flag:
            keyboard.add(edit_project)
        keyboard.add(list_project)
        keyboard.add(exit)
        bot.delete_message(chat_id=call.message.chat.id, message_id=call.message.message_id)
        bot.send_message(call.message.chat.id, 'Вкладка <b>"Проекты"</b>', reply_markup=keyboard, parse_mode='HTML')
    else:
        nick_and_id = call.data[7:]
        words = nick_and_id.split('*')
        nick = words[0]
        id = words[1]
        DeleteUserFromProject(nick, id, cursor, db)
        members = GetMembersOfProject(id, cursor)
        keyboard = telebot.types.InlineKeyboardMarkup()
        for member in members:
            keyboard.add(
                telebot.types.InlineKeyboardButton(text=member[0], callback_data='delete_' + member[0] + '*' + str(id)))
        keyboard.add(telebot.types.InlineKeyboardButton(text='Закончить', callback_data='delete_%'))
        bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.message_id,
                              text='Выберите курсанта из списка участников', reply_markup=keyboard)
示例#3
0
def new_project4(call):
    expert = call.data.split('_')[1]
    if expert == 'finish':
        bot.delete_message(call.message.chat.id, call.message.message_id)
        project_info['experts'] = experts
        SetState(call.from_user.id, 6, cursor, db)
        CreateProject(project_info, cursor, db)
        keyboard = telebot.types.ReplyKeyboardMarkup(one_time_keyboard=True, resize_keyboard=True)
        new_project = "Создать новый проект"
        edit_project = "Редактировать проект"
        list_project = "Список проектов"
        exit = "Назад"
        flag = True
        if isRang(GetRangs(call.from_user.id, cursor), [7, 9, 10]):
            keyboard.add(new_project)
            keyboard.add(edit_project)
            flag = False
        if (IsUserTeamlead(call.from_user.id, cursor) and flag):
            keyboard.add(edit_project)
        keyboard.add(list_project)
        keyboard.add(exit)
        bot.send_message(call.message.chat.id,
                         'Проект "' + project_info['name'] + '" успешно создан. Выберите дальнейшее действие',
                         reply_markup=keyboard)
    else:
        experts.append(expert)
        SetState(call.from_user.id, 6, cursor, db)
        bot.send_message(call.message.chat.id, "Принято")
示例#4
0
def giveTask(message):
    global difficulty
    difficulty = message.text
    bot.send_message(message.from_user.id,
                     "Сколько монет заплатишь за выполнение?",
                     reply_markup=types.ReplyKeyboardRemove())
    bot.register_next_step_handler(message, giveMoney)
示例#5
0
def handle_class_number(message):
    class_index = message.text.split()[0]
    user_cache[message.from_user.id] = class_index

    buttons = create_buttons(class_letters, 2)

    bot.send_message(message.chat.id, 'Выберите букву', reply_markup=buttons)
示例#6
0
    def set_user_bst(self):
        # adds user to group and schedules date to kick user out
        subscription = self.subscription
        userid = self.userid
        username = self.username
        channel_name = int(os.getenv("channel_name"))

        bot_client.start()
        main_value = bot_client.loop.run_until_complete(
            main(userid, channel_name))

        warn_date = self.subscription - datetime.timedelta(days=1)
        jobwarn = scheduler.add_job(self.warn_user,
                                    'date',
                                    run_date=warn_date,
                                    id=str(userid) + ' warn',
                                    replace_existing=True,
                                    name=f"warn_user {self.username}")

        job = scheduler.add_job(self.kick_user,
                                'date',
                                run_date=subscription,
                                id=str(userid),
                                replace_existing=True,
                                name=f"kick_user {self.username}")

        # datetime.date.fromtimestamp(1694016856.557)
        # job.trigger.run_date
        answer = main_value['newuser']
        # answer = "🟢Congratulations! Your subscription has been renewed, click this the link to join🟢"
        # telebot.types.InlineKeyboardButton(text, url=NULL, callback_data=NULL,
        #                      switch_inline_query=NULL, switch_inline_query_current_chat=NULL)
        bot.send_message(userid, text=answer)
        return job
示例#7
0
def send_alarms(message, id):
    keyboard = types.InlineKeyboardMarkup()
    response = requests.get(base_url + '/alarmes/',
                            auth=requests.auth.HTTPBasicAuth(
                                username, password))
    alarm_equip = json.loads(response.content)
    string = ''
    # Apaga a lista de alarmes para evitar duplicidade
    alarm.clear()
    for i in range(0, len(alarm_equip)):
        alarm_config = alarm_equip[i]["config_alarms"]
        # Verifica se o id do equipamento essta correto
        if alarm_equip[i]['id'] == int(id):
            for d in range(0, len(alarm_equip[i]['config_alarms'])):
                alarm.append('alarmes{}'.format(alarm_config[d]["id"]))
                # Verifica se tem alarmes no equipamento
                if len(str(alarm_config[d]["id"])) != 0:
                    keyboard.add(
                        types.InlineKeyboardButton(alarm_config[d]['nome'],
                                                   callback_data=alarm[i]))
                    string = "Lista de alarmes liberados para acesso:\n"
                else:
                    string = "*Lista de alarmes vazia:*"
    keyboard.row(
        # Volta para a listagem dos equipamentos
        types.InlineKeyboardButton('Equipamentos', callback_data='equip'),
        # Volta para o equipamento selecionado
        types.InlineKeyboardButton('Voltar',
                                   callback_data='equip_id{}'.format(
                                       str(id_equip[0]))))
    bot.send_message(message.chat.id, string, reply_markup=keyboard)
示例#8
0
def on_command_about(message):
	bot.send_chat_action(message.chat.id, 'typing')

	bot.send_message(
		message.chat.id, 
		logic.get_about_this(config.VERSION), 
		parse_mode="Markdown")    
示例#9
0
def on_command_help(message):
	bot.send_chat_action(message.chat.id, 'typing')

	bot.send_message(
		message.chat.id, 
		logic.get_help_message (), 
		parse_mode="Markdown") 
示例#10
0
def get_id(m):
    bot.send_chat_action(m.chat.id, 'typing')  #тайпинг бота
    bot.send_message(
        m.chat.id, u"@" + str(m.from_user.username) + ", " +
        "ваш Telegram ID: " + str(m.from_user.id))
    bot.delete_message(m.chat.id,
                       m.message_id)  #Удалить сообщение, содержащее команду
示例#11
0
def check_tasks(current_chat_id):
    """
    Функция вывода напоминания
    
    Parameters
    ----------
    current_chat_id
        id текущего пользователя
    
    """
    tasks = databaseHelper.get(current_chat_id, 'tasks')
    tasksMessage = ""
    if len(tasks) > 0:

        for number, task in enumerate(tasks, 1):
            task_days = get_days_task(task)
            if task_days is not None and task_days <= 1:
                tasksMessage += "<b><i>%s.</i></b> %s\n" % (
                    number, task["description"])

        tasksMessage += "🥵 Напоминание! До дедлайна этих задач осталось меньше дня!"

        bot.send_message(current_chat_id,
                         tasksMessage,
                         reply_markup=None,
                         parse_mode='html')
示例#12
0
def setting_dosier2(message):
    dossier = message.text
    SetDossier(dossier, config.current_user_for_dossier, cursor, db)
    SetState(message.from_user.id, 6, cursor, db)
    bot.send_message(message.chat.id,
                     "Успешно",
                     reply_markup=get_keyboard(message.from_user.id))
示例#13
0
def redacting_profile(call):
    if call.data[-1] == '1':
        bot.edit_message_text(chat_id=call.message.chat.id,
                              message_id=call.message.message_id,
                              text='Введите новое имя')
        SetState(call.from_user.id, 41, cursor, db)
    elif call.data[-1] == '2':
        bot.edit_message_text(chat_id=call.message.chat.id,
                              message_id=call.message.message_id,
                              text='Введите новый телефон')
        SetState(call.from_user.id, 42, cursor, db)
    elif call.data[-1] == '3':
        bot.edit_message_text(
            chat_id=call.message.chat.id,
            message_id=call.message.message_id,
            text='Введите новый электронный адрес Google-аккаунта')
        SetState(call.from_user.id, 43, cursor, db)
    elif call.data[-1] == '4':
        bot.edit_message_text(chat_id=call.message.chat.id,
                              message_id=call.message.message_id,
                              text='Загрузите новое фото')
        SetState(call.from_user.id, 44, cursor, db)
    elif call.data[-1] == '6':
        bot.edit_message_text(chat_id=call.message.chat.id,
                              message_id=call.message.message_id,
                              text='Введите новый адрес кошелька')
        SetState(call.from_user.id, 45, cursor, db)
    elif call.data[-1] == '5':
        bot.delete_message(chat_id=call.message.chat.id,
                           message_id=call.message.message_id)
        bot.send_message(call.message.chat.id,
                         'Редактирование окончено',
                         reply_markup=get_keyboard(call.from_user.id))
        SetState(call.from_user.id, 6, cursor, db)
示例#14
0
def addEvent(message):
    """
    Функция для создания мероприятия.
    С возможностью выбора даты и добавления времени.

    Parameters
    ----------
    message
        Объект message.
    """

    markup = types.ReplyKeyboardMarkup(row_width=1, resize_keyboard=True)
    goBackButton = types.KeyboardButton(config.goBack)
    markup.add(goBackButton)
    botMessage = "<b>Как мы назовем это мероприятие?</b>\n\n"
    botMessage += "Формат ввода (hh.mm dd.mm.yy event name)"
    bot.send_message(message.chat.id,
                     botMessage,
                     reply_markup=markup,
                     parse_mode='html')

    # working with json
    currentChatId = message.chat.id
    prevID = config.IDaddEvent
    status = 2
    databaseHelper.save(currentChatId, 'prevMenuId', prevID)
    databaseHelper.save(currentChatId, 'status', status)
    pass
示例#15
0
def en_rastrear_paquete_guia(mensaje):
    bot.send_chat_action(mensaje.chat.id, 'typing')
    paquete = logic.get_paquete_numero_guia(mensaje.text)
    if paquete:
        informacion = ""
        informacion += f"*Número de guía:* {paquete.numero_guia} \n"
        informacion += f"*Remitente:* {paquete.nombre_remitente} \n"
        informacion += f"*Peso en kg:* {ayudadores.formato_decimal(paquete.peso_kg,2)} \n"
        informacion += f"*Dirección destino:* {paquete.direccion_destino} \n"
        informacion += f"*Dirección recogida:* {paquete.direccion_recogida} \n"
        informacion += f"*Estado actual:* {paquete.estado_actual_objeto.nombre} \n"
        informacion += f"*Fecha del estado actual:* {ayudadores.formato_fecha_bonita(paquete.fecha_estado_actual)} \n"
        informacion += f"*Fecha de creación:* {ayudadores.formato_fecha_bonita(paquete.creado_el)} \n\n"
        informacion += f"*Estados:* \n"
        eventos = paquete.eventos
        indice = len(eventos)
        for evento in eventos:
            informacion += f"{indice}. *{evento.estado.nombre}* el {ayudadores.formato_fecha_bonita(evento.fecha)} \n"
            indice -= 1
        bot.send_message(mensaje.chat.id, informacion, parse_mode="Markdown")
    else:
        bot.send_message(
            mensaje.chat.id,
            f"No existe un paquete para este número de guía *{mensaje.text}* \U00002639",
            parse_mode="Markdown")
示例#16
0
def textHandler(message):
    """
    Функция обработки письменных команд

    Parameters
    ----------
    message
        Объект message
    """
    if message.text == config.tasksListLabel:
        showTasks(message)
    elif message.text == config.goMainMenu:
        goMainMenu(message)
    elif message.text == config.goBack:
        goBack(message)
    elif message.text == config.addTaskLabel:
        addTask(message)
    elif message.text == config.timeTableLabel:
        messageTimetableMenu(message)
    elif message.text == config.eventsLabel:
        showEvents(message)
    elif message.text == config.addEventLabel:
        addEvent(message)
    elif message.text == config.addTimetable:
        addTimetables(message)
    elif message.text == "Крестики-нолики":
        startTTT(message)
    elif message.text == "Новая игра":
        start_new_game(message)
    elif config.remindsLabel in message.text:
        set_reminds_status(message)
    else:
        if not addTaskDone(message) and not addEventDone(message) and not addTimetableDone(
                message) and not addPatternDone(message):
            bot.send_message(message.chat.id, config.emptyQuery)
示例#17
0
def en_eliminar_estado_paquete(call):
    markup = telebot.types.ForceReply(selective=False)
    bot.send_message(
        call.message.chat.id,
        text=
        "Digite el número de guía del paquete al que deseas eliminar un estado",
        reply_markup=markup)
示例#18
0
def notify_about_ref(**kwargs):
    if 'id' in kwargs:
        name = db.get_name_by_id(kwargs['id'])
        phone = db.get_phone_by_id(kwargs['id'])
        parent_id = db.get_parent_by_id(kwargs['id'])
        if parent_id:
            bot.send_message(parent_id, msgs.new_ref.format(name, phone))
示例#19
0
def data_id(message, id):
    keyboard = types.InlineKeyboardMarkup()
    response = requests.get(base_url + 'dados/{0}/'.format(int(id)),
                            auth=requests.auth.HTTPBasicAuth(
                                username, password))
    data_config = json.loads(response.content)

    # Verifica se existe algum dado no Id informado
    if bool(data_config):
        string = '*Dado:* {}\n'.format(data_config[0]['nome'])
        string += '*Unidade Eng.:* {}\n'.format(
            str(data_config[0]['unidade_eng']))
        string += '*Endereço:* {}\n'.format(str(data_config[0]['endereco']))
        string += '*Tamanho:* {}\n'.format(str(data_config[0]['tamanho']))
        string += '*Tipo:* {}\n'.format(data_config[0]['tipo'])
        if data_config[0]['dados']:
            string += '*Valor:* {}\n'.format(
                data_config[0]['dados'][0]['valor'])
            string += '*Data:* {}\n'.format(
                data_config[0]['dados'][0]['data_hora'])
    else:
        string = 'Id invalido'
    data.clear()
    data.append('dado{}'.format(data_config[0]['id']))
    keyboard.row(
        # Volta para listagem dos equipamentos
        types.InlineKeyboardButton('Equipamentos', callback_data='equip'),
        # Volta para a listagem dos dados do equipamento selecionado
        types.InlineKeyboardButton('Voltar', callback_data=data[0]))
    bot.send_message(message.chat.id,
                     "*dados liberado para acesso*:\n\n{}".format(string),
                     reply_markup=keyboard,
                     parse_mode="MARKDOWN")
示例#20
0
def intro_1_f(**kwargs):
    intro_1_markup = get_intro_1_markup()
    if 'id' in kwargs:
        db.set_state(kwargs['id'], intro_1)
        bot.send_message(kwargs['id'],
                         db.get_video(),
                         reply_markup=intro_1_markup)
示例#21
0
def send_data(message, id):
    # obtem lista de equipamentos de um usuario
    keyboard = types.InlineKeyboardMarkup()
    response = requests.get(base_url + 'dados/',
                            auth=requests.auth.HTTPBasicAuth(
                                username, password))
    data_equip = json.loads(response.content)
    string = ''
    data.clear()
    for i in range(0, len(data_equip)):
        data_config = data_equip[i]['config_dados']
        for d in range(0, len(data_equip[i]['config_dados'])):
            # Verifica se o id do equipamento essta correto
            if data_equip[i]['id'] == int(id):
                data.append('dados{}'.format(str(data_config[d]['id'])))
                # verifica se tem dados no equipamento
                if len(data_config[d]["dados"]) != 0:
                    keyboard.add(
                        types.InlineKeyboardButton(data_config[d]['nome'],
                                                   callback_data=data[i]))
                    string = "*Lista de dados liberada para acesso:*\n"
                else:
                    string = 'Listar de dados vazia'
    keyboard.row(
        # Volta para a listagem dos equipamentos
        types.InlineKeyboardButton('Equipamentos', callback_data='equip'),
        # Volta para o equipamento selecionado
        types.InlineKeyboardButton('Voltar',
                                   callback_data='equip_id{}'.format(
                                       str(id_equip[0]))))
    bot.send_message(message.chat.id,
                     string,
                     reply_markup=keyboard,
                     parse_mode="MARKDOWN")
示例#22
0
def intro_3_f(**kwargs):
    if 'id' in kwargs and 'state' in kwargs:
        if kwargs['state'] < menu:
            db.set_state(kwargs['id'], intro_2)
            bot.send_message(kwargs['id'],
                             msgs.intro_3,
                             reply_markup=get_intro_3_markup())
示例#23
0
文件: searchmsg.py 项目: XGMO9/tbv6
def search(message):
    try:
        query = message.text.split(' ', 1)[1]
    except IndexError:
        bot.send_message(message.chat.id,
                         "你什么也没有搜索!\n使用方法:`/search 关键词1 关键词2`\n"
                         "Tips:长按命令列表中的命令可快速将命令发送至输入框",
                         parse_mode="markdown")
        return
    res = requests.get('http://127.0.0.1:23434/api/search', {
        'query': query,
        'limit': 100
    }).json()
    with SearchDB("main.db") as d:
        res = d.search_by_url_paths(res)
    text = ("为你显示距离发布时间最近的十条结果\n点击按钮可获得磁力链接,如数据库中查找到了补档链接则会返回补档链接\n\n" "{}\n")

    intro_list = []
    btns = types.InlineKeyboardMarkup(1)
    for i, r in enumerate(res[:10]):
        intro = '{}:<a href="https://liuli.se{}">{}</a>'.format(
            i + 1, r[2], r[1])
        btn = types.InlineKeyboardButton(r[1],
                                         callback_data=f'~:search:{r[2]}')
        btns.add(btn)
        intro_list.append(intro)
    text = text.format("\n".join(intro_list))
    if message.chat.type != "private":
        text += '\n\n检测到当前环境不是私聊,为避免机器人消息刷屏,将不会发送按钮,如需获取相关的磁力链接或补档链接,请私聊发送搜索'
        btns = None
    bot.send_message(message.chat.id,
                     text,
                     reply_markup=btns,
                     parse_mode="HTML")
示例#24
0
def registration(user_id, text):
    refcode = rc.generate_code()
    if rc.has_refcode(text) and db.get_id_by_refcode(rc.extract_refcode(text)):
        parent_id = db.get_id_by_refcode(rc.extract_refcode(text))
        parent_name = db.get_name_by_id(parent_id)
        bot.send_message(user_id,
                         msgs.hello_ref.format(parent_name, parent_id))
        parent_id_2 = db.get_parent_by_id(parent_id)
        parent_id_3 = db.get_parent_by_id(parent_id_2)
        for line_n, parent in enumerate([parent_id, parent_id_2, parent_id_3]):
            if parent is not None:
                line_c = db.increment_line(line_n, parent)
                airtabledb.increment_line(line_n, line_c, db.get_at_id(parent))
        db.add_user(user_id, refcode, bot_time.get_time(), parent_id,
                    parent_id_2, parent_id_3)
        intro_1_f(id=user_id)
    else:
        parent_id = 398821553  # Айгуль ID
        parent_id_2 = None
        parent_id_3 = None
        for line_n, parent in enumerate([parent_id, parent_id_2, parent_id_3]):
            if parent is not None:
                line_c = db.increment_line(line_n, parent)
                airtabledb.increment_line(line_n, line_c, db.get_at_id(parent))
        # parent_name = db.get_name_by_id(parent_id)
        # bot.send_message(user_id, msgs.hello_ref.format(parent_name, parent_id))
        db.add_user(user_id,
                    refcode,
                    bot_time.get_time(),
                    ref_parent=parent_id)
        intro_1_f(id=user_id)
示例#25
0
def editing_status(call):
    bot.delete_message(chat_id=call.message.chat.id, message_id=call.message.message_id)
    id = call.data.split('_')[1]
    status = call.data.split('_')[2]
    if status == '1':
        status = 'Исследование рынка'
    elif status == '2':
        status = 'Разработка MVP'
    elif status == '3':
        status = 'Развитие проекта'
    elif status == '4':
        status = 'Завершен'
    elif status == '5':
        status = 'Закрыт'
    ChangeStatusProject(status, id, cursor, db)
    keyboard = telebot.types.ReplyKeyboardMarkup(one_time_keyboard=True, resize_keyboard=True)
    new_project = "Создать новый проект"
    edit_project = "Редактировать проект"
    list_project = "Список проектов"
    exit = "Назад"
    flag = True
    if isRang(GetRangs(call.from_user.id, cursor), [7, 9, 10]):
        keyboard.add(new_project)
        keyboard.add(edit_project)
        flag = False
    if IsUserTeamlead(call.from_user.id, cursor) and flag:
        keyboard.add(edit_project)
    keyboard.add(list_project)
    keyboard.add(exit)
    #SetState(message.from_user.id, 6, cursor, db)
    bot.send_message(call.message.chat.id, "Статус изменен. Выберите дальнейшее действие", reply_markup=keyboard)
示例#26
0
def account_f(**kwargs):
    if 'id' in kwargs:
        check_new_month()
        db.set_state(kwargs['id'], account)
        reg_date = bot_time.get_reg_date(db.get_registred_time(kwargs['id']))
        balance = db.get_balance(kwargs['id'])
        parent_id = db.get_parent_by_id(kwargs['id'])
        if db.is_have_free_access(kwargs['id']):
            exp_date = 'бесплатная'
        else:
            exp_date = bot_time.get_exp_date(
                db.get_expiration_time(kwargs['id']))
            if exp_date is not None:
                exp_date = 'истекает ' + exp_date
            else:
                exp_date = 'не оплачена'
        if parent_id is not None and parent_id != 398821553:
            parent_name = db.get_name_by_id(parent_id)
            parent_phone = db.get_phone_by_id(parent_id)
            msg = msgs.account.format(parent_name, parent_phone, parent_id,
                                      exp_date, balance)
        else:
            msg = msgs.account_no_par.format(exp_date, balance)
        bot.send_message(kwargs['id'], msg, reply_markup=get_menu_markup())
        referal_f(id=kwargs['id'])
示例#27
0
def editing2(call):
    member = call.data.split('_')[1]
    id = call.data.split('_')[2]
    if member == 'finish':
        bot.delete_message(call.message.chat.id, call.message.message_id)
        SetState(call.from_user.id, 6, cursor, db)
        keyboard = telebot.types.ReplyKeyboardMarkup(one_time_keyboard=True, resize_keyboard=True)
        new_project = "Создать новый проект"
        edit_project = "Редактировать проект"
        list_project = "Список проектов"
        exit = "Назад"
        flag = True
        if isRang(GetRangs(call.from_user.id, cursor), [7, 9, 10]):
            keyboard.add(new_project)
            keyboard.add(edit_project)
            flag = False
        if IsUserTeamlead(call.from_user.id, cursor) and flag:
            keyboard.add(edit_project)
        keyboard.add(list_project)
        keyboard.add(exit)
        bot.send_message(call.message.chat.id, 'Изменения приняты. Выберите дальнейшее действие', reply_markup=keyboard)
    else:
            keyboard = telebot.types.InlineKeyboardMarkup()
            keyboard.add(telebot.types.InlineKeyboardButton(text='Хипстер', callback_data='adding_2_' + str(member)+'_'+str(id)))
            keyboard.add(telebot.types.InlineKeyboardButton(text='Хастлер', callback_data='adding_3_' + str(member)+'_'+str(id)))
            keyboard.add(telebot.types.InlineKeyboardButton(text='Хакер', callback_data='adding_4_' + str(member)+'_'+str(id)))
            bot.send_message(call.message.chat.id, 'Какова его роль в проекте?', reply_markup=keyboard)
示例#28
0
def please_wait_f(**kwargs):
    if 'id' in kwargs and 'state' in kwargs:
        if kwargs['state'] < menu:
            bot.send_message(kwargs['id'],
                             msgs.wait,
                             reply_markup=remove_keyboard())
            pay_f(id=kwargs['id'])
示例#29
0
def create_qrcode(message):
    do = message.text
    bot.send_message(message.chat.id, 'Начинаю делать QR-code по слову: ' + do)
    img = qrcode.make(do)
    img.save('QR-code.png')

    bot.send_photo(message.chat.id, photo=open('/home/dizinnes/PycharmProjects/QRcodeBot/QR-code.png', 'rb'))
示例#30
0
def showMainMenu(message):
    """
    Функция показа главного меню.
    Отображает стикер и приветственное сообщение.
    Устанавливает в базу необходимые значения.

    Parameters
    ----------
    message
        Объект message
    """
    # working with json
    currentChatId = message.chat.id
    databaseHelper.save(currentChatId, 'prevMenuId', 0)
    databaseHelper.save(currentChatId, 'status', 0)

    remindsStatus = databaseHelper.get(currentChatId, 'reminds')

    # keyboard
    markup = types.ReplyKeyboardMarkup(row_width=1, resize_keyboard=True)
    tasksListButton = types.KeyboardButton(config.tasksListLabel)
    timeTableButton = types.KeyboardButton(config.timeTableLabel)
    eventsButton = types.KeyboardButton(config.eventsLabel)
    game = types.KeyboardButton("Крестики-нолики")

    turnRemindsBtn = types.KeyboardButton(
        f"{config.remindsLabel} {remindsStatus}")
    markup.add(tasksListButton, timeTableButton, eventsButton, turnRemindsBtn,
               game)
    # sending
    sticker = open(random.choice(config.stickers), 'rb')
    bot.send_sticker(message.chat.id, sticker)
    bot.send_message(message.chat.id,
                     config.mainMenuMessage,
                     reply_markup=markup)