Merge pull request #41 from Infamous-Hydra/Infamous-Hydra-patch-13
Browse files
Mikobot/plugins/helper_funcs/chat_status.py
CHANGED
@@ -194,6 +194,10 @@ def is_support_plus(chat: Chat, user_id: int, member: ChatMember = None) -> bool
|
|
194 |
return user_id in DRAGONS or user_id in DEV_USERS
|
195 |
|
196 |
|
|
|
|
|
|
|
|
|
197 |
async def is_user_admin(chat: Chat, user_id: int, member: ChatMember = None) -> bool:
|
198 |
if (
|
199 |
chat.type == "private"
|
@@ -261,6 +265,58 @@ async def is_user_in_chat(chat: Chat, user_id: int) -> bool:
|
|
261 |
return member.status in (ChatMemberStatus.LEFT, ChatMemberStatus.RESTRICTED)
|
262 |
|
263 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
264 |
def support_plus(func):
|
265 |
@wraps(func)
|
266 |
async def is_support_plus_func(
|
|
|
194 |
return user_id in DRAGONS or user_id in DEV_USERS
|
195 |
|
196 |
|
197 |
+
def is_sudo_plus(chat: Chat, user_id: int, member: ChatMember = None) -> bool:
|
198 |
+
return user_id in DRAGONS or user_id in DEV_USERS
|
199 |
+
|
200 |
+
|
201 |
async def is_user_admin(chat: Chat, user_id: int, member: ChatMember = None) -> bool:
|
202 |
if (
|
203 |
chat.type == "private"
|
|
|
265 |
return member.status in (ChatMemberStatus.LEFT, ChatMemberStatus.RESTRICTED)
|
266 |
|
267 |
|
268 |
+
def dev_plus(func):
|
269 |
+
@wraps(func)
|
270 |
+
def is_dev_plus_func(
|
271 |
+
update: Update, context: ContextTypes.DEFAULT_TYPE, *args, **kwargs
|
272 |
+
):
|
273 |
+
context.bot
|
274 |
+
user = update.effective_user
|
275 |
+
|
276 |
+
if user.id in DEV_USERS:
|
277 |
+
return func(update, context, *args, **kwargs)
|
278 |
+
elif not user:
|
279 |
+
pass
|
280 |
+
elif DEL_CMDS and " " not in update.effective_message.text:
|
281 |
+
try:
|
282 |
+
update.effective_message.delete()
|
283 |
+
except:
|
284 |
+
pass
|
285 |
+
else:
|
286 |
+
update.effective_message.reply_text(
|
287 |
+
"This is a developer restricted command."
|
288 |
+
" You do not have permissions to run this."
|
289 |
+
)
|
290 |
+
|
291 |
+
return is_dev_plus_func
|
292 |
+
|
293 |
+
|
294 |
+
def sudo_plus(func):
|
295 |
+
@wraps(func)
|
296 |
+
def is_sudo_plus_func(
|
297 |
+
update: Update, context: ContextTypes.DEFAULT_TYPE, *args, **kwargs
|
298 |
+
):
|
299 |
+
context.bot
|
300 |
+
user = update.effective_user
|
301 |
+
chat = update.effective_chat
|
302 |
+
|
303 |
+
if user and is_sudo_plus(chat, user.id):
|
304 |
+
return func(update, context, *args, **kwargs)
|
305 |
+
elif not user:
|
306 |
+
pass
|
307 |
+
elif DEL_CMDS and " " not in update.effective_message.text:
|
308 |
+
try:
|
309 |
+
update.effective_message.delete()
|
310 |
+
except:
|
311 |
+
pass
|
312 |
+
else:
|
313 |
+
update.effective_message.reply_text(
|
314 |
+
"Who dis non-admin telling me what to do? You want a punch?"
|
315 |
+
)
|
316 |
+
|
317 |
+
return is_sudo_plus_func
|
318 |
+
|
319 |
+
|
320 |
def support_plus(func):
|
321 |
@wraps(func)
|
322 |
async def is_support_plus_func(
|