async def start(_client, message):
    if message.chat.type != 'private':
        await message.reply('henlo ^0^')
    else:
        if len(message.text.split()) >= 2:
            helparg = message.text.split()[1]
            if helparg == "help_inline":
                await message.reply(
                    tld("inline_help_text").format(BotUsername))
                return
        try:
            me = await app.get_me()
        except ConnectionError:
            me = None
        userbot_stat = 'Stopped' if not me else 'Running'
        db_stat = len(get_all_chats()) if DB_AVAILABLE else 'None'
        buttons = InlineKeyboardMarkup([[
            InlineKeyboardButton(text=tld("help_btn"),
                                 callback_data="help_back"),
            InlineKeyboardButton('Language', callback_data='set_lang_')
        ]])
        if NANA_IMG:
            await setbot.send_photo(message.chat.id,
                                    NANA_IMG,
                                    caption=tld("start_message").format(
                                        OwnerName, python_version(),
                                        userbot_stat, USERBOT_VERSION,
                                        ASSISTANT_VERSION, DB_AVAILABLE,
                                        db_stat),
                                    reply_markup=buttons)
        else:
            await message.reply(tld("start_message").format(
                OwnerName, python_version(), userbot_stat, USERBOT_VERSION,
                ASSISTANT_VERSION, DB_AVAILABLE, db_stat),
                                reply_markup=buttons)
Exemple #2
0
async def stats(client, message):
	try:
		me = await app.get_me()
	except ConnectionError:
		me = None
	text = "**Here is your current stats**\n"
	text += "Notes: `0 notes`\n"
	text += "Group joined: `{} groups`\n".format(len(get_all_chats()))
	text += "Message received: `{} messages`\n".format(get_msgc())

	a = await get_runtime()
	b = int(time.time())
	c = b - a
	month = c // 2678400
	days = c // 86400
	hours = c // 3600 % 24
	minutes = c // 60 % 60
	seconds = c % 60

	alivetext = ""
	if month:
		alivetext += "{} month, ".format(month)
	if days:
		alivetext += "{} days, ".format(days)
	if hours:
		alivetext += "{} hours, ".format(hours)
	if minutes:
		alivetext += "{} minutes, ".format(minutes)
	if seconds:
		alivetext += "{} seconds".format(seconds)

	text += "\nBot was alive for `{}`".format(alivetext)
	await message.reply(text)
Exemple #3
0
async def get_chat(client, message):
    if not DB_AVAILABLE:
        await edit_or_reply(message, text="Your database is not avaiable!")
        return
    all_chats = get_all_chats()
    chatfile = "List of chats that I joined.\n"
    for chat in all_chats:
        if str(chat.chat_username) != "None":
            chatfile += "{} - ({}): @{}\n".format(
                chat.chat_name, chat.chat_id, chat.chat_username
            )
        else:
            chatfile += "{} - ({})\n".format(chat.chat_name, chat.chat_id)

    with open("nana/cache/chatlist.txt", "w", encoding="utf-8") as writing:
        writing.write(str(chatfile))
        writing.close()

    await client.send_document(
        "self",
        document="nana/cache/chatlist.txt",
        caption="Here is the chat list that I joined.",
    )
    await edit_or_reply(
        message,
        text="My chat list exported to my saved messages."
    )
    os.remove("nana/cache/chatlist.txt")
