(_, m: Message)
| 213 | |
| 214 | @Client.on_message(filters.private & filters.command("banned") & filters.user(Config.ADMIN)) |
| 215 | async def _banned_users(_, m: Message): |
| 216 | all_banned_users = await digital_botz.get_all_banned_users() |
| 217 | banned_usr_count = 0 |
| 218 | text = '' |
| 219 | async for banned_user in all_banned_users: |
| 220 | user_id = banned_user['id'] |
| 221 | ban_duration = banned_user['ban_status']['ban_duration'] |
| 222 | banned_on = banned_user['ban_status']['banned_on'] |
| 223 | ban_reason = banned_user['ban_status']['ban_reason'] |
| 224 | banned_usr_count += 1 |
| 225 | text += f"> **user_id**: `{user_id}`, **Ban Duration**: `{ban_duration}`, " \ |
| 226 | f"**Banned on**: `{banned_on}`, **Reason**: `{ban_reason}`\n\n" |
| 227 | reply_text = f"Total banned user(s): `{banned_usr_count}`\n\n{text}" |
| 228 | if len(reply_text) > 4096: |
| 229 | with open('banned-users.txt', 'w') as f: |
| 230 | f.write(reply_text) |
| 231 | await m.reply_document('banned-users.txt', True) |
| 232 | os.remove('banned-users.txt') |
| 233 | return |
| 234 | await m.reply_text(reply_text, True) |
| 235 | |
| 236 | @Client.on_message(filters.command("broadcast") & filters.user(Config.ADMIN) & filters.reply) |
| 237 | async def broadcast_handler(bot: Client, m: Message): |
nothing calls this directly
no test coverage detected