Browse Source

リンク・カード追加

main
みてるぞ 2 weeks ago
parent
commit
5da0335c50
1 changed files with 16 additions and 11 deletions
  1. +16
    -11
      main.py

+ 16
- 11
main.py View File

@@ -82,24 +82,29 @@ def main (
'content': 'content':
record['text']}, record['text']},
reversed (records[1:]))]) 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 () for datum in [e for e in get_nico_deerjika ()
if e['contentId'] not in watched_videos]: if e['contentId'] not in watched_videos]:
watched_videos += [datum['contentId']] 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'] }』という動画がアップされました。 ニコニコに『{ datum['title'] }』という動画がアップされました。
つけられたタグは「{ '」、「'.join (datum['tags']) }」です。 つけられたタグは「{ '」、「'.join (datum['tags']) }」です。
概要には次のように書かれています: 概要には次のように書かれています:
```html ```html
{ datum['description'] } { datum['description'] }
``` ```
このことについて、みんなに告知するとともに、ニジカちゃんの感想を教えてください。
"""))
このことについて、みんなに告知するとともに、ニジカちゃんの感想を教えてください。 """),
embed = embed_external)


if now.hour == 14 and has_got_snack_time: if now.hour == 14 and has_got_snack_time:
has_got_snack_time = False has_got_snack_time = False
@@ -121,9 +126,9 @@ def main (
'日本語のテキストが表示されている。'), '日本語のテキストが表示されている。'),
image = client.com.atproto.repo.upload_blob (f).blob) 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 last_posted_at = now
except Exception: except Exception:
pass pass
@@ -131,7 +136,7 @@ def main (
has_got_snack_time = True has_got_snack_time = True


if now - last_posted_at >= timedelta (hours = 6): if now - last_posted_at >= timedelta (hours = 6):
client.send_post (Talk.main ('今どうしてる?'))
client.post (Talk.main ('今どうしてる?'))
last_posted_at = now last_posted_at = now


time.sleep (60) time.sleep (60)


Loading…
Cancel
Save