async def start(_, message):
    if message.chat.type != "private":
        await message.reply("henlo ^0^")
    else:
        if len(message.text.split()) >= 2:
            helparg = message.text.split()[1]
            if helparg == "help_inline":
                await message.reply(tld(
                        "inline_help_text"
                    ).format(
                        BotUsername
                    )
                )
                return
        try:
            me = await app.get_me()
        except ConnectionError:
            me = None
        userbot_stat = "Stopped" if not me else "Running"
        db_stat = len(get_all_chats()) if DB_AVAILABLE else "None"
        buttons = InlineKeyboardMarkup(
            [
                [
                    InlineKeyboardButton(
                        text=tld("help_btn"), callback_data="help_back"
                    ),
                    InlineKeyboardButton(
                        tld("language_btn"), callback_data="set_lang_"
                    ),
                ]
            ]
        )
        if NANA_IMG:
            await message.reply_photo(
                NANA_IMG,
                caption=tld("start_message").format(
                    OwnerName,
                    python_version(),
                    userbot_stat,
                    USERBOT_VERSION,
                    ASSISTANT_VERSION,
                    DB_AVAILABLE,
                    db_stat,
                ),
                reply_markup=buttons,
            )
        else:
            await message.reply(
                tld("start_message").format(
                    OwnerName,
                    python_version(),
                    userbot_stat,
                    USERBOT_VERSION,
                    ASSISTANT_VERSION,
                    DB_AVAILABLE,
                    db_stat,
                ),
                reply_markup=buttons,
            )
Exemple #5
0
async def stats(_client, message):
    text = "**Here is your current stats**\n"
    text += "Notes: `0 notes`\n"
    if DB_AVAILABLE:
        text += "Group joined: `{} groups`\n".format(len(get_all_chats()))
    text += "Message received: `{} messages`\n".format(get_msgc())

    uptime = get_readable_time((time.time() - StartTime))
    text += ("<b>Nana uptime:</b> <code>{}</code>".format(uptime))
    await message.reply_text(text, quote=True)
Exemple #6
0
async def stats(_client, message):
    text = ""
    if DB_AVAILABLE:
        text += "<b>Notes:</b> `{} notes`\n".format(len(get_all_selfnotes(message.from_user.id)))
        text += "<b>Group joined:</b> `{} groups`\n".format(len(get_all_chats()))
    text += "<b>Message received:</b> `{} messages`\n".format(get_msgc())

    uptime = get_readable_time((time.time() - StartTime))
    text += ("<b>Nana uptime:</b> <code>{}</code>".format(uptime))
    img = await get_theme("Nana-Official", "stats")
    await setbot.send_photo(Owner, img, caption=text)
Exemple #7
0
async def stats(_client, message):
    text = "**Here is your current stats**\n"
    if DB_AVAILABLE:
        text += "<b>Notes:</b> `{} notes`\n".format(
            len(get_all_selfnotes(message.from_user.id)))
        text += "<b>Group joined:</b> `{} groups`\n".format(
            len(get_all_chats()))
    stk = await app.send(functions.messages.GetAllStickers(hash=0))
    all_sets = stk.sets
    count = sum(x.count for x in all_sets)
    text += f"<b>Stickers Count:</b> <code>{count} across {len(all_sets)} sets</code>\n"
    text += "<b>Message received:</b> `{} messages`\n".format(get_msgc())
    uptime = get_readable_time((time.time() - BOT_RUNTIME))
    text += ("<b>Nana uptime:</b> <code>{}</code>".format(uptime))
    await message.reply_text(text, quote=True)
async def lang_back(_, query):
    try:
        me = await app.get_me()
    except ConnectionError:
        me = None
    userbot_stat = "Stopped" if not me else "Running"
    db_stat = len(get_all_chats()) if DB_AVAILABLE else "None"
    buttons = InlineKeyboardMarkup(
        [
            [
                InlineKeyboardButton(
                    text=tld("help_btn"),
                    callback_data="help_back"
                ),
                InlineKeyboardButton(
                    tld("language_btn"),
                    callback_data="set_lang_"
                ),
            ]
        ]
    )
    if NANA_IMG:
        await query.message.edit_caption(
            tld("start_message").format(
                OwnerName,
                python_version(),
                userbot_stat,
                USERBOT_VERSION,
                ASSISTANT_VERSION,
                DB_AVAILABLE,
                db_stat,
            ),
        )
        await query.message.edit_reply_markup(buttons)
    else:
        await query.message.edit(
            tld("start_message").format(
                OwnerName,
                python_version(),
                userbot_stat,
                USERBOT_VERSION,
                ASSISTANT_VERSION,
                DB_AVAILABLE,
                db_stat,
            ),
            reply_markup=buttons,
        )
    await query.answer()