(c: Client, m: Message)
| 183 | |
| 184 | @Client.on_message(filters.private & filters.command("unban") & filters.user(Config.ADMIN)) |
| 185 | async def unban(c: Client, m: Message): |
| 186 | if len(m.command) == 1: |
| 187 | await m.reply_text( |
| 188 | f"Use this command to unban any user.\n\n" |
| 189 | f"Usage:\n\n`/unban user_id`\n\n" |
| 190 | f"Eg: `/unban 1234567`\n" |
| 191 | f"This will unban user with id `1234567`.", |
| 192 | quote=True |
| 193 | ) |
| 194 | return |
| 195 | |
| 196 | try: |
| 197 | user_id = int(m.command[1]) |
| 198 | unban_log_text = f"Unbanning user {user_id}" |
| 199 | try: |
| 200 | await c.send_message(user_id, f"Your ban was lifted!") |
| 201 | unban_log_text += '\n\nUser notified successfully!' |
| 202 | except: |
| 203 | traceback.print_exc() |
| 204 | unban_log_text += f"\n\nUser notification failed! \n\n`{traceback.format_exc()}`" |
| 205 | await digital_botz.remove_ban(user_id) |
| 206 | await m.reply_text(unban_log_text, quote=True) |
| 207 | except: |
| 208 | traceback.print_exc() |
| 209 | await m.reply_text( |
| 210 | f"Error occurred! Traceback given below\n\n`{traceback.format_exc()}`", |
| 211 | quote=True |
| 212 | ) |
| 213 | |
| 214 | @Client.on_message(filters.private & filters.command("banned") & filters.user(Config.ADMIN)) |
| 215 | async def _banned_users(_, m: Message): |
nothing calls this directly
no test coverage detected