批量修复错误

This commit is contained in:
xtaodada 2021-09-03 15:33:59 +08:00
parent 1ed1c31166
commit 4478768bc9
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
7 changed files with 38 additions and 12 deletions

View File

@ -209,7 +209,10 @@ async def process_message(context):
reply_user_id = 0 reply_user_id = 0
link = process_link(context.chat_id, context.id) link = process_link(context.chat_id, context.id)
me = await context.client.get_me() me = await context.client.get_me()
reply = await context.get_reply_message() try:
reply = await context.get_reply_message()
except ValueError:
return
try: try:
reply_user_id = reply.sender.id reply_user_id = reply.sender.id
if context.sticker: if context.sticker:

4
da.py
View File

@ -32,8 +32,8 @@ async def da(context):
await log(f"批量删除了 {str(count)} 条消息。") await log(f"批量删除了 {str(count)} 条消息。")
try: try:
notification = await send_prune_notify(context, count) notification = await send_prune_notify(context, count)
except PeerFloodError: except:
pass return
await sleep(.5) await sleep(.5)
await notification.delete() await notification.delete()

6
eat.py
View File

@ -51,7 +51,11 @@ async def eat(context):
await context.edit("正在生成 吃头像 图片中 . . .") await context.edit("正在生成 吃头像 图片中 . . .")
if context.reply_to_msg_id: if context.reply_to_msg_id:
reply_message = await context.get_reply_message() reply_message = await context.get_reply_message()
user_id = reply_message.sender_id try:
user_id = reply_message.sender_id
except AttributeError:
await context.edit("出错了呜呜呜 ~ 无效的参数。")
return
target_user = await context.client(GetFullUserRequest(user_id)) target_user = await context.client(GetFullUserRequest(user_id))
if len(context.parameter) == 1: if len(context.parameter) == 1:
diu_round = True diu_round = True

View File

@ -152,7 +152,7 @@
}, },
{ {
"name": "portball", "name": "portball",
"version": "1.45", "version": "1.451",
"section": "chat", "section": "chat",
"maintainer": "Pentacene", "maintainer": "Pentacene",
"size": "2.8 kb", "size": "2.8 kb",
@ -202,7 +202,7 @@
}, },
{ {
"name": "eat", "name": "eat",
"version": "1.03", "version": "1.031",
"section": "profile", "section": "profile",
"maintainer": "SF_PICK", "maintainer": "SF_PICK",
"size": "6.4 kb", "size": "6.4 kb",
@ -242,7 +242,7 @@
}, },
{ {
"name": "da", "name": "da",
"version": "1.02", "version": "1.021",
"section": "chat", "section": "chat",
"maintainer": "yxkumad", "maintainer": "yxkumad",
"size": "1.6 kb", "size": "1.6 kb",
@ -312,7 +312,7 @@
}, },
{ {
"name": "videodl", "name": "videodl",
"version": "0.12", "version": "0.121",
"section": "daily", "section": "daily",
"maintainer": "TNTcraftHIM", "maintainer": "TNTcraftHIM",
"size": "5.3 kb", "size": "5.3 kb",
@ -372,7 +372,7 @@
}, },
{ {
"name": "autoreplysticker", "name": "autoreplysticker",
"version": "1.23", "version": "1.231",
"section": "chat", "section": "chat",
"maintainer": "Pentacene", "maintainer": "Pentacene",
"size": "12 kb", "size": "12 kb",
@ -702,7 +702,7 @@
}, },
{ {
"name": "yvlu", "name": "yvlu",
"version": "1.12", "version": "1.121",
"section": "chat", "section": "chat",
"maintainer": "xtaodada", "maintainer": "xtaodada",
"size": "4.8 kb", "size": "4.8 kb",

View File

@ -32,6 +32,17 @@ async def portball(context):
except: except:
pass pass
return False return False
try:
int(action[1])
except ValueError:
notification = await bot.send_message(context.chat_id, '格式是\n-portball 理由 秒数\n真蠢', reply_to=context.id)
await sleep(10)
await notification.delete()
try:
await context.delete()
except:
pass
return False
if int(action[1]) < 60: if int(action[1]) < 60:
notification = await bot.send_message(context.chat_id, '诶呀不要小于60秒啦', reply_to=context.id) notification = await bot.send_message(context.chat_id, '诶呀不要小于60秒啦', reply_to=context.id)
await sleep(10) await sleep(10)

View File

@ -39,7 +39,11 @@ async def vdl(context):
'uninstall pytube3 -y` 进行卸载') 'uninstall pytube3 -y` 进行卸载')
return return
url = url.replace('www.youtube.com/watch?v=', 'youtu.be/') url = url.replace('www.youtube.com/watch?v=', 'youtu.be/')
if not await youtube_dl(url, context, reply_id): try:
if not await youtube_dl(url, context, reply_id):
await context.edit("出错了呜呜呜 ~ 视频下载失败。")
sleep(3)
except:
await context.edit("出错了呜呜呜 ~ 视频下载失败。") await context.edit("出错了呜呜呜 ~ 视频下载失败。")
sleep(3) sleep(3)
await log(f"已拉取 YouTube 视频,地址: {url}.") await log(f"已拉取 YouTube 视频,地址: {url}.")

View File

@ -185,7 +185,11 @@ async def yv_lu(context):
image = await resize_image('plugins/yvlu/result.png', 512) image = await resize_image('plugins/yvlu/result.png', 512)
file = BytesIO() file = BytesIO()
file.name = "sticker.webp" file.name = "sticker.webp"
image.save(file, "WEBP") try:
image.save(file, "WEBP")
except KeyError:
await context.delete()
return
file.seek(0) file.seek(0)
await context.client.send_file( await context.client.send_file(
context.chat_id, context.chat_id,