Example #1
0
def recommend_moderator(bot, update, bot_in_question, page):
    uid = update.effective_user.id
    mid = util.mid_from_update(update)
    moderators = User.select().where(
        (User.chat_id << settings.MODERATORS) & (User.chat_id != uid)
    )
    buttons = [
        InlineKeyboardButton(
            u.first_name,
            callback_data=util.callback_for_action(
                CallbackActions.SELECT_MODERATOR,
                {"bot_id": bot_in_question.id, "uid": u.id, "page": page},
            ),
        )
        for u in moderators
    ]
    buttons.insert(
        0,
        InlineKeyboardButton(
            captions.BACK,
            callback_data=util.callback_for_action(
                CallbackActions.SWITCH_APPROVALS_PAGE, {"page": page}
            ),
        ),
    )
    reply_markup = InlineKeyboardMarkup(util.build_menu(buttons, 1))
    text = mdformat.action_hint(
        "Select a moderator you think is better suited to evaluate the submission of {}.".format(
            str(bot_in_question)
        )
    )
    bot.formatter.send_or_edit(uid, text, to_edit=mid, reply_markup=reply_markup)
Example #2
0
def credits(bot, update):
    users_contrib = User.select().join(Bot)
    pass
    Bot.select(Bot.submitted_by)
    return ConversationHandler.END
Example #3
0
from botlistbot.models import Bot
from botlistbot.models import User

if __name__ == '__main__':
    all_bots = Bot.select()
    for bot in all_bots:
        if bot.spam is None:
            bot.spam = False
        if bot.official is None:
            bot.official = False
        if bot.inlinequeries is None:
            bot.inlinequeries = False
        if bot.offline is None:
            bot.offline = False
        bot.save()

    all_users = User.select()
    for user in all_users:
        if user.favorites_layout is None:
            user.favorites_layout = 'categories'
        user.save()