コード例 #1
0
async def set_stickers(client, message):
    if not DB_AVAILABLE:
        await message.edit("Your database is not avaiable!")
        return
    global TEMP_KEYBOARD, USER_SET
    if message.text in TEMP_KEYBOARD:
        await client.delete_messages(message.chat.id,
                                     USER_SET[message.from_user.id])
        if USER_SET["type"] == 1:
            set_sticker_set(message.from_user.id, message.text)
        elif USER_SET["type"] == 2:
            set_stanim_set(message.from_user.id, message.text)
        status = "Ok, sticker was set to `{}`".format(message.text)
        TEMP_KEYBOARD = []
        USER_SET = {}
    else:
        status = "Invalid pack selected."
        TEMP_KEYBOARD = []
        USER_SET = {}
    text = await get_text_settings()
    text += "\n{}".format(status)
    button = await get_button_settings()
    await setbot.send_photo(
        Owner,
        "https://raw.githubusercontent.com/legenhand/Nana-bot-file/master/image/bannernanasettings.jpeg",
        caption=text,
        reply_markup=button)
コード例 #2
0
ファイル: stickers.py プロジェクト: wulan17/Nana-Remix
async def set_stickers(client, message):
    if not DB_AVAILABLE:
        await message.edit("Your database is not avaiable!")
        return
    global TEMP_KEYBOARD, USER_SET
    if message.text in TEMP_KEYBOARD:
        await client.delete_messages(message.chat.id,
                                     USER_SET[message.from_user.id])
        if USER_SET["type"] == 1:
            set_sticker_set(message.from_user.id, message.text)
        elif USER_SET["type"] == 2:
            set_stanim_set(message.from_user.id, message.text)
        status = "Ok, sticker was set to `{}`".format(message.text)
        TEMP_KEYBOARD = []
        USER_SET = {}
    else:
        status = "Invalid pack selected."
        TEMP_KEYBOARD = []
        USER_SET = {}
    text = await get_text_settings()
    text += "\n{}".format(status)
    button = await get_button_settings()
    await setbot.send_photo(message.chat.id,
                            NANA_IMG,
                            caption=text,
                            reply_markup=button)
コード例 #3
0
async def set_stickers(client, message):
    if not DB_AVAILABLE:
        await message.edit("Your database is not avaiable!")
        return
    global TEMP_KEYBOARD, USER_SET
    if message.text in TEMP_KEYBOARD:
        await client.delete_messages(message.chat.id,
                                     USER_SET[message.from_user.id])
        if USER_SET["type"] == 1:
            set_sticker_set(message.from_user.id, message.text)
        elif USER_SET["type"] == 2:
            set_stanim_set(message.from_user.id, message.text)
        status = "Ok, sticker was set to `{}`".format(message.text)
    else:
        status = "Invalid pack selected."
    USER_SET = {}
    TEMP_KEYBOARD = []
    try:
        me = await app.get_me()
    except ConnectionError:
        me = None
    text = "**⚙️ Welcome to Nana Settings!**\n"
    if not me:
        text += "-> Userbot: `Stopped (v{})`\n".format(USERBOT_VERSION)
    else:
        text += "-> Userbot: `Running (v{})`\n".format(USERBOT_VERSION)
    text += "-> Assistant: `Running (v{})`\n".format(ASSISTANT_VERSION)
    text += "-> Database: `{}`\n".format(DB_AVAILABLE)
    text += "-> Python: `{}`\n".format(python_version())
    text += "\n{}".format(status)
    list_button = [
        [
            InlineKeyboardButton("Stop Bot", callback_data="toggle_startbot"),
            InlineKeyboardButton("Restart Bot", callback_data="restart_bot"),
        ],
        [InlineKeyboardButton("Set Sticker", callback_data="setsticker")],
    ]
    if HEROKU_API:
        list_button.append([
            InlineKeyboardButton("Heroku Config Vars",
                                 callback_data="heroku_vars")
        ])
        list_button.append([
            InlineKeyboardButton("Restart Heroku app",
                                 callback_data="restart_heroku")
        ])
        list_button.append([
            InlineKeyboardButton("Change Repo Source",
                                 callback_data="change_repo")
        ])
    button = InlineKeyboardMarkup(list_button)
    await message.reply(text, reply_markup=button)
