Exemplo n.º 1
0
def SettingsCommand(message, user_id, chat_id, u, group=False):
    buttons = [['Language']]
    if group:
        buttons.append(['Answer only when mention?'])
    bot.sendMessage(chat_id, _('What do you want to configure?') +
                    ' \xF0\x9F\x91\x86', reply_markup={'keyboard': buttons, 'one_time_keyboard': True})
    if group:
        u.set_field(chat_id, 'mode', 'settings', group=group)
    else:
        u.set_field(user_id, 'mode', 'settings', group=group)
    return []
Exemplo n.º 2
0
def SettingsCommand(message, user_id, chat_id, u, group=False):
    k = ReplyKeyboardMarkup(['Language'], one_time_keyboard=True)
    if group:
        text = get_template('question_only_mention.md').render()
        k.addButton(text)
    text = get_template('configure_question.md').render()
    m = Message(chat_id, text, reply_markup=k)
    bot.sendMessage(m)
    if group:
        identifier = chat_id
    else:
        identifier = user_id
    u.set_field(identifier, 'mode', 'settings', group=group)
Exemplo n.º 3
0
def SettingsCommand(message, user_id, chat_id, u, group=False):
    buttons = [['Language']]
    if group:
        buttons.append(['Answer only when mention?'])
    bot.sendMessage(chat_id,
                    _('What do you want to configure?') + ' \xF0\x9F\x91\x86',
                    reply_markup={
                        'keyboard': buttons,
                        'one_time_keyboard': True
                    })
    if group:
        u.set_field(chat_id, 'mode', 'settings', group=group)
    else:
        u.set_field(user_id, 'mode', 'settings', group=group)
    return []
Exemplo n.º 4
0
def SetLanguageCommand(message, user_id, chat_id, u, group=False):
    if message in avaible_languages:
        if group:
            u.set_field(chat_id,
                        'lang',
                        avaible_languages[message],
                        group=group)
            u.set_field(chat_id, 'mode', 'normal', group=group)
        else:
            u.set_field(user_id,
                        'lang',
                        avaible_languages[message],
                        group=group)
            u.set_field(user_id, 'mode', 'normal', group=group)
        bot.sendMessage(chat_id,
                        _('Now I will talk you with the new language') +
                        ' \xF0\x9F\x98\x99' + '\xF0\x9F\x92\xAC',
                        reply_markup={'hide_keyboard': True})
        return []
    else:
        if group:
            u.set_field(chat_id, 'mode', 'normal')
        else:
            u.set_field(user_id, 'mode', 'normal')
        bot.sendMessage(
            chat_id,
            _("Ooops! I can't talk this language") + ' \xF0\x9F\x98\xB7 (' +
            _('yet') + ' \xF0\x9F\x98\x89)\n' +
            _('But you can help me to learn it in Transifex') +
            ' \xF0\x9F\x8E\x93\nhttps://www.transifex.com/osm-catala/osmbot/',
            reply_markup={'hide_keyboard': True})
        return []
Exemplo n.º 5
0
def SetLanguageCommand(message, user_id, chat_id, u, group=False):
    if message in avaible_languages:
        if group:
            u.set_field(chat_id, 'lang', avaible_languages[message],group=group)
            u.set_field(chat_id, 'mode', 'normal', group=group)
        else:
            u.set_field(user_id, 'lang', avaible_languages[message],group=group)
            u.set_field(user_id, 'mode', 'normal', group=group)
        bot.sendMessage(chat_id, _('Now I will talk you with the new language') +
                        ' \xF0\x9F\x98\x99'+'\xF0\x9F\x92\xAC', reply_markup={'hide_keyboard': True})
        return []
    else:
        if group:
            u.set_field(chat_id, 'mode', 'normal')
        else:
            u.set_field(user_id, 'mode', 'normal')
        bot.sendMessage(chat_id,
                        _("Ooops! I can't talk this language") + ' \xF0\x9F\x98\xB7 (' + _('yet') +
                        ' \xF0\x9F\x98\x89)\n' + _('But you can help me to learn it in Transifex') +
                        ' \xF0\x9F\x8E\x93\nhttps://www.transifex.com/osm-catala/osmbot/',
                        reply_markup={'hide_keyboard': True})
        return []
Exemplo n.º 6
0
def SetLanguageCommand(message, user_id, chat_id, u, group=False):
    if message in avaible_languages:
        if group:
            u.set_field(chat_id, 'lang', avaible_languages[message],group=group)
            u.set_field(chat_id, 'mode', 'normal', group=group)
        else:
            u.set_field(user_id, 'lang', avaible_languages[message],group=group)
            u.set_field(user_id, 'mode', 'normal', group=group)
        text = get_template('new_language.md').render()
        m = Message(chat_id, text)
        bot.sendMessage(m)
        return []
    else:
        if group:
            u.set_field(chat_id, 'mode', 'normal', group=True)
        else:
            u.set_field(user_id, 'mode', 'normal')
        temp = get_template('cant_talk_message.md')
        text = temp.render()
        message = Message(chat_id, text)
        bot.sendMessage(message)
        return []