Beispiel #1
0
def prepare_transit(message):
    if not (message.chat.id in ModeratorsDatabase.moderators()):
        if message.chat.id != config.ADMIN_ID:
            return bot.send_message(message.chat.id, "(-_-)")

    controll = {
        "document": message.document,
        "photo": message.photo,
        "video": message.video,
    }

    if message.content_type == "photo":
        controll['photo'] = message.photo[-1]

    bussy_dict[message.chat.id] = (message.content_type,
                                   controll[message.content_type].file_id,
                                   message.caption, message.date)

    return bot.send_message(
        message.chat.id,
        "Choice method!",
        reply_markup=utils.create_inlinemarkup([[
            utils.create_inlinebutton("Channel", "choice channel"),
            utils.create_inlinebutton("Group", "choice group")
        ]]))
Beispiel #2
0
def view_method(call):
    _, type, name = call.data.split(" ")

    processor = {
        "channel": config.CHANNELS,
        "group": config.GROUPS,
    }

    return bot.edit_message_text("Choice {}:".format(type), call.message.chat.id, call.message.message_id, reply_markup=utils.create_vanillainlinemarkup(
        [utils.create_inlinebutton(channel.title, "sendto {} {}".format(type, channel.id)) for channel in [bot.get_chat(id) for id in processor[type][name]]] +
        [utils.create_inlinebutton("Назад", "choice {}".format(type))], 1))
Beispiel #3
0
def get_markup(id):
    return utils.create_inlinemarkup(
        [[
            utils.create_inlinebutton(config.SENDER_NAME,
                                      url="t.me/{}".format(
                                          bot.get_chat(id).username))
        ],
         [
             utils.create_inlinebutton(config.ADMIN_NAME,
                                       url="t.me/{}".format(config.ADMIN_LINK))
         ],
         [
             utils.create_inlinebutton(config.BUTTON3_NAME,
                                       url=config.BUTTON3_LINK)
         ]])
Beispiel #4
0
def choice_method(call):
    _, type = call.data.split(" ")

    processor = {
        "channel": config.CHANNELS.keys(),
        "group": config.GROUPS.keys(),
    }

    translate = {
        "weed": "Травка",
        "other": "Прочее",
    }

    return bot.edit_message_text("Choice:", call.message.chat.id, call.message.message_id, reply_markup=utils.create_vanillainlinemarkup(
        [utils.create_inlinebutton(translate[channel], "view {} {}".format(type, channel)) for channel in processor[type]], 1))