Skip to content

Commit

Permalink
gadmin fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
K-E-N-W-A-Y committed Apr 23, 2020
1 parent e9ed6d2 commit 5d14e45
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 48 deletions.
81 changes: 41 additions & 40 deletions userge/plugins/admin/gadmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
# All rights reserved.

import time
from userge import userge, Message
from pyrogram import ChatPermissions
from pyrogram.errors import (FloodWait,
UserAdminInvalid,
UsernameInvalid,
ChatAdminRequired,
PeerIdInvalid,
UserIdInvalid)
UserAdminInvalid,
UsernameInvalid,
ChatAdminRequired,
PeerIdInvalid,
UserIdInvalid)
from userge import userge, Message

CHANNEL = userge.getCLogger(__name__)

Expand Down Expand Up @@ -104,7 +104,7 @@ async def promote_usr(message: Message):

except UsernameInvalid:
await message.edit(
text="`invalid username or userid, try again with valid info ⚠`", del_in=0
text="`invalid username, try again with valid info ⚠`", del_in=0
)
return

Expand All @@ -116,19 +116,19 @@ async def promote_usr(message: Message):

except UserIdInvalid:
await message.edit(
text="`invalid username or userid, try again with valid info ⚠`", del_in=0
text="`invalid userid, try again with valid info ⚠`", del_in=0
)
return

except ChatAdminRequired:
await message.edit(
text=r"`i don't have permission to do that` >︿<", del_in=0
text=r"`i don't have permission to do that >︿<`", del_in=0
)
return

except Exception as e:
await message.edit(
text="something went wrong! 🤔\n"
text="something went wrong! 🤔\n\n"
f"**ERROR:** `{e}`"
)
return
Expand Down Expand Up @@ -157,7 +157,7 @@ async def promote_usr(message: Message):

except ChatAdminRequired:
await message.edit(
text=r"`i don't have permission to do that` >︿<", del_in=0
text=r"`i don't have permission to do that >︿<`", del_in=0
)
return

Expand Down Expand Up @@ -227,7 +227,7 @@ async def demote_usr(message: Message):

except UsernameInvalid:
await message.edit(
text="`invalid username or userid, try again with valid info ⚠`", del_in=0
text="`invalid username, try again with valid info ⚠`", del_in=0
)
return

Expand All @@ -239,13 +239,13 @@ async def demote_usr(message: Message):

except UserIdInvalid:
await message.edit(
text="`invalid username or userid, try again with valid info ⚠`", del_in=0
text="`invalid userid, try again with valid info ⚠`", del_in=0
)
return

except ChatAdminRequired:
await message.edit(
text=r"`i don't have permission to do that` >︿<", del_in=0
text=r"`i don't have permission to do that >︿<`", del_in=0
)
return

Expand Down Expand Up @@ -279,7 +279,7 @@ async def demote_usr(message: Message):

except ChatAdminRequired:
await message.edit(
text=r"`i don't have permission to do that` >︿<", del_in=0
text=r"`i don't have permission to do that >︿<`", del_in=0
)
return

Expand Down Expand Up @@ -355,7 +355,7 @@ async def ban_usr(message: Message):

except UsernameInvalid:
await message.edit(
text="`invalid username or userid, try again with valid info ⚠`", del_in=0
text="`invalid username, try again with valid info ⚠`", del_in=0
)
return

Expand All @@ -367,13 +367,13 @@ async def ban_usr(message: Message):

except UserIdInvalid:
await message.edit(
text="`invalid username or userid, try again with valid info ⚠`", del_in=0
text="`invalid userid, try again with valid info ⚠`", del_in=0
)
return

except ChatAdminRequired:
await message.edit(
text=r"`i don't have permission to do that` >︿<", del_in=0
text=r"`i don't have permission to do that >︿<`", del_in=0
)
return

Expand Down Expand Up @@ -428,7 +428,7 @@ async def unban_usr(message: Message):

except UsernameInvalid:
await message.edit(
text="`invalid username or userid, try again with valid info ⚠`", del_in=0
text="`invalid username, try again with valid info ⚠`", del_in=0
)
return

Expand All @@ -440,7 +440,7 @@ async def unban_usr(message: Message):

except UserIdInvalid:
await message.edit(
text="`invalid username or userid, try again with valid info ⚠`", del_in=0
text="`invalid userid, try again with valid info ⚠`", del_in=0
)
return

Expand Down Expand Up @@ -523,7 +523,7 @@ async def kick_usr(message: Message):

except UsernameInvalid:
await message.edit(
text="`invalid username or userid, try again with valid info ⚠`", del_in=0
text="`invalid username, try again with valid info ⚠`", del_in=0
)
return

Expand All @@ -535,19 +535,19 @@ async def kick_usr(message: Message):

except UserIdInvalid:
await message.edit(
text="`invalid username or userid, try again with valid info ⚠`", del_in=0
text="`invalid userid, try again with valid info ⚠`", del_in=0
)
return

except ChatAdminRequired:
await message.edit(
text=r"`i don't have permission to do that` >︿<", del_in=0
text=r"`i don't have permission to do that >︿<`", del_in=0
)
return

except Exception as e:
await message.edit(
text="something went wrong! 🤔\n"
text="something went wrong! 🤔\n\n"
f"**ERROR:** `{e}`", del_in=0
)
return
Expand All @@ -568,7 +568,7 @@ async def kick_usr(message: Message):

except ChatAdminRequired:
await message.edit(
text=r"`i don't have permission to do that` >︿<", del_in=0
text=r"`i don't have permission to do that >︿<`", del_in=0
)
return

Expand Down Expand Up @@ -661,7 +661,7 @@ async def mute_usr(message: Message):

