Skip to content

Commit

Permalink
all Update to v1.4.8
Browse files Browse the repository at this point in the history
  • Loading branch information
omg-xtao committed Feb 4, 2024
1 parent 0d7b581 commit cdca035
Show file tree
Hide file tree
Showing 31 changed files with 258 additions and 226 deletions.
2 changes: 1 addition & 1 deletion alpha/auto_send_reactions/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,4 +260,4 @@ async def AutoSendReactions(message: Message):
return False


## ⬆️ 不懂勿动 ⬆️
## ⬆️ 不懂勿动 ⬆️
4 changes: 2 additions & 2 deletions annualreport/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ async def get_hitokoto(request: AsyncClient):
try:
htk = (await request.get("https://v1.hitokoto.cn/?charset=utf-8")).json()
text = f"\"{htk['hitokoto']}\" —— "
if htk['from_who']:
if htk["from_who"]:
text += f"{htk['from_who']}"
if htk['from']:
if htk["from"]:
text += f"「{htk['from']}」"
except Exception:
text = '"用代码表达言语的魅力,用代码书写山河的壮丽。" —— 一言「一言开发者中心」'
Expand Down
4 changes: 2 additions & 2 deletions atadmins/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async def at_admins(client: Client, message: Message):
await client.send_message(
message.chat.id,
"%s:\n\n%s" % (say, send_list),
reply_to_message_id=message.reply_to_message_id
or message.reply_to_top_message_id,
reply_to_message_id=message.reply_to_message_id,
message_thread_id=message.message_thread_id,
)
await message.safe_delete()
3 changes: 2 additions & 1 deletion audio_to_voice/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ async def audio_to_voice(bot: Client, message: Message):
audio,
reply_to_message_id=message.id
if message.audio
else (message.reply_to_message_id or message.reply_to_top_message_id),
else message.reply_to_message_id,
message_thread_id=message.message_thread_id,
)
except Exception as e:
await message.edit(f"转换为语音消息失败:{e}")
Expand Down
4 changes: 2 additions & 2 deletions bingwall/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ async def bingwall(message: Message):
filename,
caption=f"#bing wallpaper\n" f"{str(copy_right)}",
quote=False,
reply_to_message_id=message.reply_to_top_message_id,
message_thread_id=message.message_thread_id,
)
else:
await message.reply_photo(
filename,
caption=f"#bing wallpaper\n" f"{str(copy_right)}",
quote=False,
reply_to_message_id=message.reply_to_top_message_id,
message_thread_id=message.message_thread_id,
)
status = True
break # 成功了就赶紧结束啦!
Expand Down
2 changes: 1 addition & 1 deletion chat_transfer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ async def chat_transfer(message: Message):
"chats.csv",
caption=f"对话导出文件,成功导出了 {num} 个群组/频道",
thumb=f"pagermaid{sep}assets{sep}logo.jpg",
reply_to_message_id=message.reply_to_top_message_id,
message_thread_id=message.message_thread_id,
)
safe_remove("chats.csv")
await message.safe_delete()
Expand Down
2 changes: 1 addition & 1 deletion eat/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ async def eat(client_: Client, context: Message):
await client_.send_document(
context.chat.id,
f"plugins{sep}eat{sep}eat.webp",
reply_to_message_id=context.reply_to_top_message_id,
message_thread_id=context.message_thread_id,
)
await final_msg.safe_delete()
except TypeError:
Expand Down
2 changes: 1 addition & 1 deletion emoji_transfer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ async def emoji_transfer(message: Message):
"emojis.csv",
caption=f"Emoji 包导出文件,成功导出了 {num} 个 Emoji 包",
thumb=f"pagermaid{sep}assets{sep}logo.jpg",
reply_to_message_id=message.reply_to_top_message_id,
message_thread_id=message.message_thread_id,
)
safe_remove("emojis.csv")
await message.safe_delete()
Expand Down
4 changes: 2 additions & 2 deletions epic/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ async def epic(message: Message):
"epic.jpg",
caption=msg,
quote=False,
reply_to_message_id=message.reply_to_top_message_id,
message_thread_id=message.message_thread_id,
)
except Exception:
await message.reply(
msg,
quote=False,
reply_to_message_id=message.reply_to_top_message_id,
message_thread_id=message.message_thread_id,
)
safe_remove("epic.jpg")
else:
Expand Down
4 changes: 2 additions & 2 deletions getstickers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ async def upload_sticker(bot: Client, message: Message, sticker_set: StickerSet)
message.chat.id,
f"{directory_name}.zip",
caption=sticker_set.set.short_name,
reply_to_message_id=message.reply_to_message_id
or message.reply_to_top_message_id,
reply_to_message_id=message.reply_to_message_id,
message_thread_id=message.message_thread_id,
)
safe_remove(f"{directory_name}.zip")
shutil.rmtree(directory_name)
Expand Down
5 changes: 2 additions & 3 deletions httpcat/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ async def httpcat(client: Client, message: Message, request: AsyncClient):
await client.send_photo(
message.chat.id,
io,
reply_to_message_id=(
message.reply_to_message_id or message.reply_to_top_message_id
)
reply_to_message_id=message.reply_to_message_id
if message.outgoing
else message.id,
message_thread_id=message.message_thread_id,
)
await message.safe_delete()
2 changes: 1 addition & 1 deletion jikipedia/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ async def jikipedia(message: Message):
image,
quote=False,
caption=text,
reply_to_message_id=message.reply_to_top_message_id,
message_thread_id=message.message_thread_id,
)
await message.safe_delete()
except Exception:
Expand Down
4 changes: 2 additions & 2 deletions jupai/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ async def ju_pai(message: Message):
await message.reply_photo(
image_url,
quote=False,
reply_to_message_id=message.reply_to_message_id
or message.reply_to_top_message_id,
reply_to_message_id=message.reply_to_message_id,
message_thread_id=message.message_thread_id,
)
await message.safe_delete()
except Exception as e:
Expand Down
18 changes: 14 additions & 4 deletions keyword/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,13 @@ def replace_reply(self, message: Message):
async def process_keyword(self, message: Message):
msg = None
text = self.replace_reply(message)
reply_id = message.id if self.reply else message.reply_to_top_message_id
reply_id = message.id if self.reply else None
with contextlib.suppress(Exception):
msg = await message.reply(
text, parse_mode=ParseMode.HTML, reply_to_message_id=reply_id
text,
parse_mode=ParseMode.HTML,
reply_to_message_id=reply_id,
message_thread_id=message.message_thread_id,
)
if self.delete:
if self.source_delay_delete > 0:
Expand Down Expand Up @@ -236,10 +239,17 @@ def parse_task(self, text: str):

