Ejemplo n.º 1
0
def faq_id_markup(faq, vote=None):
    thumbs_up = emojize(':thumbsup:') + (' (voted)' if vote is True else '')
    thumbs_down = emojize(':thumbsdown:') + (' (voted)'
                                             if vote is False else '')

    keyboard = [[
        InlineKeyboardButton(thumbs_up,
                             callback_data='faq_rate_up__' + str(faq.id)),
        InlineKeyboardButton(thumbs_down,
                             callback_data='faq_rate_down__' + str(faq.id)),
    ], [back_button('FAQs list', 'faq')]]
    return InlineKeyboardMarkup(keyboard)
Ejemplo n.º 2
0
def faq_keyboard_markup(queryset):
    issues_keyboard = [[
        InlineKeyboardButton(
            emojize(f':grey_question: {issue.question} :grey_question:'),
            callback_data='faq__' + str(issue.id))
    ] for issue in queryset]
    keyboard = [
        *issues_keyboard,
        [CONTACT_ME_BTN],
        [back_button('help')],
    ]

    return InlineKeyboardMarkup(keyboard)
Ejemplo n.º 3
0
def message_mailing_status(done_count, all_count):
    return emojize(
        f'Sending message to your subscribers.\n{done_count} / {all_count} :mega:'
    )
Ejemplo n.º 4
0
def notification_sent(done_count, all_count):
    return emojize(
        f'Notification was sent to all subscribers. :white_check_mark:\n{done_count} / {all_count} :mega:'
    )
Ejemplo n.º 5
0
def faq_id(faq):
    rates_count = faq.rates.filter(is_positive=True).count()
    text = emojize(
        '***{q}***\n\n{a}\n\n:thumbsup: ({rates_count})\nWas it helpful?')
    return text.format(q=faq.question, a=faq.answer, rates_count=rates_count)
Ejemplo n.º 6
0
    return 'Settings.'


def settings(user):
    lang = dict(django_settings.LANGUAGES).get(user.lang, 'English')
    text = '***Language***: {lang}'
    return text.format(lang=lang)


START = (
    f'***{django_settings.MAIN_BOT_NAME}*** is created to help you build your own bots without any coding. '
    'It\'s simple and absolutely free for use.')
BOT_CONNECT = emojize(
    'To connect your bot:\n\n'
    ':small_blue_diamond: Go to @BotFather.\n'
    ':small_blue_diamond: Send /addbot and set a name for it.\n'
    ':small_blue_diamond: Copy a token you get if bot is created.\n'
    ':small_blue_diamond: Return to me and send it.\n\n'
    'Example of the token: `987865432:AAA-50DXLLPYEl1TDbnPYElDimH9CouAhfXLLM`')
TOKEN_INVALID = emojize(BOT_CONNECT + '\n\n' +
                        'The token is invalid :heavy_exclamation_mark:')
BOT_CONNECTED = emojize(
    'Your bot was succesfully added to the system :bear:\n\n')
HELP = (
    'I am a bot builder that can help you create your bots without any boring coding.\n'
    'I try to customize every bot for their needs as much as possible.\n\n'
    '***To start*** go to menu and add your first bot. Then follow the inctructions to manage it.\n\n'
    'If you still have any question feel free to check out FAQs '
    f'or contact us at @{settings.SUPPORT_BOT_NAME}.')
ABOUT = (
    'I am bot who lives together with my creator @serhii_beznisko. '
Ejemplo n.º 7
0
from core.enums import DeepCommand
from core.utils import emojize
from main.utils import build_deeplink, call_bot


def back_button(section, callback_data=None):
    callback_data = callback_data or section
    return InlineKeyboardButton(
        f'« Back to {section}',
        callback_data=callback_data.replace(' ', '_'),
    )


BACK_TO_MENU_BTN = back_button('menu', 'start')
CONNECT_BOT_BTN = InlineKeyboardButton(
    emojize('Connect my bot :heavy_plus_sign:'), callback_data='connect_bot')
CONTACT_ME_BTN = InlineKeyboardButton('Help Community',
                                      url='https://t.me/' +
                                      settings.SUPPORT_BOT_NAME)

START_KB = [[CONNECT_BOT_BTN],
            [InlineKeyboardButton('My bots', callback_data='my_bots')],
            [
                InlineKeyboardButton('Settings', callback_data='settings'),
                InlineKeyboardButton('Help', callback_data='help'),
                InlineKeyboardButton('About', callback_data='about'),
            ]]
CANCEL_START_KB = [[
    InlineKeyboardButton(emojize('Cancel :x:'), callback_data='start'),
]]
SETTINGS_KB = [[