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 get_chat(client, message): if not DB_AVAILABLE: await edit_or_reply(message, text="You haven't set up a database!") return all_chats = get_all_chats() chatfile = 'List of chats.\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 += f'{chat.chat_name} - ({chat.chat_id})\n' 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 a list of chats in my database.', ) await edit_or_reply( message, text='Sent to 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 = InlineKeyboard(row_width=1) buttons.add( InlineKeyboardButton(tld('help_btn'), callback_data='help_back'), ) 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, )
async def stats(_, 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) or "")) 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 += "<b>Stickers Count:</b> <code>{} across {} sets</code>\n".format( count, len(all_sets)) 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) await message.reply_text(text, quote=True)
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"), ]]) 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, )
async def stats(_, message): text = '**Current stats**\n' if DB_AVAILABLE: text += ' - **Notes**: `{} notes`\n'.format( len(get_all_selfnotes(message.from_user.id) or ''), ) text += ' - **Group joined**: `{} 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 += ' - **Stickers Count**: <code>{} over {} packs</code>\n'.format( count, len(all_sets), ) text += ' - **Message received**: `{} messages`\n'.format(get_msgc(), ) uptime = get_readable_time(time.time() - StartTime) text += f' - **Nana uptime**: `{uptime}`' await message.reply_text(text, quote=True)