new bsky support

This commit is contained in:
2024-10-19 22:25:07 +08:00
parent 62a2820af3
commit 3fe8a1cf3b
5 changed files with 310 additions and 7 deletions
+54 -1
View File
@@ -1,4 +1,6 @@
from typing import TypedDict
from __future__ import annotations
from typing import Literal, TypedDict
from telegram import InlineQueryResultMpeg4Gif, InlineQueryResultPhoto, InlineQueryResultVideo, InputMediaPhoto, \
InputMediaVideo
@@ -15,3 +17,54 @@ class TweetInfo(TypedDict):
text: str
media_extended: list[dict]
possibly_sensitive: bool
class BskyInfo(TypedDict):
thread: BskyThread
class BskyThread(TypedDict):
post: BskyPost
class BskyPost(TypedDict):
author: BskyAuthor
record: BskyPostRecord
embed: BskyEmbedImages | BskyEmbedVideo | BskyEmbedExternal
class BskyAuthor(TypedDict):
handle: str
displayName: str
class BskyPostRecord(TypedDict):
text: str
class BskyEmbedImage(TypedDict):
thumb: str
fullsize: str
BskyEmbedImages = TypedDict('BskyEmbedImages', {
'$type': Literal['app.bsky.embed.images#view'],
'images': list[BskyEmbedImage]
})
BskyEmbedVideo = TypedDict('BskyEmbedVideo', {
'$type': Literal['app.bsky.embed.video#view'],
'playlist': str,
'thumbnail': str
})
class BskyEmbedExternalItem(TypedDict):
uri: str
thumb: str
BskyEmbedExternal = TypedDict('BskyEmbedExternal', {
'$type': Literal['app.bsky.embed.external#view'],
'external': BskyEmbedExternalItem
})