Ufoptg commited on
Commit
ce7437e
1 Parent(s): e9a5530

Update code.py

Browse files
Files changed (1) hide show
  1. code.py +2 -5
code.py CHANGED
@@ -38,7 +38,6 @@ blacklist = ["counterfeit", "meth", "Shard", "Heroin", "gbh"]
38
 
39
  @app.on_message(filters.text)
40
  async def check_blacklist(client, message):
41
-
42
  if any(
43
  re.search(rf"\b{re.escape(word)}\b", message.text, re.IGNORECASE)
44
  for word in blacklist
@@ -64,11 +63,9 @@ async def check_blacklist(client, message):
64
  user_id=message.from_user.id,
65
  permissions=ChatPermissions(can_send_messages=False),
66
  )
67
- except pyrogram.errors.exceptions.bad_request_400.UserAdminInvalid:
68
  logger.error("Failed to mute the user. Skipping action.")
69
 
70
- logger.info("Sending a message with buttons.")
71
-
72
  buttons = [
73
  [InlineKeyboardButton("Unmute", callback_data="unmute")],
74
  [InlineKeyboardButton("Ban", callback_data="ban")],
@@ -111,7 +108,7 @@ async def handle_button(client, callback_query):
111
  await callback_query.message.delete()
112
 
113
  except UserAdminInvalid as e:
114
- logger.info(f"Caught UserAdminInvalid error: {e}")
115
  await callback_query.answer("This button is not for you!")
116
  except Exception as e:
117
  logger.error(f"An error occurred: {e}")
 
38
 
39
  @app.on_message(filters.text)
40
  async def check_blacklist(client, message):
 
41
  if any(
42
  re.search(rf"\b{re.escape(word)}\b", message.text, re.IGNORECASE)
43
  for word in blacklist
 
63
  user_id=message.from_user.id,
64
  permissions=ChatPermissions(can_send_messages=False),
65
  )
66
+ except UserAdminInvalid as e:
67
  logger.error("Failed to mute the user. Skipping action.")
68
 
 
 
69
  buttons = [
70
  [InlineKeyboardButton("Unmute", callback_data="unmute")],
71
  [InlineKeyboardButton("Ban", callback_data="ban")],
 
108
  await callback_query.message.delete()
109
 
110
  except UserAdminInvalid as e:
111
+ # logger.info(f"Caught UserAdminInvalid error: {e}")
112
  await callback_query.answer("This button is not for you!")
113
  except Exception as e:
114
  logger.error(f"An error occurred: {e}")