Ufoptg commited on
Commit
61e01ea
1 Parent(s): e341432

Update code2.py

Browse files
Files changed (1) hide show
  1. code2.py +7 -5
code2.py CHANGED
@@ -5,8 +5,10 @@ import re
5
  from datetime import datetime, timedelta
6
 
7
  from telethon import TelegramClient, events
 
8
  from telethon.tl.types import ChatAdminRights, ChatBannedRights, ChannelParticipantsAdmins
9
- from telethon.tl.custom.buttons import InlineKeyboardButton
 
10
 
11
  API_ID = os.getenv("API_ID")
12
  API_HASH = os.getenv("API_HASH")
@@ -32,7 +34,6 @@ async def start(event):
32
  async def help(event):
33
  await event.respond('I can blacklist certain words. Just type them in a chat I am in!')
34
 
35
-
36
  @client.on(events.NewMessage(incoming=True))
37
  async def check_blacklist(event):
38
  if any(
@@ -68,8 +69,8 @@ async def check_blacklist(event):
68
  logger.error("Failed to mute the user. Skipping action.")
69
 
70
  buttons = [
71
- [InlineKeyboardButton("Unmute", callback_data="unmute")],
72
- [InlineKeyboardButton("Ban", callback_data="ban")],
73
  ]
74
  await client.send_message(
75
  entity=event.chat_id,
@@ -109,4 +110,5 @@ async def handle_button(event):
109
  except Exception as e:
110
  logger.error(f"An error occurred: {e}")
111
 
112
- client.run_until_disconnected()
 
 
5
  from datetime import datetime, timedelta
6
 
7
  from telethon import TelegramClient, events
8
+ from telethon.tl.custom import Button
9
  from telethon.tl.types import ChatAdminRights, ChatBannedRights, ChannelParticipantsAdmins
10
+
11
+
12
 
13
  API_ID = os.getenv("API_ID")
14
  API_HASH = os.getenv("API_HASH")
 
34
  async def help(event):
35
  await event.respond('I can blacklist certain words. Just type them in a chat I am in!')
36
 
 
37
  @client.on(events.NewMessage(incoming=True))
38
  async def check_blacklist(event):
39
  if any(
 
69
  logger.error("Failed to mute the user. Skipping action.")
70
 
71
  buttons = [
72
+ [Button.inline("Unmute", b"unmute")],
73
+ [Button.inline("Ban", b"ban")],
74
  ]
75
  await client.send_message(
76
  entity=event.chat_id,
 
110
  except Exception as e:
111
  logger.error(f"An error occurred: {e}")
112
 
113
+ client.run_until_disconnected()
114
+