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