except UsernameInvalid:
await message.edit(
text="`invalid username or userid, try again with valid info ⚠`", del_in=0
text="`invalid username, try again with valid info ⚠`", del_in=0
)
return

Expand All @@ -673,13 +673,13 @@ async def mute_usr(message: Message):

except UserIdInvalid:
await message.edit(
text="`invalid username or userid, try again with valid info ⚠`", del_in=0
text="`invalid userid, try again with valid info ⚠`", del_in=0
)
return

except ChatAdminRequired:
await message.edit(
text=r"`i don't have permission to do that` >︿<", del_in=0
text=r"`i don't have permission to do that >︿<`", del_in=0
)
return

Expand Down Expand Up @@ -708,7 +708,7 @@ async def mute_usr(message: Message):

except UsernameInvalid:
await message.edit(
text="`invalid username or userid, try again with valid info ⚠`", del_in=0
text="`invalid username, try again with valid info ⚠`", del_in=0
)
return

Expand All @@ -720,13 +720,13 @@ async def mute_usr(message: Message):

except UserIdInvalid:
await message.edit(
text="`invalid username or userid, try again with valid info ⚠`", del_in=0
text="`invalid userid, try again with valid info ⚠`", del_in=0
)
return

except ChatAdminRequired:
await message.edit(
text=r"`i don't have permission to do that` >︿<", del_in=0
text=r"`i don't have permission to do that >︿<`", del_in=0
)
return

Expand Down Expand Up @@ -755,7 +755,7 @@ async def mute_usr(message: Message):

except UsernameInvalid:
await message.edit(
text="`invalid username or userid, try again with valid info ⚠`", del_in=0
text="`invalid username, try again with valid info ⚠`", del_in=0
)
return

Expand All @@ -767,13 +767,13 @@ async def mute_usr(message: Message):

except UserIdInvalid:
await message.edit(
text="`invalid username or userid, try again with valid info ⚠`", del_in=0
text="`invalid userid, try again with valid info ⚠`", del_in=0
)
return

except ChatAdminRequired:
await message.edit(
text=r"`i don't have permission to do that` >︿<", del_in=0
text=r"`i don't have permission to do that >︿<`", del_in=0
)
return

Expand All @@ -799,7 +799,7 @@ async def mute_usr(message: Message):

except UsernameInvalid:
await message.edit(
text="`invalid username or userid, try again with valid info ⚠`", del_in=0
text="`invalid username, try again with valid info ⚠`", del_in=0
)
return

Expand All @@ -811,13 +811,13 @@ async def mute_usr(message: Message):

except UserIdInvalid:
await message.edit(
text="`invalid username or userid, try again with valid info ⚠`", del_in=0
text="`invalid userid, try again with valid info ⚠`", del_in=0
)
return

except ChatAdminRequired:
await message.edit(
text=r"`i don't have permission to do that` >︿<", del_in=0
text=r"`i don't have permission to do that >︿<`", del_in=0
)
return

Expand Down Expand Up @@ -898,8 +898,9 @@ async def unmute_usr(message: Message):

except UsernameInvalid:
await message.edit(
text="`something went wrong 🤔,`"
"`do .help unmute for more info`", del_in=0)
text="`invalid username, try again with valid info ⚠`", del_in=0
)
return

except PeerIdInvalid:
await message.edit(
Expand All @@ -909,7 +910,7 @@ async def unmute_usr(message: Message):

except UserIdInvalid:
await message.edit(
text="`invalid username or userid, try again with valid info ⚠`", del_in=0
text="`invalid userid, try again with valid info ⚠`", del_in=0
)
return

Expand Down
17 changes: 9 additions & 8 deletions userge/plugins/admin/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async def lock_perm(message: Message):
chat_id = message.chat.id

if not lock_type:
await message.edit(text=r"I Can't Lock Nothing! (-‸ლ)", del_in=0)
await message.edit(text=r"`I Can't Lock Nothing! (-‸ლ)`", del_in=0)
return

get_perm = await userge.get_chat(chat_id)
Expand Down Expand Up @@ -80,7 +80,7 @@ async def lock_perm(message: Message):

except Exception as e:
await message.edit(
text=r"`i don't have permission to do that` >︿< \n"
text=r"`i don't have permission to do that >︿<`\n\n"
f"**ERROR:** `{e}`", del_in=0)

return
Expand Down Expand Up @@ -156,7 +156,7 @@ async def lock_perm(message: Message):

except:
await message.edit(
text=r"`i don't have permission to do that` >︿<", del_in=0)
text=r"`i don't have permission to do that >︿<`", del_in=0)


@userge.on_cmd("unlock", about="""\
Expand Down Expand Up @@ -236,10 +236,10 @@ async def unlock_perm(message: Message):
f"PERMISSIONS: `All Permissions`"
)

except:
except Exception as e:
await message.edit(
text=f"**Do I have proper Admin rights for that 🤔**", del_in=0)
return
text=r"`i don't have permission to do that >︿<`\n\n"
f"**ERROR:** `{e}`", del_in=0)

if unlock_type == "msg":
umsg = True
Expand Down Expand Up @@ -311,7 +311,8 @@ async def unlock_perm(message: Message):
)

except:
await message.edit(text=r"`i don't have permission to do that` >︿<", del_in=0)
await message.edit(
text=r"`i don't have permission to do that >︿<`", del_in=0)


@userge.on_cmd("vperm", about="""\
Expand Down Expand Up @@ -397,5 +398,5 @@ def convert_to_emoji(val: bool):

except Exception as e:
await message.edit(
text="**Something went wrong! 🤔\n"
text="`Something went wrong!` 🤔\n"
f"**ERROR:** `{e}`", del_in=0)

0 comments on commit 5d14e45

Please sign in to comment.