Spaces:
Sleeping
Sleeping
Captain Ezio
commited on
Commit
·
c3ccb7b
1
Parent(s):
2aca525
Looks good
Browse files- Powers/plugins/admin.py +2 -1
- Powers/plugins/approve.py +4 -2
- Powers/plugins/bans.py +2 -1
- Powers/plugins/blacklist.py +8 -4
- Powers/plugins/chat_blacklist.py +2 -1
- Powers/plugins/dev.py +2 -1
- Powers/plugins/disable.py +2 -1
- Powers/plugins/filters.py +6 -3
- Powers/plugins/fun.py +4 -2
- Powers/plugins/locks.py +10 -5
- Powers/plugins/notes.py +8 -4
- Powers/plugins/pin.py +10 -5
- Powers/plugins/rules.py +6 -3
- Powers/plugins/start.py +4 -2
- Powers/plugins/warns.py +2 -1
- Powers/plugins/watchers.py +8 -4
Powers/plugins/admin.py
CHANGED
@@ -40,7 +40,8 @@ async def adminlist_show(_, m: Message):
|
|
40 |
adminstr = f"Admins in <b>{m.chat.title}</b>:" + "\n\n"
|
41 |
|
42 |
bot_admins = [i for i in admin_list if (i[1].lower()).endswith("bot")]
|
43 |
-
user_admins = [i for i in admin_list if not (
|
|
|
44 |
|
45 |
# format is like: (user_id, username/name,anonyamous or not)
|
46 |
mention_users = [
|
|
|
40 |
adminstr = f"Admins in <b>{m.chat.title}</b>:" + "\n\n"
|
41 |
|
42 |
bot_admins = [i for i in admin_list if (i[1].lower()).endswith("bot")]
|
43 |
+
user_admins = [i for i in admin_list if not (
|
44 |
+
i[1].lower()).endswith("bot")]
|
45 |
|
46 |
# format is like: (user_id, username/name,anonyamous or not)
|
47 |
mention_users = [
|
Powers/plugins/approve.py
CHANGED
@@ -88,7 +88,8 @@ async def disapprove_user(c: Gojo, m: Message):
|
|
88 |
except UserNotParticipant:
|
89 |
if already_approved: # If user is approved and not in chat, unapprove them.
|
90 |
db.remove_approve(user_id)
|
91 |
-
LOGGER.info(
|
|
|
92 |
await m.reply_text("This user is not in this chat, unapproved them.")
|
93 |
return
|
94 |
except RPCError as ef:
|
@@ -158,7 +159,8 @@ async def check_approval(c: Gojo, m: Message):
|
|
158 |
except Exception:
|
159 |
return
|
160 |
check_approve = db.check_approve(user_id)
|
161 |
-
LOGGER.info(
|
|
|
162 |
|
163 |
if not user_id:
|
164 |
await m.reply_text(
|
|
|
88 |
except UserNotParticipant:
|
89 |
if already_approved: # If user is approved and not in chat, unapprove them.
|
90 |
db.remove_approve(user_id)
|
91 |
+
LOGGER.info(
|
92 |
+
f"{user_id} disapproved in {m.chat.id} as UserNotParticipant")
|
93 |
await m.reply_text("This user is not in this chat, unapproved them.")
|
94 |
return
|
95 |
except RPCError as ef:
|
|
|
159 |
except Exception:
|
160 |
return
|
161 |
check_approve = db.check_approve(user_id)
|
162 |
+
LOGGER.info(
|
163 |
+
f"{m.from_user.id} checking approval of {user_id} in {m.chat.id}")
|
164 |
|
165 |
if not user_id:
|
166 |
await m.reply_text(
|
Powers/plugins/bans.py
CHANGED
@@ -912,7 +912,8 @@ async def kickme(_, m: Message):
|
|
912 |
if len(m.text.split()) >= 2:
|
913 |
reason = m.text.split(None, 1)[1]
|
914 |
try:
|
915 |
-
LOGGER.info(
|
|
|
916 |
await m.chat.ban_member(m.from_user.id)
|
917 |
txt = "Why not let me help you!"
|
918 |
txt += f"\n<b>Reason</b>: {reason}" if reason else ""
|
|
|
912 |
if len(m.text.split()) >= 2:
|
913 |
reason = m.text.split(None, 1)[1]
|
914 |
try:
|
915 |
+
LOGGER.info(
|
916 |
+
f"{m.from_user.id} kickme used by {m.from_user.id} in {m.chat.id}")
|
917 |
await m.chat.ban_member(m.from_user.id)
|
918 |
txt = "Why not let me help you!"
|
919 |
txt += f"\n<b>Reason</b>: {reason}" if reason else ""
|
Powers/plugins/blacklist.py
CHANGED
@@ -55,7 +55,8 @@ async def add_blacklist(_, m: Message):
|
|
55 |
", ".join([f"<code>{i}</code>" for i in bl_words])
|
56 |
+ " already added in blacklist, skipped them!"
|
57 |
)
|
58 |
-
LOGGER.info(
|
|
|
59 |
trigger = ", ".join(f"<code>{i}</code>" for i in bl_words)
|
60 |
await m.reply_text(
|
61 |
text=f"Added <code>{trigger}</code> in blacklist words!"
|
@@ -110,10 +111,12 @@ async def rm_blacklist(_, m: Message):
|
|
110 |
|
111 |
if non_found_words:
|
112 |
rep_text = (
|
113 |
-
"Could not find " +
|
|
|
114 |
) + " in blcklisted words, skipped them."
|
115 |
|
116 |
-
LOGGER.info(
|
|
|
117 |
bl_words = ", ".join(f"<code>{i}</code>" for i in bl_words)
|
118 |
await m.reply_text(
|
119 |
text=f"Removed <b>{bl_words}</b> from blacklist words!"
|
@@ -148,7 +151,8 @@ async def set_bl_action(_, m: Message):
|
|
148 |
await m.reply_text(text=f"Set action for blacklist for this to <b>{action}</b>")
|
149 |
elif len(m.text.split()) == 1:
|
150 |
action = db.get_action()
|
151 |
-
LOGGER.info(
|
|
|
152 |
await m.reply_text(
|
153 |
text=f"""The current action for blacklists in this chat is <i><b>{action}</b></i>
|
154 |
All blacklist modes delete the message containing blacklist word."""
|
|
|
55 |
", ".join([f"<code>{i}</code>" for i in bl_words])
|
56 |
+ " already added in blacklist, skipped them!"
|
57 |
)
|
58 |
+
LOGGER.info(
|
59 |
+
f"{m.from_user.id} added new blacklists ({bl_words}) in {m.chat.id}")
|
60 |
trigger = ", ".join(f"<code>{i}</code>" for i in bl_words)
|
61 |
await m.reply_text(
|
62 |
text=f"Added <code>{trigger}</code> in blacklist words!"
|
|
|
111 |
|
112 |
if non_found_words:
|
113 |
rep_text = (
|
114 |
+
"Could not find " +
|
115 |
+
", ".join(f"<code>{i}</code>" for i in non_found_words)
|
116 |
) + " in blcklisted words, skipped them."
|
117 |
|
118 |
+
LOGGER.info(
|
119 |
+
f"{m.from_user.id} removed blacklists ({bl_words}) in {m.chat.id}")
|
120 |
bl_words = ", ".join(f"<code>{i}</code>" for i in bl_words)
|
121 |
await m.reply_text(
|
122 |
text=f"Removed <b>{bl_words}</b> from blacklist words!"
|
|
|
151 |
await m.reply_text(text=f"Set action for blacklist for this to <b>{action}</b>")
|
152 |
elif len(m.text.split()) == 1:
|
153 |
action = db.get_action()
|
154 |
+
LOGGER.info(
|
155 |
+
f"{m.from_user.id} checking blacklist action in {m.chat.id}")
|
156 |
await m.reply_text(
|
157 |
text=f"""The current action for blacklists in this chat is <i><b>{action}</b></i>
|
158 |
All blacklist modes delete the message containing blacklist word."""
|
Powers/plugins/chat_blacklist.py
CHANGED
@@ -42,7 +42,8 @@ async def unblacklist_chat(c: Gojo, m: Message):
|
|
42 |
if len(m.text.split()) >= 2:
|
43 |
chat_ids = m.text.split()[1:]
|
44 |
replymsg = await m.reply_text(f"Removing {len(chat_ids)} chats from blacklist")
|
45 |
-
LOGGER.info(
|
|
|
46 |
bl_chats = db.list_all_chats()
|
47 |
for chat in chat_ids:
|
48 |
try:
|
|
|
42 |
if len(m.text.split()) >= 2:
|
43 |
chat_ids = m.text.split()[1:]
|
44 |
replymsg = await m.reply_text(f"Removing {len(chat_ids)} chats from blacklist")
|
45 |
+
LOGGER.info(
|
46 |
+
f"{m.from_user.id} removed blacklisted {chat_ids} groups for bot")
|
47 |
bl_chats = db.list_all_chats()
|
48 |
for chat in chat_ids:
|
49 |
try:
|
Powers/plugins/dev.py
CHANGED
@@ -129,7 +129,8 @@ async def evaluate_code(c: Gojo, m: Message):
|
|
129 |
|
130 |
|
131 |
async def aexec(code, c, m):
|
132 |
-
exec("async def __aexec(c, m): " +
|
|
|
133 |
return await locals()["__aexec"](c, m)
|
134 |
|
135 |
|
|
|
129 |
|
130 |
|
131 |
async def aexec(code, c, m):
|
132 |
+
exec("async def __aexec(c, m): " +
|
133 |
+
"".join(f"\n {l}" for l in code.split("\n")))
|
134 |
return await locals()["__aexec"](c, m)
|
135 |
|
136 |
|
Powers/plugins/disable.py
CHANGED
@@ -116,7 +116,8 @@ async def rm_alldisbl(_, m: Message):
|
|
116 |
"Confirm",
|
117 |
callback_data="enableallcmds",
|
118 |
),
|
119 |
-
InlineKeyboardButton(
|
|
|
120 |
],
|
121 |
],
|
122 |
),
|
|
|
116 |
"Confirm",
|
117 |
callback_data="enableallcmds",
|
118 |
),
|
119 |
+
InlineKeyboardButton(
|
120 |
+
"Cancel", callback_data="close_admin"),
|
121 |
],
|
122 |
],
|
123 |
),
|
Powers/plugins/filters.py
CHANGED
@@ -95,7 +95,8 @@ async def add_filter(_, m: Message):
|
|
95 |
)
|
96 |
|
97 |
add = db.save_filter(m.chat.id, keyword, teks, msgtype, file_id)
|
98 |
-
LOGGER.info(
|
|
|
99 |
if add:
|
100 |
await m.reply_text(
|
101 |
f"Saved filter for '<code>{', '.join(keyword.split('|'))}</code>' in <b>{m.chat.title}</b>!",
|
@@ -119,7 +120,8 @@ async def stop_filter(_, m: Message):
|
|
119 |
for keyword in act_filters:
|
120 |
if keyword == m.text.split(None, 1)[1].lower():
|
121 |
db.rm_filter(m.chat.id, m.text.split(None, 1)[1].lower())
|
122 |
-
LOGGER.info(
|
|
|
123 |
await m.reply_text(
|
124 |
f"Okay, I'll stop replying to that filter and it's aliases in <b>{m.chat.title}</b>.",
|
125 |
)
|
@@ -280,7 +282,8 @@ async def filters_watcher(c: Gojo, m: Message):
|
|
280 |
if match:
|
281 |
try:
|
282 |
msgtype = await send_filter_reply(c, m, trigger)
|
283 |
-
LOGGER.info(
|
|
|
284 |
except Exception as ef:
|
285 |
await m.reply_text(f"Error: {ef}")
|
286 |
LOGGER.error(ef)
|
|
|
95 |
)
|
96 |
|
97 |
add = db.save_filter(m.chat.id, keyword, teks, msgtype, file_id)
|
98 |
+
LOGGER.info(
|
99 |
+
f"{m.from_user.id} added new filter ({keyword}) in {m.chat.id}")
|
100 |
if add:
|
101 |
await m.reply_text(
|
102 |
f"Saved filter for '<code>{', '.join(keyword.split('|'))}</code>' in <b>{m.chat.title}</b>!",
|
|
|
120 |
for keyword in act_filters:
|
121 |
if keyword == m.text.split(None, 1)[1].lower():
|
122 |
db.rm_filter(m.chat.id, m.text.split(None, 1)[1].lower())
|
123 |
+
LOGGER.info(
|
124 |
+
f"{m.from_user.id} removed filter ({keyword}) in {m.chat.id}")
|
125 |
await m.reply_text(
|
126 |
f"Okay, I'll stop replying to that filter and it's aliases in <b>{m.chat.title}</b>.",
|
127 |
)
|
|
|
282 |
if match:
|
283 |
try:
|
284 |
msgtype = await send_filter_reply(c, m, trigger)
|
285 |
+
LOGGER.info(
|
286 |
+
f"Replied with {msgtype} to {trigger} in {m.chat.id}")
|
287 |
except Exception as ef:
|
288 |
await m.reply_text(f"Error: {ef}")
|
289 |
LOGGER.error(ef)
|
Powers/plugins/fun.py
CHANGED
@@ -72,7 +72,8 @@ async def fun_slap(c: Gojo, m: Message):
|
|
72 |
hit = choice(extras.HIT)
|
73 |
throw = choice(extras.THROW)
|
74 |
|
75 |
-
reply = temp.format(user1=user1, user2=user2,
|
|
|
76 |
await reply_text(reply)
|
77 |
LOGGER.info(f"{m.from_user.id} slaped in {m.chat.id}")
|
78 |
return
|
@@ -111,7 +112,8 @@ async def insult(c: Gojo, m: Message):
|
|
111 |
m.reply_to_message.reply_text if m.reply_to_message else m.reply_text
|
112 |
)
|
113 |
await reply_text(Insult_omp)
|
114 |
-
LOGGER.info(
|
|
|
115 |
|
116 |
|
117 |
@Gojo.on_message(command("yes"))
|
|
|
72 |
hit = choice(extras.HIT)
|
73 |
throw = choice(extras.THROW)
|
74 |
|
75 |
+
reply = temp.format(user1=user1, user2=user2,
|
76 |
+
item=item, hits=hit, throws=throw)
|
77 |
await reply_text(reply)
|
78 |
LOGGER.info(f"{m.from_user.id} slaped in {m.chat.id}")
|
79 |
return
|
|
|
112 |
m.reply_to_message.reply_text if m.reply_to_message else m.reply_text
|
113 |
)
|
114 |
await reply_text(Insult_omp)
|
115 |
+
LOGGER.info(
|
116 |
+
f"{m.from_user.id} insulted {user_first_name} in {m.chat.id}")
|
117 |
|
118 |
|
119 |
@Gojo.on_message(command("yes"))
|
Powers/plugins/locks.py
CHANGED
@@ -55,7 +55,8 @@ async def lock_perm(c: Gojo, m: Message):
|
|
55 |
if lock_type == "all":
|
56 |
try:
|
57 |
await c.set_chat_permissions(chat_id, ChatPermissions())
|
58 |
-
LOGGER.info(
|
|
|
59 |
except ChatNotModified:
|
60 |
pass
|
61 |
except ChatAdminRequired:
|
@@ -122,7 +123,8 @@ async def lock_perm(c: Gojo, m: Message):
|
|
122 |
ChatPermissions(
|
123 |
can_send_messages=msg,
|
124 |
can_send_media_messages=media,
|
125 |
-
can_send_other_messages=any(
|
|
|
126 |
can_add_web_page_previews=webprev,
|
127 |
can_send_polls=polls,
|
128 |
can_change_info=info,
|
@@ -130,7 +132,8 @@ async def lock_perm(c: Gojo, m: Message):
|
|
130 |
can_pin_messages=pin,
|
131 |
),
|
132 |
)
|
133 |
-
LOGGER.info(
|
|
|
134 |
except ChatNotModified:
|
135 |
pass
|
136 |
except ChatAdminRequired:
|
@@ -212,7 +215,8 @@ async def unlock_perm(c: Gojo, m: Message):
|
|
212 |
can_pin_messages=True,
|
213 |
),
|
214 |
)
|
215 |
-
LOGGER.info(
|
|
|
216 |
except ChatNotModified:
|
217 |
pass
|
218 |
except ChatAdminRequired:
|
@@ -285,7 +289,8 @@ async def unlock_perm(c: Gojo, m: Message):
|
|
285 |
return
|
286 |
|
287 |
try:
|
288 |
-
LOGGER.info(
|
|
|
289 |
await c.set_chat_permissions(
|
290 |
chat_id,
|
291 |
ChatPermissions(
|
|
|
55 |
if lock_type == "all":
|
56 |
try:
|
57 |
await c.set_chat_permissions(chat_id, ChatPermissions())
|
58 |
+
LOGGER.info(
|
59 |
+
f"{m.from_user.id} locked all permissions in {m.chat.id}")
|
60 |
except ChatNotModified:
|
61 |
pass
|
62 |
except ChatAdminRequired:
|
|
|
123 |
ChatPermissions(
|
124 |
can_send_messages=msg,
|
125 |
can_send_media_messages=media,
|
126 |
+
can_send_other_messages=any(
|
127 |
+
[stickers, animations, games, inlinebots]),
|
128 |
can_add_web_page_previews=webprev,
|
129 |
can_send_polls=polls,
|
130 |
can_change_info=info,
|
|
|
132 |
can_pin_messages=pin,
|
133 |
),
|
134 |
)
|
135 |
+
LOGGER.info(
|
136 |
+
f"{m.from_user.id} locked selected permissions in {m.chat.id}")
|
137 |
except ChatNotModified:
|
138 |
pass
|
139 |
except ChatAdminRequired:
|
|
|
215 |
can_pin_messages=True,
|
216 |
),
|
217 |
)
|
218 |
+
LOGGER.info(
|
219 |
+
f"{m.from_user.id} unlocked all permissions in {m.chat.id}")
|
220 |
except ChatNotModified:
|
221 |
pass
|
222 |
except ChatAdminRequired:
|
|
|
289 |
return
|
290 |
|
291 |
try:
|
292 |
+
LOGGER.info(
|
293 |
+
f"{m.from_user.id} unlocked selected permissions in {m.chat.id}")
|
294 |
await c.set_chat_permissions(
|
295 |
chat_id,
|
296 |
ChatPermissions(
|
Powers/plugins/notes.py
CHANGED
@@ -73,7 +73,8 @@ async def get_note_func(c: Gojo, m: Message, note_name, priv_notes_status):
|
|
73 |
|
74 |
if priv_notes_status:
|
75 |
|
76 |
-
note_hash = next(i[1] for i in db.get_all_notes(
|
|
|
77 |
await reply_text(
|
78 |
f"Click on the button to get the note <code>{note_name}</code>",
|
79 |
reply_markup=ikb(
|
@@ -299,11 +300,13 @@ async def priv_notes(_, m: Message):
|
|
299 |
option = (m.text.split())[1]
|
300 |
if option in ("on", "yes"):
|
301 |
db_settings.set_privatenotes(chat_id, True)
|
302 |
-
LOGGER.info(
|
|
|
303 |
msg = "Set private notes to On"
|
304 |
elif option in ("off", "no"):
|
305 |
db_settings.set_privatenotes(chat_id, False)
|
306 |
-
LOGGER.info(
|
|
|
307 |
msg = "Set private notes to Off"
|
308 |
else:
|
309 |
msg = "Enter correct option"
|
@@ -311,7 +314,8 @@ async def priv_notes(_, m: Message):
|
|
311 |
elif len(m.text.split()) == 1:
|
312 |
curr_pref = db_settings.get_privatenotes(m.chat.id)
|
313 |
msg = msg = f"Private Notes: {curr_pref}"
|
314 |
-
LOGGER.info(
|
|
|
315 |
await m.reply_text(msg)
|
316 |
else:
|
317 |
await m.replt_text("Check help on how to use this command!")
|
|
|
73 |
|
74 |
if priv_notes_status:
|
75 |
|
76 |
+
note_hash = next(i[1] for i in db.get_all_notes(
|
77 |
+
m.chat.id) if i[0] == note_name)
|
78 |
await reply_text(
|
79 |
f"Click on the button to get the note <code>{note_name}</code>",
|
80 |
reply_markup=ikb(
|
|
|
300 |
option = (m.text.split())[1]
|
301 |
if option in ("on", "yes"):
|
302 |
db_settings.set_privatenotes(chat_id, True)
|
303 |
+
LOGGER.info(
|
304 |
+
f"{m.from_user.id} enabled privatenotes in {m.chat.id}")
|
305 |
msg = "Set private notes to On"
|
306 |
elif option in ("off", "no"):
|
307 |
db_settings.set_privatenotes(chat_id, False)
|
308 |
+
LOGGER.info(
|
309 |
+
f"{m.from_user.id} disabled privatenotes in {m.chat.id}")
|
310 |
msg = "Set private notes to Off"
|
311 |
else:
|
312 |
msg = "Enter correct option"
|
|
|
314 |
elif len(m.text.split()) == 1:
|
315 |
curr_pref = db_settings.get_privatenotes(m.chat.id)
|
316 |
msg = msg = f"Private Notes: {curr_pref}"
|
317 |
+
LOGGER.info(
|
318 |
+
f"{m.from_user.id} fetched privatenotes preference in {m.chat.id}")
|
319 |
await m.reply_text(msg)
|
320 |
else:
|
321 |
await m.replt_text("Check help on how to use this command!")
|
Powers/plugins/pin.py
CHANGED
@@ -92,7 +92,8 @@ async def unpin_message(c: Gojo, m: Message):
|
|
92 |
async def unpinall_message(_, m: Message):
|
93 |
await m.reply_text(
|
94 |
"Do you really want to unpin all messages in this chat?",
|
95 |
-
reply_markup=ikb(
|
|
|
96 |
)
|
97 |
return
|
98 |
|
@@ -115,7 +116,8 @@ async def unpinall_calllback(c: Gojo, q: CallbackQuery):
|
|
115 |
return
|
116 |
try:
|
117 |
await c.unpin_all_chat_messages(q.message.chat.id)
|
118 |
-
LOGGER.info(
|
|
|
119 |
await q.message.edit_text(text="Unpinned all messages in this chat.")
|
120 |
except ChatAdminRequired:
|
121 |
await q.message.edit_text(text="I'm not admin or I don't have rights.")
|
@@ -143,11 +145,13 @@ async def anti_channel_pin(_, m: Message):
|
|
143 |
if len(m.text.split()) == 2:
|
144 |
if m.command[1] in ("yes", "on", "true"):
|
145 |
pinsdb.antichannelpin_on()
|
146 |
-
LOGGER.info(
|
|
|
147 |
msg = "Turned on AntiChannelPin, now all message pinned by channel will be unpinned automtically!"
|
148 |
elif m.command[1] in ("no", "off", "false"):
|
149 |
pinsdb.antichannelpin_off()
|
150 |
-
LOGGER.info(
|
|
|
151 |
msg = "Turned off AntiChannelPin, now all message pinned by channel will stay pinned!"
|
152 |
else:
|
153 |
await m.reply_text(
|
@@ -199,7 +203,8 @@ async def clean_linked(_, m: Message):
|
|
199 |
msg = "Turned on CleanLinked! Now all the messages from linked channel will be deleted!"
|
200 |
elif m.command[1] in ("no", "off", "false"):
|
201 |
pinsdb.cleanlinked_off()
|
202 |
-
LOGGER.info(
|
|
|
203 |
msg = "Turned off CleanLinked! Messages from linked channel will not be deleted!"
|
204 |
else:
|
205 |
await m.reply_text(
|
|
|
92 |
async def unpinall_message(_, m: Message):
|
93 |
await m.reply_text(
|
94 |
"Do you really want to unpin all messages in this chat?",
|
95 |
+
reply_markup=ikb(
|
96 |
+
[[("Yes", "unpin all in this chat"), ("No", "close_admin")]]),
|
97 |
)
|
98 |
return
|
99 |
|
|
|
116 |
return
|
117 |
try:
|
118 |
await c.unpin_all_chat_messages(q.message.chat.id)
|
119 |
+
LOGGER.info(
|
120 |
+
f"{q.from_user.id} unpinned all messages in {q.message.chat.id}")
|
121 |
await q.message.edit_text(text="Unpinned all messages in this chat.")
|
122 |
except ChatAdminRequired:
|
123 |
await q.message.edit_text(text="I'm not admin or I don't have rights.")
|
|
|
145 |
if len(m.text.split()) == 2:
|
146 |
if m.command[1] in ("yes", "on", "true"):
|
147 |
pinsdb.antichannelpin_on()
|
148 |
+
LOGGER.info(
|
149 |
+
f"{m.from_user.id} enabled antichannelpin in {m.chat.id}")
|
150 |
msg = "Turned on AntiChannelPin, now all message pinned by channel will be unpinned automtically!"
|
151 |
elif m.command[1] in ("no", "off", "false"):
|
152 |
pinsdb.antichannelpin_off()
|
153 |
+
LOGGER.info(
|
154 |
+
f"{m.from_user.id} disabled antichannelpin in {m.chat.id}")
|
155 |
msg = "Turned off AntiChannelPin, now all message pinned by channel will stay pinned!"
|
156 |
else:
|
157 |
await m.reply_text(
|
|
|
203 |
msg = "Turned on CleanLinked! Now all the messages from linked channel will be deleted!"
|
204 |
elif m.command[1] in ("no", "off", "false"):
|
205 |
pinsdb.cleanlinked_off()
|
206 |
+
LOGGER.info(
|
207 |
+
f"{m.from_user.id} disabled CleanLinked in {m.chat.id}")
|
208 |
msg = "Turned off CleanLinked! Messages from linked channel will not be deleted!"
|
209 |
else:
|
210 |
await m.reply_text(
|
Powers/plugins/rules.py
CHANGED
@@ -93,11 +93,13 @@ async def priv_rules(_, m: Message):
|
|
93 |
option = (m.text.split())[1]
|
94 |
if option in ("on", "yes"):
|
95 |
db.set_privrules(True)
|
96 |
-
LOGGER.info(
|
|
|
97 |
msg = f"Private Rules have been turned <b>on</b> for chat <b>{m.chat.title}</b>"
|
98 |
elif option in ("off", "no"):
|
99 |
db.set_privrules(False)
|
100 |
-
LOGGER.info(
|
|
|
101 |
msg = f"Private Rules have been turned <b>off</b> for chat <b>{m.chat.title}</b>"
|
102 |
else:
|
103 |
msg = "Option not valid, choose from <code>on</code>, <code>yes</code>, <code>off</code>, <code>no</code>"
|
@@ -107,7 +109,8 @@ async def priv_rules(_, m: Message):
|
|
107 |
msg = (
|
108 |
f"Current Preference for Private rules in this chat is: <b>{curr_pref}</b>"
|
109 |
)
|
110 |
-
LOGGER.info(
|
|
|
111 |
await m.reply_text(msg)
|
112 |
else:
|
113 |
await m.reply_text(text="Please check help on how to use this this command.")
|
|
|
93 |
option = (m.text.split())[1]
|
94 |
if option in ("on", "yes"):
|
95 |
db.set_privrules(True)
|
96 |
+
LOGGER.info(
|
97 |
+
f"{m.from_user.id} enabled privaterules in {m.chat.id}")
|
98 |
msg = f"Private Rules have been turned <b>on</b> for chat <b>{m.chat.title}</b>"
|
99 |
elif option in ("off", "no"):
|
100 |
db.set_privrules(False)
|
101 |
+
LOGGER.info(
|
102 |
+
f"{m.from_user.id} disbaled privaterules in {m.chat.id}")
|
103 |
msg = f"Private Rules have been turned <b>off</b> for chat <b>{m.chat.title}</b>"
|
104 |
else:
|
105 |
msg = "Option not valid, choose from <code>on</code>, <code>yes</code>, <code>off</code>, <code>no</code>"
|
|
|
109 |
msg = (
|
110 |
f"Current Preference for Private rules in this chat is: <b>{curr_pref}</b>"
|
111 |
)
|
112 |
+
LOGGER.info(
|
113 |
+
f"{m.from_user.id} fetched privaterules preference in {m.chat.id}")
|
114 |
await m.reply_text(msg)
|
115 |
else:
|
116 |
await m.reply_text(text="Please check help on how to use this this command.")
|
Powers/plugins/start.py
CHANGED
@@ -69,7 +69,8 @@ async def start(c: Gojo, m: Message):
|
|
69 |
await get_private_note(c, m, help_option)
|
70 |
return
|
71 |
if help_option.startswith("rules"):
|
72 |
-
LOGGER.info(
|
|
|
73 |
await get_private_rules(c, m, help_option)
|
74 |
return
|
75 |
|
@@ -181,7 +182,8 @@ async def help_menu(_, m: Message):
|
|
181 |
help_msg, help_kb = await get_help_msg(m, help_option)
|
182 |
|
183 |
if not help_msg:
|
184 |
-
LOGGER.error(
|
|
|
185 |
return
|
186 |
|
187 |
LOGGER.info(
|
|
|
69 |
await get_private_note(c, m, help_option)
|
70 |
return
|
71 |
if help_option.startswith("rules"):
|
72 |
+
LOGGER.info(
|
73 |
+
f"{m.from_user.id} fetched privaterules in {m.chat.id}")
|
74 |
await get_private_rules(c, m, help_option)
|
75 |
return
|
76 |
|
|
|
182 |
help_msg, help_kb = await get_help_msg(m, help_option)
|
183 |
|
184 |
if not help_msg:
|
185 |
+
LOGGER.error(
|
186 |
+
f"No help_msg found for help_option - {help_option}!!")
|
187 |
return
|
188 |
|
189 |
LOGGER.info(
|
Powers/plugins/warns.py
CHANGED
@@ -204,7 +204,8 @@ async def list_warns(c: Gojo, m: Message):
|
|
204 |
await m.reply_text("This user has no warns!")
|
205 |
return
|
206 |
msg = f"{(await mention_html(user_first_name,user_id))} has <b>{num_warns}/{warn_settings['warn_limit']}</b> warns!\n\n<b>Reasons:</b>\n"
|
207 |
-
msg += "\n".join(
|
|
|
208 |
await m.reply_text(msg)
|
209 |
return
|
210 |
|
|
|
204 |
await m.reply_text("This user has no warns!")
|
205 |
return
|
206 |
msg = f"{(await mention_html(user_first_name,user_id))} has <b>{num_warns}/{warn_settings['warn_limit']}</b> warns!\n\n<b>Reasons:</b>\n"
|
207 |
+
msg += "\n".join(
|
208 |
+
[("- No reason" if i is None else f" - {i}") for i in warns])
|
209 |
await m.reply_text(msg)
|
210 |
return
|
211 |
|
Powers/plugins/watchers.py
CHANGED
@@ -29,16 +29,19 @@ async def antichanpin_cleanlinked(c: Gojo, m: Message):
|
|
29 |
curr = pins_db.get_settings()
|
30 |
if curr["antichannelpin"]:
|
31 |
await c.unpin_chat_message(chat_id=m.chat.id, message_id=msg_id)
|
32 |
-
LOGGER.info(
|
|
|
33 |
if curr["cleanlinked"]:
|
34 |
await c.delete_messages(m.chat.id, msg_id)
|
35 |
-
LOGGER.info(
|
|
|
36 |
except ChatAdminRequired:
|
37 |
await m.reply_text(
|
38 |
"Disabled antichannelpin as I don't have enough admin rights!",
|
39 |
)
|
40 |
pins_db.antichannelpin_off()
|
41 |
-
LOGGER.warning(
|
|
|
42 |
except Exception as ef:
|
43 |
LOGGER.error(ef)
|
44 |
LOGGER.error(format_exc())
|
@@ -189,7 +192,8 @@ async def gban_watcher(c: Gojo, m: Message):
|
|
189 |
|
190 |
To get unbanned, appeal at @{SUPPORT_GROUP}"""
|
191 |
)
|
192 |
-
LOGGER.info(
|
|
|
193 |
return
|
194 |
except (ChatAdminRequired, UserAdminInvalid):
|
195 |
# Bot not admin in group and hence cannot ban users!
|
|
|
29 |
curr = pins_db.get_settings()
|
30 |
if curr["antichannelpin"]:
|
31 |
await c.unpin_chat_message(chat_id=m.chat.id, message_id=msg_id)
|
32 |
+
LOGGER.info(
|
33 |
+
f"AntiChannelPin: msgid-{m.message_id} unpinned in {m.chat.id}")
|
34 |
if curr["cleanlinked"]:
|
35 |
await c.delete_messages(m.chat.id, msg_id)
|
36 |
+
LOGGER.info(
|
37 |
+
f"CleanLinked: msgid-{m.message_id} cleaned in {m.chat.id}")
|
38 |
except ChatAdminRequired:
|
39 |
await m.reply_text(
|
40 |
"Disabled antichannelpin as I don't have enough admin rights!",
|
41 |
)
|
42 |
pins_db.antichannelpin_off()
|
43 |
+
LOGGER.warning(
|
44 |
+
f"Disabled antichannelpin in {m.chat.id} as i'm not an admin.")
|
45 |
except Exception as ef:
|
46 |
LOGGER.error(ef)
|
47 |
LOGGER.error(format_exc())
|
|
|
192 |
|
193 |
To get unbanned, appeal at @{SUPPORT_GROUP}"""
|
194 |
)
|
195 |
+
LOGGER.info(
|
196 |
+
f"Banned user {m.from_user.id} in {m.chat.id} due to antispam")
|
197 |
return
|
198 |
except (ChatAdminRequired, UserAdminInvalid):
|
199 |
# Bot not admin in group and hence cannot ban users!
|