if len(data) > 4:
self.delay_delete = int(data[4])
if len(data) > 5: # assuming the source_delay_delete is the 6th part of the task format
if (
len(data) > 5
): # assuming the source_delay_delete is the 6th part of the task format
self.source_delay_delete = int(data[5])

if self.ban < 0 or self.restrict < 0 or self.delay_delete < 0 or self.source_delay_delete < 0:
if (
self.ban < 0
or self.restrict < 0
or self.delay_delete < 0
or self.source_delay_delete < 0
):
raise ValueError("Invalid task format")


Expand Down
12 changes: 6 additions & 6 deletions netease/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ async def netease_search(keyword: str, message: Message):
await conv.mark_as_read()
await answer.copy(
message.chat.id,
reply_to_message_id=message.reply_to_message_id
or message.reply_to_top_message_id,
reply_to_message_id=message.reply_to_message_id,
message_thread_id=message.message_thread_id,
)
await message.safe_delete()

Expand All @@ -57,8 +57,8 @@ async def netease_url(url: str, message: Message):
await conv.mark_as_read()
await answer.copy(
message.chat.id,
reply_to_message_id=message.reply_to_message_id
or message.reply_to_top_message_id,
reply_to_message_id=message.reply_to_message_id,
message_thread_id=message.message_thread_id,
)
await message.safe_delete()

Expand All @@ -71,8 +71,8 @@ async def netease_id(music_id: str, message: Message):
await conv.mark_as_read()
await answer.copy(
message.chat.id,
reply_to_message_id=message.reply_to_message_id
or message.reply_to_top_message_id,
reply_to_message_id=message.reply_to_message_id,
message_thread_id=message.message_thread_id,
)
await message.safe_delete()

Expand Down
4 changes: 1 addition & 3 deletions no_mentions/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ async def set_read_mentions(client: Client, message: Message):
await client.invoke(
ReadMentions(
peer=await client.resolve_peer(message.chat.id),
top_msg_id=message.reply_to_top_message_id
if message.chat.is_forum
else None,
top_msg_id=message.message_thread_id if message.topic else None,
)
)
8 changes: 4 additions & 4 deletions pixiv/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,14 +285,14 @@ async def send_illust(message: Message, illust: Illust) -> None:
illust.image_urls["large"],
caption=caption,
quote=False,
reply_to_message_id=message.reply_to_message_id
or message.reply_to_top_message_id,
reply_to_message_id=message.reply_to_message_id,
message_thread_id=message.message_thread_id,
)
else:
await message.reply_text(
caption,
reply_to_message_id=message.reply_to_message_id
or message.reply_to_top_message_id,
reply_to_message_id=message.reply_to_message_id,
message_thread_id=message.message_thread_id,
)


Expand Down
Loading

0 comments on commit cdca035

Please sign in to comment.