2020-02-19 15:31:39 +00:00
|
|
|
|
""" This module contains utils to configure your account. """
|
|
|
|
|
|
|
|
|
|
from os import remove
|
|
|
|
|
from telethon.errors import ImageProcessFailedError, PhotoCropSizeSmallError
|
|
|
|
|
from telethon.errors.rpcerrorlist import PhotoExtInvalidError, UsernameOccupiedError, AboutTooLongError, \
|
2021-06-19 07:25:31 +00:00
|
|
|
|
FirstNameInvalidError, UsernameInvalidError, UsernameNotModifiedError
|
2020-02-19 15:31:39 +00:00
|
|
|
|
from telethon.tl.functions.account import UpdateProfileRequest, UpdateUsernameRequest
|
|
|
|
|
from telethon.tl.functions.photos import DeletePhotosRequest, GetUserPhotosRequest, UploadProfilePhotoRequest
|
|
|
|
|
from telethon.tl.functions.users import GetFullUserRequest
|
2021-06-14 13:38:40 +00:00
|
|
|
|
from telethon.tl.functions.contacts import BlockRequest, UnblockRequest
|
2021-08-19 12:00:15 +00:00
|
|
|
|
from telethon.tl.types import InputPhoto, MessageMediaPhoto, MessageEntityMentionName, MessageEntityPhone
|
2020-02-19 15:31:39 +00:00
|
|
|
|
from struct import error as StructError
|
|
|
|
|
from pagermaid import bot, log
|
2021-06-15 04:31:05 +00:00
|
|
|
|
from pagermaid.utils import lang, alias_command
|
2020-02-19 15:31:39 +00:00
|
|
|
|
from pagermaid.listener import listener
|
|
|
|
|
|
|
|
|
|
|
2021-06-15 04:31:05 +00:00
|
|
|
|
@listener(is_plugin=False, outgoing=True, command=alias_command('username'),
|
2021-04-12 16:25:32 +00:00
|
|
|
|
description=lang('username_des'),
|
2020-02-19 15:31:39 +00:00
|
|
|
|
parameters="<username>")
|
|
|
|
|
async def username(context):
|
2021-04-12 16:25:32 +00:00
|
|
|
|
""" Reconfigure your username. """
|
2020-02-19 15:31:39 +00:00
|
|
|
|
if len(context.parameter) > 1:
|
2021-04-12 16:25:32 +00:00
|
|
|
|
await context.edit(f"{lang('error_prefix')}{lang('arg_error')}}")
|
2020-02-19 15:31:39 +00:00
|
|
|
|
if len(context.parameter) == 1:
|
|
|
|
|
result = context.parameter[0]
|
|
|
|
|
else:
|
|
|
|
|
result = ""
|
|
|
|
|
try:
|
|
|
|
|
await bot(UpdateUsernameRequest(result))
|
|
|
|
|
except UsernameOccupiedError:
|
2021-06-19 07:25:31 +00:00
|
|
|
|
await context.edit(f"{lang('error_prefix')}{lang('username_exist')}")
|
2020-02-19 15:31:39 +00:00
|
|
|
|
return
|
|
|
|
|
except UsernameInvalidError:
|
2021-04-12 16:25:32 +00:00
|
|
|
|
await context.edit(f"{lang('error_prefix')}{lang('username_vaild')}")
|
2020-02-19 15:31:39 +00:00
|
|
|
|
return
|
2021-06-19 07:25:31 +00:00
|
|
|
|
except UsernameNotModifiedError:
|
|
|
|
|
await context.edit(f"{lang('error_prefix')}{lang('username_exist')}")
|
|
|
|
|
return
|
2021-04-12 16:25:32 +00:00
|
|
|
|
await context.edit(lang('username_set'))
|
2020-02-19 15:31:39 +00:00
|
|
|
|
if result == "":
|
2021-04-12 16:25:32 +00:00
|
|
|
|
await log(lang('username_cancel'))
|
2020-02-19 15:31:39 +00:00
|
|
|
|
return
|
2021-04-12 16:25:32 +00:00
|
|
|
|
await log(f"{lang('username_whatset')}`{result}`")
|
2020-02-19 15:31:39 +00:00
|
|
|
|
|
|
|
|
|
|
2021-06-15 04:31:05 +00:00
|
|
|
|
@listener(is_plugin=False, outgoing=True, command=alias_command('name'),
|
2021-04-12 16:25:32 +00:00
|
|
|
|
description=lang('name_des'),
|
2020-02-19 15:31:39 +00:00
|
|
|
|
parameters="<first name> <last name>")
|
|
|
|
|
async def name(context):
|
|
|
|
|
""" Updates your display name. """
|
|
|
|
|
if len(context.parameter) == 2:
|
|
|
|
|
first_name = context.parameter[0]
|
|
|
|
|
last_name = context.parameter[1]
|
|
|
|
|
elif len(context.parameter) == 1:
|
|
|
|
|
first_name = context.parameter[0]
|
|
|
|
|
last_name = " "
|
|
|
|
|
else:
|
2021-04-12 16:25:32 +00:00
|
|
|
|
await context.edit(f"{lang('error_prefix')}{lang('arg_error')}")
|
2020-02-19 15:31:39 +00:00
|
|
|
|
return
|
|
|
|
|
try:
|
|
|
|
|
await bot(UpdateProfileRequest(
|
|
|
|
|
first_name=first_name,
|
|
|
|
|
last_name=last_name))
|
|
|
|
|
except FirstNameInvalidError:
|
2021-04-12 16:25:32 +00:00
|
|
|
|
await context.edit(f"{lang('error_prefix')}{lang('name_vaild')}")
|
2020-02-19 15:31:39 +00:00
|
|
|
|
return
|
2021-04-12 16:25:32 +00:00
|
|
|
|
await context.edit(lang('name_set'))
|
2020-02-19 15:31:39 +00:00
|
|
|
|
if last_name != " ":
|
2021-04-12 16:25:32 +00:00
|
|
|
|
await log(f"{lang('name_whatset')}`{first_name} {last_name}`.")
|
2020-02-19 15:31:39 +00:00
|
|
|
|
else:
|
2021-04-12 16:25:32 +00:00
|
|
|
|
await log(f"{lang('name_whatset')}`{first_name}`.")
|
2020-02-19 15:31:39 +00:00
|
|
|
|
|
|
|
|
|
|
2021-06-15 04:31:05 +00:00
|
|
|
|
@listener(is_plugin=False, outgoing=True, command=alias_command('pfp'),
|
2021-04-12 16:25:32 +00:00
|
|
|
|
description=lang('pfp_des'))
|
2020-02-19 15:31:39 +00:00
|
|
|
|
async def pfp(context):
|
|
|
|
|
""" Sets your profile picture. """
|
|
|
|
|
reply = await context.get_reply_message()
|
|
|
|
|
photo = None
|
2021-04-12 16:25:32 +00:00
|
|
|
|
await context.edit(lang('pfp_process'))
|
2021-06-19 07:25:31 +00:00
|
|
|
|
if reply:
|
|
|
|
|
if reply.media:
|
|
|
|
|
if isinstance(reply.media, MessageMediaPhoto):
|
|
|
|
|
photo = await bot.download_media(message=reply.photo)
|
|
|
|
|
elif "image" in reply.media.document.mime_type.split('/'):
|
|
|
|
|
photo = await bot.download_file(reply.media.document)
|
|
|
|
|
else:
|
|
|
|
|
await context.edit(f"{lang('error_prefix')}{lang('pfp_e_notp')}")
|
2020-02-19 15:31:39 +00:00
|
|
|
|
|
|
|
|
|
if photo:
|
|
|
|
|
try:
|
|
|
|
|
await bot(UploadProfilePhotoRequest(
|
|
|
|
|
await bot.upload_file(photo)
|
|
|
|
|
))
|
2021-06-19 07:25:31 +00:00
|
|
|
|
try:
|
|
|
|
|
remove(photo)
|
|
|
|
|
except:
|
|
|
|
|
pass
|
2020-02-19 15:31:39 +00:00
|
|
|
|
await context.edit("头像修改成功啦 ~")
|
2021-06-19 07:25:31 +00:00
|
|
|
|
return
|
2020-02-19 15:31:39 +00:00
|
|
|
|
except PhotoCropSizeSmallError:
|
2021-04-12 16:25:32 +00:00
|
|
|
|
await context.edit(f"{lang('error_prefix')}{lang('pfp_e_size')}")
|
2020-02-19 15:31:39 +00:00
|
|
|
|
except ImageProcessFailedError:
|
2021-04-12 16:25:32 +00:00
|
|
|
|
await context.edit(f"{lang('error_prefix')}{lang('pfp_e_img')}")
|
2020-02-19 15:31:39 +00:00
|
|
|
|
except PhotoExtInvalidError:
|
2021-04-12 16:25:32 +00:00
|
|
|
|
await context.edit(f"{lang('error_prefix')}{lang('pfp_e_notp')}")
|
2021-06-19 07:25:31 +00:00
|
|
|
|
await context.edit(f"{lang('error_prefix')}{lang('pfp_e_notp')}")
|
|
|
|
|
return
|
2020-02-19 15:31:39 +00:00
|
|
|
|
|
|
|
|
|
|
2021-06-15 04:31:05 +00:00
|
|
|
|
@listener(is_plugin=False, outgoing=True, command=alias_command('bio'),
|
2020-02-19 15:31:39 +00:00
|
|
|
|
description="设置咱的公开情报",
|
|
|
|
|
parameters="<string>")
|
|
|
|
|
async def bio(context):
|
|
|
|
|
""" Sets your bio. """
|
|
|
|
|
try:
|
|
|
|
|
await bot(UpdateProfileRequest(about=context.arguments))
|
|
|
|
|
except AboutTooLongError:
|
2021-04-12 16:25:32 +00:00
|
|
|
|
await context.edit(f"{lang('error_prefix')}{lang('bio_too_lang')}")
|
2020-02-19 15:31:39 +00:00
|
|
|
|
return
|
2021-04-12 16:25:32 +00:00
|
|
|
|
await context.edit(lang('bio_set'))
|
2020-02-19 15:31:39 +00:00
|
|
|
|
if context.arguments == "":
|
2021-04-12 16:25:32 +00:00
|
|
|
|
await log(lang('bio_cancel'))
|
2020-02-19 15:31:39 +00:00
|
|
|
|
return
|
2021-04-12 16:25:32 +00:00
|
|
|
|
await log(f"{lang('bio_whatset')}`{context.arguments}`.")
|
2020-02-19 15:31:39 +00:00
|
|
|
|
|
|
|
|
|
|
2021-06-15 04:31:05 +00:00
|
|
|
|
@listener(is_plugin=False, outgoing=True, command=alias_command('rmpfp'),
|
2021-04-12 16:25:32 +00:00
|
|
|
|
description=lang('rmpfp_des'),
|
|
|
|
|
parameters=f"<{lang('int')}>")
|
2020-02-19 15:31:39 +00:00
|
|
|
|
async def rmpfp(context):
|
|
|
|
|
""" Removes your profile picture. """
|
|
|
|
|
group = context.text[8:]
|
|
|
|
|
if group == 'all':
|
|
|
|
|
limit = 0
|
|
|
|
|
elif group.isdigit():
|
|
|
|
|
limit = int(group)
|
|
|
|
|
else:
|
|
|
|
|
limit = 1
|
|
|
|
|
|
|
|
|
|
pfp_list = await bot(GetUserPhotosRequest(
|
|
|
|
|
user_id=context.from_id,
|
|
|
|
|
offset=0,
|
|
|
|
|
max_id=0,
|
|
|
|
|
limit=limit))
|
|
|
|
|
input_photos = []
|
|
|
|
|
for sep in pfp_list.photos:
|
|
|
|
|
input_photos.append(
|
|
|
|
|
InputPhoto(
|
|
|
|
|
id=sep.id,
|
|
|
|
|
access_hash=sep.access_hash,
|
|
|
|
|
file_reference=sep.file_reference
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
await bot(DeletePhotosRequest(id=input_photos))
|
2021-04-12 16:25:32 +00:00
|
|
|
|
await context.edit(f"`{lang('rmpfp_p')}{len(input_photos)} {lang('rmpfp_l')}`")
|
2020-02-19 15:31:39 +00:00
|
|
|
|
|
|
|
|
|
|
2021-06-15 04:31:05 +00:00
|
|
|
|
@listener(is_plugin=False, outgoing=True, command=alias_command('profile'),
|
2021-04-12 16:25:32 +00:00
|
|
|
|
description=lang('profile_des'),
|
2020-02-19 15:31:39 +00:00
|
|
|
|
parameters="<username>")
|
|
|
|
|
async def profile(context):
|
|
|
|
|
""" Queries profile of a user. """
|
|
|
|
|
if len(context.parameter) > 1:
|
2021-04-12 16:25:32 +00:00
|
|
|
|
await context.edit(f"{lang('error_prefix')}{lang('arg_error')}")
|
2020-02-19 15:31:39 +00:00
|
|
|
|
return
|
|
|
|
|
|
2021-04-12 16:25:32 +00:00
|
|
|
|
await context.edit(lang('profile_process'))
|
2020-02-19 15:31:39 +00:00
|
|
|
|
if context.reply_to_msg_id:
|
|
|
|
|
reply_message = await context.get_reply_message()
|
2021-06-14 13:38:40 +00:00
|
|
|
|
user = reply_message.from_id
|
|
|
|
|
target_user = await context.client(GetFullUserRequest(user))
|
2020-02-19 15:31:39 +00:00
|
|
|
|
else:
|
|
|
|
|
if len(context.parameter) == 1:
|
|
|
|
|
user = context.parameter[0]
|
|
|
|
|
if user.isnumeric():
|
|
|
|
|
user = int(user)
|
|
|
|
|
else:
|
|
|
|
|
user_object = await context.client.get_me()
|
|
|
|
|
user = user_object.id
|
|
|
|
|
if context.message.entities is not None:
|
|
|
|
|
if isinstance(context.message.entities[0], MessageEntityMentionName):
|
2021-06-14 13:38:40 +00:00
|
|
|
|
user = context.message.entities[0].user_id
|
2021-08-19 12:00:15 +00:00
|
|
|
|
elif isinstance(context.message.entities[0], MessageEntityPhone):
|
|
|
|
|
user = int(context.parameter[0])
|
2021-06-14 13:38:40 +00:00
|
|
|
|
else:
|
|
|
|
|
await context.edit(f"{lang('error_prefix')}{lang('arg_error')}")
|
|
|
|
|
return
|
2020-02-19 15:31:39 +00:00
|
|
|
|
try:
|
|
|
|
|
user_object = await context.client.get_entity(user)
|
|
|
|
|
target_user = await context.client(GetFullUserRequest(user_object.id))
|
|
|
|
|
except (TypeError, ValueError, OverflowError, StructError) as exception:
|
2020-05-04 09:13:40 +00:00
|
|
|
|
if str(exception).startswith("Cannot find any entity corresponding to"):
|
2021-04-12 16:25:32 +00:00
|
|
|
|
await context.edit(f"{lang('error_prefix')}{lang('profile_e_no')}")
|
2020-02-19 15:31:39 +00:00
|
|
|
|
return
|
2020-05-04 09:13:40 +00:00
|
|
|
|
if str(exception).startswith("No user has"):
|
2021-04-12 16:25:32 +00:00
|
|
|
|
await context.edit(f"{lang('error_prefix')}{lang('profile_e_nou')}")
|
2020-02-19 15:31:39 +00:00
|
|
|
|
return
|
2020-05-04 09:13:40 +00:00
|
|
|
|
if str(exception).startswith("Could not find the input entity for") or isinstance(exception, StructError):
|
2021-04-12 16:25:32 +00:00
|
|
|
|
await context.edit(f"{lang('error_prefix')}{lang('profile_e_nof')}")
|
2020-02-19 15:31:39 +00:00
|
|
|
|
return
|
|
|
|
|
if isinstance(exception, OverflowError):
|
2021-04-12 16:25:32 +00:00
|
|
|
|
await context.edit(f"{lang('error_prefix')}{lang('profile_e_long')}")
|
2020-02-19 15:31:39 +00:00
|
|
|
|
return
|
|
|
|
|
raise exception
|
2021-04-12 16:25:32 +00:00
|
|
|
|
user_type = "Bot" if target_user.user.bot else lang('profile_user')
|
2020-02-19 15:31:39 +00:00
|
|
|
|
username_system = f"@{target_user.user.username}" if target_user.user.username is not None else (
|
2021-04-12 16:25:32 +00:00
|
|
|
|
lang('profile_noset'))
|
2021-09-24 14:30:48 +00:00
|
|
|
|
if not target_user.user.first_name:
|
|
|
|
|
await context.edit(f"{lang('error_prefix')}{lang('profile_e_no')}")
|
|
|
|
|
return
|
2020-02-19 15:31:39 +00:00
|
|
|
|
first_name = target_user.user.first_name.replace("\u2060", "")
|
|
|
|
|
last_name = target_user.user.last_name.replace("\u2060", "") if target_user.user.last_name is not None else (
|
2021-04-12 16:25:32 +00:00
|
|
|
|
lang('profile_noset')
|
2020-02-19 15:31:39 +00:00
|
|
|
|
)
|
2021-04-12 16:25:32 +00:00
|
|
|
|
biography = target_user.about if target_user.about is not None else lang('profile_nobio')
|
|
|
|
|
verified = lang('profile_yes') if target_user.user.verified else lang('profile_no')
|
|
|
|
|
restricted = lang('profile_yes') if target_user.user.restricted else lang('profile_no')
|
|
|
|
|
caption = f"**{lang('profile_name')}:** \n" \
|
|
|
|
|
f"{lang('profile_username')}: {username_system} \n" \
|
2020-02-20 13:37:19 +00:00
|
|
|
|
f"ID: {target_user.user.id} \n" \
|
2021-04-12 16:25:32 +00:00
|
|
|
|
f"{lang('profile_fname')}: {first_name} \n" \
|
2021-06-14 13:38:40 +00:00
|
|
|
|
f"{lang('profile_lname')}: {last_name} \n" \
|
2021-04-12 16:25:32 +00:00
|
|
|
|
f"{lang('profile_bio')}: {biography} \n" \
|
|
|
|
|
f"{lang('profile_gic')}: {target_user.common_chats_count} \n" \
|
|
|
|
|
f"{lang('profile_verified')}: {verified} \n" \
|
|
|
|
|
f"{lang('profile_restricted')}: {restricted} \n" \
|
|
|
|
|
f"{lang('profile_type')}: {user_type} \n" \
|
2020-02-20 13:37:19 +00:00
|
|
|
|
f"[{first_name}](tg://user?id={target_user.user.id})"
|
2020-02-19 15:31:39 +00:00
|
|
|
|
photo = await context.client.download_profile_photo(
|
2020-02-20 13:37:19 +00:00
|
|
|
|
target_user.user.id,
|
|
|
|
|
"./" + str(target_user.user.id) + ".jpg",
|
|
|
|
|
download_big=True
|
|
|
|
|
)
|
2020-02-19 15:31:39 +00:00
|
|
|
|
try:
|
2020-04-01 14:11:13 +00:00
|
|
|
|
reply_to = context.message.reply_to_msg_id
|
|
|
|
|
try:
|
|
|
|
|
await context.client.send_file(
|
|
|
|
|
context.chat_id,
|
|
|
|
|
photo,
|
|
|
|
|
caption=caption,
|
|
|
|
|
link_preview=False,
|
|
|
|
|
force_document=False,
|
|
|
|
|
reply_to=reply_to
|
|
|
|
|
)
|
|
|
|
|
if not photo.startswith("http"):
|
|
|
|
|
remove(photo)
|
|
|
|
|
await context.delete()
|
2020-04-05 13:10:20 +00:00
|
|
|
|
try:
|
|
|
|
|
remove(photo)
|
|
|
|
|
except:
|
|
|
|
|
pass
|
2020-04-01 14:11:13 +00:00
|
|
|
|
return
|
|
|
|
|
except TypeError:
|
|
|
|
|
await context.edit(caption)
|
|
|
|
|
except:
|
|
|
|
|
try:
|
|
|
|
|
await context.client.send_file(
|
|
|
|
|
context.chat_id,
|
|
|
|
|
photo,
|
|
|
|
|
caption=caption,
|
|
|
|
|
link_preview=False,
|
|
|
|
|
force_document=False
|
|
|
|
|
)
|
|
|
|
|
if not photo.startswith("http"):
|
|
|
|
|
remove(photo)
|
|
|
|
|
await context.delete()
|
2020-05-04 08:45:02 +00:00
|
|
|
|
try:
|
|
|
|
|
remove(photo)
|
|
|
|
|
except:
|
|
|
|
|
pass
|
2020-04-01 14:11:13 +00:00
|
|
|
|
return
|
|
|
|
|
except TypeError:
|
2020-05-04 08:45:02 +00:00
|
|
|
|
await context.edit(caption)
|
2021-06-14 13:38:40 +00:00
|
|
|
|
|
|
|
|
|
|
2021-06-15 04:31:05 +00:00
|
|
|
|
@listener(is_plugin=False, outgoing=True, command=alias_command('block'),
|
2021-06-14 13:38:40 +00:00
|
|
|
|
description=lang('block_des'),
|
|
|
|
|
parameters="<username/uid/reply>")
|
|
|
|
|
async def block_user(context):
|
|
|
|
|
""" Block an user. """
|
|
|
|
|
if len(context.parameter) > 1:
|
|
|
|
|
await context.edit(f"{lang('error_prefix')}{lang('arg_error')}")
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
await context.edit(lang('block_process'))
|
|
|
|
|
if context.reply_to_msg_id:
|
|
|
|
|
reply_message = await context.get_reply_message()
|
2021-06-19 07:25:31 +00:00
|
|
|
|
user = reply_message.sender_id
|
2021-06-14 13:38:40 +00:00
|
|
|
|
else:
|
|
|
|
|
if len(context.parameter) == 1:
|
|
|
|
|
user = context.parameter[0]
|
|
|
|
|
if user.isnumeric():
|
|
|
|
|
user = int(user)
|
|
|
|
|
else:
|
|
|
|
|
user_object = await context.client.get_me()
|
|
|
|
|
user = user_object.id
|
|
|
|
|
if context.message.entities is not None:
|
|
|
|
|
if isinstance(context.message.entities[0], MessageEntityMentionName):
|
|
|
|
|
user = context.message.entities[0].user_id
|
|
|
|
|
else:
|
|
|
|
|
await context.edit(f"{lang('error_prefix')}{lang('arg_error')}")
|
|
|
|
|
return
|
|
|
|
|
result = None
|
|
|
|
|
if not user:
|
|
|
|
|
await context.edit(f"{lang('error_prefix')}{lang('arg_error')}")
|
|
|
|
|
return
|
|
|
|
|
try:
|
|
|
|
|
result = await context.client(BlockRequest(id=user))
|
|
|
|
|
except Exception:
|
|
|
|
|
pass
|
|
|
|
|
if result:
|
|
|
|
|
await context.edit(f"{lang('block_success')} `{user}`")
|
|
|
|
|
else:
|
|
|
|
|
await context.edit(f"`{user}` {lang('block_exist')}")
|
|
|
|
|
|
|
|
|
|
|
2021-06-15 04:31:05 +00:00
|
|
|
|
@listener(is_plugin=False, outgoing=True, command=alias_command('unblock'),
|
2021-06-14 13:38:40 +00:00
|
|
|
|
description=lang('unblock_des'),
|
|
|
|
|
parameters="<username/uid/reply>")
|
|
|
|
|
async def unblock_user(context):
|
|
|
|
|
""" Unblock an user. """
|
|
|
|
|
if len(context.parameter) > 1:
|
|
|
|
|
await context.edit(f"{lang('error_prefix')}{lang('arg_error')}")
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
await context.edit(lang('unblock_process'))
|
|
|
|
|
if context.reply_to_msg_id:
|
|
|
|
|
reply_message = await context.get_reply_message()
|
|
|
|
|
user = reply_message.from_id.user_id
|
|
|
|
|
else:
|
|
|
|
|
if len(context.parameter) == 1:
|
|
|
|
|
user = context.parameter[0]
|
|
|
|
|
if user.isnumeric():
|
|
|
|
|
user = int(user)
|
|
|
|
|
else:
|
|
|
|
|
user_object = await context.client.get_me()
|
|
|
|
|
user = user_object.id
|
|
|
|
|
if context.message.entities is not None:
|
|
|
|
|
if isinstance(context.message.entities[0], MessageEntityMentionName):
|
|
|
|
|
user = context.message.entities[0].user_id
|
|
|
|
|
else:
|
|
|
|
|
await context.edit(f"{lang('error_prefix')}{lang('arg_error')}")
|
|
|
|
|
return
|
|
|
|
|
result = None
|
|
|
|
|
if not user:
|
|
|
|
|
await context.edit(f"{lang('error_prefix')}{lang('arg_error')}")
|
|
|
|
|
return
|
|
|
|
|
try:
|
|
|
|
|
result = await context.client(UnblockRequest(id=user))
|
|
|
|
|
except Exception:
|
|
|
|
|
pass
|
|
|
|
|
if result:
|
|
|
|
|
await context.edit(f"{lang('unblock_success')} `{user}`")
|
|
|
|
|
else:
|
|
|
|
|
await context.edit(f"`{user}` {lang('unblock_exist')}")
|