diff --git a/main.py b/main.py index 399d385..d45a2af 100644 --- a/main.py +++ b/main.py @@ -82,24 +82,29 @@ def main ( 'content': record['text']}, reversed (records[1:]))]) - client.send_post (answer, - reply_to = models.AppBskyFeedPost.ReplyRef ( - parent = records[0]['strong_ref'], - root = records[-1]['strong_ref'])) + client.post (answer, + reply_to = models.AppBskyFeedPost.ReplyRef ( + parent = records[0]['strong_ref'], + root = records[-1]['strong_ref'])) for datum in [e for e in get_nico_deerjika () if e['contentId'] not in watched_videos]: watched_videos += [datum['contentId']] - client.send_post (Talk.main (f""" + embed_external = models.AppBskyEmbedExternal.Main ( + external = models.AppBskyEmbedExternal.External ( + title = datum['title'], + description = datum['description'], + uri = f"https://www.nicovideo.jp/watch/{ datum['contentId'] }")) + client.post (Talk.main (f""" ニコニコに『{ datum['title'] }』という動画がアップされました。 つけられたタグは「{ '」、「'.join (datum['tags']) }」です。 概要には次のように書かれています: ```html { datum['description'] } ``` -このことについて、みんなに告知するとともに、ニジカちゃんの感想を教えてください。 -""")) +このことについて、みんなに告知するとともに、ニジカちゃんの感想を教えてください。 """), + embed = embed_external) if now.hour == 14 and has_got_snack_time: has_got_snack_time = False @@ -121,9 +126,9 @@ def main ( '日本語のテキストが表示されている。'), image = client.com.atproto.repo.upload_blob (f).blob) - client.send_post (Talk.main ('おやつタイムだ!!!!'), - embed = models.app.bsky.embed.images.Main ( - images = [image])) + client.post (Talk.main ('おやつタイムだ!!!!'), + embed = models.app.bsky.embed.images.Main ( + images = [image])) last_posted_at = now except Exception: pass @@ -131,7 +136,7 @@ def main ( has_got_snack_time = True if now - last_posted_at >= timedelta (hours = 6): - client.send_post (Talk.main ('今どうしてる?')) + client.post (Talk.main ('今どうしてる?')) last_posted_at = now time.sleep (60)