mirror of
https://github.com/TeamPGM/PagerMaid_Plugins_Pyro.git
synced 2024-11-25 06:17:37 +00:00
eat fix a bug
This commit is contained in:
parent
1712f46135
commit
7142a76fbf
20
eat.py
20
eat.py
@ -61,7 +61,7 @@ async def eat_it(context, user, base, mask, photo, number, layer=0):
|
|||||||
# 增加判断是否有第二个头像孔
|
# 增加判断是否有第二个头像孔
|
||||||
isContinue = len(numberPosition) > 2 and layer == 0
|
isContinue = len(numberPosition) > 2 and layer == 0
|
||||||
if isContinue:
|
if isContinue:
|
||||||
await client.download_media(
|
await context._client.download_media(
|
||||||
user.photo.big_file_id,
|
user.photo.big_file_id,
|
||||||
f"plugins{sep}eat{sep}" + str(user.id) + ".jpg",
|
f"plugins{sep}eat{sep}" + str(user.id) + ".jpg",
|
||||||
)
|
)
|
||||||
@ -205,7 +205,7 @@ async def eat(client_: Client, context: Message):
|
|||||||
await context.edit("出错了呜呜呜 ~ 无效的参数。")
|
await context.edit("出错了呜呜呜 ~ 无效的参数。")
|
||||||
return
|
return
|
||||||
diu_round = False
|
diu_round = False
|
||||||
from_user_id = context.from_user.id if context.from_user else context.sender_chat.id
|
from_user_id = context.from_user.id
|
||||||
if context.reply_to_message:
|
if context.reply_to_message:
|
||||||
user = context.reply_to_message.from_user
|
user = context.reply_to_message.from_user
|
||||||
if not user:
|
if not user:
|
||||||
@ -388,7 +388,7 @@ async def eat(client_: Client, context: Message):
|
|||||||
notifyStr = notifyStrArr[str(number)]
|
notifyStr = notifyStrArr[str(number)]
|
||||||
except:
|
except:
|
||||||
notifyStr = "吃头像"
|
notifyStr = "吃头像"
|
||||||
await context.edit(f"正在生成 {notifyStr} 图片中 . . .")
|
final_msg = await context.edit(f"正在生成 {notifyStr} 图片中 . . .")
|
||||||
markImg = Image.open(f"plugins{sep}eat{sep}" + str(target_user_id) + ".jpg")
|
markImg = Image.open(f"plugins{sep}eat{sep}" + str(target_user_id) + ".jpg")
|
||||||
try:
|
try:
|
||||||
eatImg = Image.open(f"plugins{sep}eat{sep}eat" + str(number) + ".png")
|
eatImg = Image.open(f"plugins{sep}eat{sep}eat" + str(number) + ".png")
|
||||||
@ -403,7 +403,7 @@ async def eat(client_: Client, context: Message):
|
|||||||
number = str(number)
|
number = str(number)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
result = await eat_it(context, user, eatImg, maskImg, markImg, number)
|
result = await eat_it(context, context.from_user, eatImg, maskImg, markImg, number)
|
||||||
result.save(f"plugins{sep}eat{sep}eat.webp")
|
result.save(f"plugins{sep}eat{sep}eat.webp")
|
||||||
try:
|
try:
|
||||||
remove(f"plugins{sep}eat{sep}" + str(target_user_id) + ".jpg")
|
remove(f"plugins{sep}eat{sep}" + str(target_user_id) + ".jpg")
|
||||||
@ -423,22 +423,22 @@ async def eat(client_: Client, context: Message):
|
|||||||
f"plugins{sep}eat{sep}eat.webp",
|
f"plugins{sep}eat{sep}eat.webp",
|
||||||
reply_to_message_id=reply_to
|
reply_to_message_id=reply_to
|
||||||
)
|
)
|
||||||
await context.safe_delete()
|
await final_msg.safe_delete()
|
||||||
except TypeError:
|
except TypeError:
|
||||||
await context.edit("此用户未设置头像或头像对您不可见。")
|
await final_msg.edit("此用户未设置头像或头像对您不可见。")
|
||||||
except:
|
except:
|
||||||
await context.edit("此群组无法发送贴纸。")
|
await final_msg.edit("此群组无法发送贴纸。")
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
await client_.send_document(
|
await client_.send_document(
|
||||||
context.chat.id,
|
context.chat.id,
|
||||||
f"plugins{sep}eat{sep}eat.webp",
|
f"plugins{sep}eat{sep}eat.webp",
|
||||||
)
|
)
|
||||||
await context.safe_delete()
|
await final_msg.safe_delete()
|
||||||
except TypeError:
|
except TypeError:
|
||||||
await context.edit("此用户未设置头像或头像对您不可见。")
|
await final_msg.edit("此用户未设置头像或头像对您不可见。")
|
||||||
except:
|
except:
|
||||||
await context.edit("此群组无法发送贴纸。")
|
await final_msg.edit("此群组无法发送贴纸。")
|
||||||
remove(f"plugins{sep}eat{sep}eat.webp")
|
remove(f"plugins{sep}eat{sep}eat.webp")
|
||||||
try:
|
try:
|
||||||
remove(photo)
|
remove(photo)
|
||||||
|
Loading…
Reference in New Issue
Block a user