Пример #1
0
    user_id = message.from_user["id"]
    name = message.from_user["first_name"]
    if message.chat.type == "private":
        btn = InlineKeyboardMarkup(
            [
                [
                    InlineKeyboardButton(
                        text="🗣Add me to your group", url="https://t.me/SongAnie_bot?startgroup=true"
                    )
                ]
            ]
        )
    else:
        btn = None
    await message.reply(start_text.format(name, user_id), reply_markup=btn)
    add_chat_to_db(str(chat_id))


@app.on_message(filters.create(ignore_blacklisted_users) & filters.command("help"))
async def help(client, message):
    if message.from_user["id"] == OWNER_ID:
        await message.reply(owner_help)
        return ""
    text = "Syntax: /song song name"
    await message.reply(text)


app.start()
LOGGER.info("Your bot is now online.")
idle()
Пример #2
0
Ketik /help untuk menampilkan semua perintah!
"""
    keyboard = [[
        InlineKeyboardButton("Maintained by", url="t.me/LoliKillers"),
        InlineKeyboardButton("Help", callback_data="help"),
    ]]

    if update.effective_chat.type == "private":
        args = context.args
        update.effective_message.reply_photo(
            "https://telegra.ph/file/981f776678ac4980d39fd.png",
            PM_START_TEXT,
            timeout=60,
            parse_mode=ParseMode.MARKDOWN,
            disable_web_page_preview=True,
            reply_markup=InlineKeyboardMarkup(keyboard),
        )
    else:
        update.effective_message.reply_text("Ohayooo!")


def main():
    dispatcher.add_handler(CommandHandler("start", start))


if __name__ == "__main__":
    LOGGER.info("Using long polling.")
    main()
    updater.start_polling(timeout=15, read_latency=4)
    updater.idle()
Пример #3
0
        module = args[1].lower()
        text = ("Here is the available help for the *{}* module:\n".format(
            HELPABLE[module].__mod_name__) + HELPABLE[module].__help__)
        send_help(
            chat.id,
            text,
            InlineKeyboardMarkup([[
                InlineKeyboardButton(text="Back", callback_data="help_back")
            ]]),
        )

    else:
        send_help(chat.id, HELP_STRINGS)


def main():
    dispatcher.add_handler(CommandHandler("start", start, pass_args=True))
    help_handler = CommandHandler("help", get_help)
    help_callback_handler = CallbackQueryHandler(help_button, pattern=r"help_")
    dispatcher.add_handler(help_handler)
    dispatcher.add_handler(help_callback_handler)
    dispatcher.add_error_handler(error_handler)


if __name__ == "__main__":
    LOGGER.info("Successfully loaded modules: " + str(ALL_MODULES))
    LOGGER.info("Using long polling.")
    main()
    updater.start_polling(timeout=15, read_latency=4)
    updater.idle()