elif user.status == 'recently': return plate("info_status_recently", tmp_lang) elif user.status == 'within_week': return plate("info_status_within_week", tmp_lang) elif user.status == 'within_month': return plate("info_status_within_month", tmp_lang) elif user.status == 'long_time_ago': return plate("info_status_long_time_ago", tmp_lang) elif user.status == 'online': return plate("info_status_online", tmp_lang) elif user.status == 'offline': return datetime.fromtimestamp( user.status.date).strftime("%a, %d %b %Y, %H:%M:%S") @Client.on_message(~filters.me & custom_filters.command('info')) async def whois(client, message): cmd = message.command if not message.reply_to_message and len(cmd) == 1: get_user = message.from_user.id elif len(cmd) == 1: get_user = message.reply_to_message.from_user.id elif len(cmd) > 1: get_user = cmd[1] try: get_user = int(cmd[1]) except ValueError: pass try: user = await client.get_users(get_user) except PeerIdInvalid:
from logging import disable from pyrogram import filters from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup from haruka import app, plate, tmp_lang from haruka.helpers import custom_filters @app.on_message(~filters.me & custom_filters.command('start', prefixes='/'), group=8) async def start(client, message): if message.chat.type != "private": await message.reply_text(plate("start_group", tmp_lang)) return else: buttons = [[ InlineKeyboardButton(plate("help_button_support", tmp_lang), url="https://t.me/HarukaAyaGroup"), InlineKeyboardButton(plate("help_button_help", tmp_lang), callback_data='help_back') ]] await message.reply_text(plate("start_private", tmp_lang), reply_markup=InlineKeyboardMarkup(buttons), disable_web_page_preview=True)
import re from haruka import HELPABLE # pylint: disable-msg=E0611 from pyrogram import filters, Client from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup from haruka import plate, tmp_lang from haruka.helpers import custom_filters from haruka.helpers.misc import paginate_modules async def help_parser(client, chat_id, text, keyboard=None): if not keyboard: keyboard = InlineKeyboardMarkup(paginate_modules(0, HELPABLE, "help")) await client.send_message(chat_id, text, reply_markup=keyboard) @Client.on_message(~filters.me & custom_filters.command('help', prefixes='/'), group=8) async def help_command(client, message): if message.chat.type != "private": username = (await client.get_me()).username buttons = InlineKeyboardMarkup([[ InlineKeyboardButton( text=plate("help_button_help", tmp_lang), url=f"t.me/{username}?start=help", ) ]]) await message.reply(plate("help_group", tmp_lang), reply_markup=buttons) else: await help_parser(client, message.chat.id, plate("help_main", tmp_lang))
from haruka import app, OWNER_ID, BotID, plate from haruka.modules.sql import users_sql as chats_db from pyrogram import filters from haruka.helpers import custom_filters from io import StringIO, BytesIO @app.on_message( filters.user(OWNER_ID) & custom_filters.command("stats", prefixes='/')) async def stats_text(_, message): stats = "──「 <b>Current stats</b> 」──\n" stats += f"-> `{chats_db.num_users()}` users, across `{chats_db.num_chats()}` chats" await message.reply(stats) @app.on_message(~filters.me & filters.user(OWNER_ID) & custom_filters.command("chats", prefixes='/')) async def chat_stats(client, message): all_chats = chats_db.get_all_chats() or [] chatfile = 'List of chats.\n0. Chat name | Chat ID | Members count\n' P = 1 for chat in all_chats: curr_chat = await client.get_chat(chat.chat_id) bot_member = await curr_chat.get_member(BotID) chat_members = await client.get_chat_members_count(chat.chat_id) chatfile += "{}. {} | {} | {}\n".format(P, chat.chat_name, chat.chat_id, chat_members) P += 1 with BytesIO(str.encode(chatfile)) as output: output.name = "chatlist.txt"
if not response: await message.reply(plate("android_err_notfound", tmp_lang)) return response = response[0] buttons = InlineKeyboardMarkup( [[InlineKeyboardButton(text=plate("android_button_download", tmp_lang), url=response['url'])]]) await message.reply(plate("android_los_msgtxt", tmp_lang, filename=response['filename'], url=response['url'], size=sizee(int(response['size'])), version=response['version'] ), disable_web_page_preview=True, reply_markup=buttons) except ClientConnectionError: await message.reply(plate("android_err_api", tmp_lang)) @app.on_message(~filters.me & custom_filters.command('evo')) async def evolutionx(client, message): cmd = message.command cmd.pop(0) if not cmd: await message.reply(plate("android_cmd_example", tmp_lang, cmd="evo")) return cmd = cmd[0] try: # Try to do some cache magic first so we don't download tons of data all the time devices = await cache.get("https://raw.githubusercontent.com/Evolution-X-Devices/official_devices/master/devices.json") if not devices: await message.reply(plate("android_err_api", tmp_lang))