コード例 #4
0
async def set_stickers(client, message):
    global TEMP_KEYBOARD, USER_SET
    if message.text in TEMP_KEYBOARD:
        await client.delete_messages(message.chat.id,
                                     USER_SET[message.from_user.id])
        set_sticker_set(message.from_user.id, message.text)
        await message.reply("Ok, sticker was set to `{}`".format(message.text))
        TEMP_KEYBOARD = []
        USER_SET = {}
    else:
        await message.reply("Invalid pack selected.")
        TEMP_KEYBOARD = []
        USER_SET = {}
コード例 #5
0
async def set_stickers(client, message):
	if not DB_AVAIABLE:
		await message.edit("Your database is not avaiable!")
		return
	global TEMP_KEYBOARD, USER_SET
	if message.text in TEMP_KEYBOARD:
		await client.delete_messages(message.chat.id, USER_SET[message.from_user.id])
		set_sticker_set(message.from_user.id, message.text)
		await message.reply("Ok, sticker was set to `{}`".format(message.text))
		TEMP_KEYBOARD = []
		USER_SET = {}
	else:
		await message.reply("Invalid pack selected.")
		TEMP_KEYBOARD = []
		USER_SET = {}
コード例 #6
0
async def theme_input_handlers(client, message):
    global temp_input, theme_format, temp_query, temp_vars, USER_SET, TEMP_KEYBOARD
    if temp_input:
        text = "**⚙️Add Theme **\n"
        if len(theme_format) >= 1:
            try:
                cap = "Image has been set!"
                await setbot.send_photo(Owner, message.text, caption=cap)
                theme_format.append(message.text)
            except:
                text += "**Wrong URL image !** \n"
        else:
            theme_format.append(message.text)

        if len(theme_format) == 1:
            text += f"Set URL image for welcome image \n"
        elif len(theme_format) == 2:
            text += f"Set URL image for start image \n"
        elif len(theme_format) == 3:
            text += f"Set URL image for settings image \n"
        elif len(theme_format) == 4:
            text += f"Set URL image for stats image \n"
        elif len(theme_format) == 5:
            text += f"Custom Theme has successfully added \n"
            temp_input = False
            await add_custom_theme(theme_format[0], theme_format[1],
                                   theme_format[2], theme_format[3],
                                   theme_format[4])
            theme_format = []
        list_button = [[
            InlineKeyboardButton("❌ Cancel", callback_data="cancel")
        ]]
        button = InlineKeyboardMarkup(list_button)
        await client.send_message(Owner, text, reply_markup=button)
    elif len(temp_vars) >= 1:
        temp_vars.append(message.text)
        text = "**⚙️Add heroku config vars **\n"
        if len(temp_vars) == 2:
            text += "`Send Value `"
            list_button = [[
                InlineKeyboardButton("❌ Cancel", callback_data="cancel")
            ]]
            button = InlineKeyboardMarkup(list_button)
            await client.send_message(Owner, text, reply_markup=button)
        if len(temp_vars) == 3:
            await config_vars(temp_vars[1], temp_vars[2])
            text += "`Successfully added config vars! `"
            await client.send_message(Owner, text)
            temp_vars = []
    elif message.from_user and message.from_user.id in list(USER_SET):
        if not DB_AVAILABLE:
            await message.edit("Your database is not avaiable!")
            return
        if message.text in TEMP_KEYBOARD:
            await client.delete_messages(message.chat.id,
                                         USER_SET[message.from_user.id])
            print(USER_SET)
            if USER_SET["type"] == 2:
                set_sticker_set(message.from_user.id, message.text)
            elif USER_SET["type"] == 1:
                set_stanim_set(message.from_user.id, message.text)
            status = "Ok, sticker was set to `{}`".format(message.text)
            TEMP_KEYBOARD = []
            USER_SET = {}
        else:
            status = "Invalid pack selected."
            TEMP_KEYBOARD = []
            USER_SET = {}
        text = await get_text_settings()
        text += "\n{}".format(status)
        button = await get_button_settings()
        img = await get_theme("settings")
        await setbot.send_photo(Owner, img, caption=text, reply_markup=button)