async def migrate_chat(m: Message, new_chat: int) -> None: LOGGER.info(f"Migrating from {m.chat.id} to {new_chat}...") langdb = Langs(m.chat.id) notedb = Notes() gdb = Greetings(m.chat.id) ruledb = Rules(m.chat.id) userdb = Users(m.chat.id) chatdb = Chats(m.chat.id) bldb = Blacklist(m.chat.id) approvedb = Approve(m.chat.id) reportdb = Reporting(m.chat.id) notes_settings = NotesSettings() pins_db = Pins(m.chat.id) fldb = Filters() disabl = Disabling(m.chat.id) disabl.migrate_chat(new_chat) gdb.migrate_chat(new_chat) chatdb.migrate_chat(new_chat) userdb.migrate_chat(new_chat) langdb.migrate_chat(new_chat) ruledb.migrate_chat(new_chat) bldb.migrate_chat(new_chat) notedb.migrate_chat(m.chat.id, new_chat) approvedb.migrate_chat(new_chat) reportdb.migrate_chat(new_chat) notes_settings.migrate_chat(m.chat.id, new_chat) pins_db.migrate_chat(new_chat) fldb.migrate_chat(m.chat.id, new_chat) LOGGER.info(f"Successfully migrated from {m.chat.id} to {new_chat}!")
async def get_stats(_, m: Message): # initialise bldb = Blacklist gbandb = GBan() notesdb = Notes() rulesdb = Rules grtdb = Greetings userdb = Users dsbl = Disabling appdb = Approve chatdb = Chats fldb = Filters() pinsdb = Pins notesettings_db = NotesSettings() warns_db = Warns warns_settings_db = WarnSettings replymsg = await m.reply_text("<b><i>Fetching Stats...</i></b>", quote=True) rply = ( f"<b>Users:</b> <code>{(userdb.count_users())}</code> in <code>{(chatdb.count_chats())}</code> chats\n" f"<b>Anti Channel Pin:</b> <code>{(pinsdb.count_chats('antichannelpin'))}</code> enabled chats\n" f"<b>Clean Linked:</b> <code>{(pinsdb.count_chats('cleanlinked'))}</code> enabled chats\n" f"<b>Filters:</b> <code>{(fldb.count_filters_all())}</code> in <code>{(fldb.count_filters_chats())}</code> chats\n" f" <b>Aliases:</b> <code>{(fldb.count_filter_aliases())}</code>\n" f"<b>Blacklists:</b> <code>{(bldb.count_blacklists_all())}</code> in <code>{(bldb.count_blackists_chats())}</code> chats\n" f" <b>Action Specific:</b>\n" f" <b>None:</b> <code>{(bldb.count_action_bl_all('none'))}</code> chats\n" f" <b>Kick</b> <code>{(bldb.count_action_bl_all('kick'))}</code> chats\n" f" <b>Warn:</b> <code>{(bldb.count_action_bl_all('warn'))}</code> chats\n" f" <b>Ban</b> <code>{(bldb.count_action_bl_all('ban'))}</code> chats\n" f"<b>Rules:</b> Set in <code>{(rulesdb.count_chats_with_rules())}</code> chats\n" f" <b>Private Rules:</b> <code>{(rulesdb.count_privrules_chats())}</code> chats\n" f"<b>Warns:</b> <code>{(warns_db.count_warns_total())}</code> in <code>{(warns_db.count_all_chats_using_warns())}</code> chats\n" f" <b>Users Warned:</b> <code>{(warns_db.count_warned_users())}</code> users\n" f" <b>Action Specific:</b>\n" f" <b>Kick</b>: <code>{(warns_settings_db.count_action_chats('kick'))}</code>\n" f" <b>Mute</b>: <code>{(warns_settings_db.count_action_chats('mute'))}</code>\n" f" <b>Ban</b>: <code>{warns_settings_db.count_action_chats('ban')}</code>\n" f"<b>Notes:</b> <code>{(notesdb.count_all_notes())}</code> in <code>{(notesdb.count_notes_chats())}</code> chats\n" f" <b>Private Notes:</b> <code>{(notesettings_db.count_chats())}</code> chats\n" f"<b>GBanned Users:</b> <code>{(gbandb.count_gbans())}</code>\n" f"<b>Welcoming Users in:</b> <code>{(grtdb.count_chats('welcome'))}</code> chats" f"<b>Approved People</b>: <code>{(appdb.count_all_approved())}</code> in <code>{(appdb.count_approved_chats())}</code> chats\n" f"<b>Disabling:</b> <code>{(dsbl.count_disabled_all())}</code> items in <code>{(dsbl.count_disabling_chats())}</code> chats.\n" "<b>Action:</b>\n" f" <b>Del:</b> Applied in <code>{(dsbl.count_action_dis_all('del'))}</code> chats.\n" ) await replymsg.edit_text(rply, parse_mode="html") return
from alita.database.filters_db import Filters from alita.database.notes_db import Notes, NotesSettings from alita.database.rules_db import Rules from alita.database.users_db import Users from alita.database.warns_db import Warns, WarnSettings from alita.utils.custom_filters import command, dev_filter # initialise bldb = Blacklist() gbandb = GBan() notesdb = Notes() rulesdb = Rules() userdb = Users() appdb = Approve() chatdb = Chats() fldb = Filters() pinsdb = Pins() notesettings_db = NotesSettings() warns_db = Warns() warns_settings_db = WarnSettings() @Alita.on_message(command("stats", DEV_PREFIX_HANDLER) & dev_filter) async def get_stats(_, m: Message): replymsg = await m.reply_text("<b><i>Fetching Stats...</i></b>", quote=True) rply = ( f"<b>Users:</b> <code>{(userdb.count_users())}</code> in <code>{(chatdb.count_chats())}</code> chats\n" f"<b>Anti Channel Pin:</b> <code>{(pinsdb.count_chats('antichannelpin'))}</code> enabled chats\n" f"<b>Clean Linked:</b> <code>{(pinsdb.count_chats('cleanlinked'))}</code> enabled chats\n" f"<b>Filters:</b> <code>{(fldb.count_filters_all())}</code> in <code>{(fldb.count_filters_chats())}</code> chats\n" f" <b>Aliases:</b> <code>{(fldb.count_filter_aliases())}</code>\n"