Browse Source

おやつタイム失敗時にはエラーを握り潰すやぅに

main
みてるぞ 2 weeks ago
parent
commit
0e6fe12510
1 changed files with 12 additions and 9 deletions
  1. +12
    -9
      main.py

+ 12
- 9
main.py View File

@@ -87,15 +87,18 @@ def main () -> None:
has_got_snack_time = False

if now.hour == 15 and not has_got_snack_time:
with open ('./assets/snack-time.jpg', 'rb') as f:
image = models.AppBskyEmbedImages.Image (
alt = 'おやつタイムだ!!!!',
image = client.com.atproto.repo.upload_blob (f).blob)

client.send_post (Talk.main ('おやつタイムだ!!!!'),
embed = models.app.bsky.embed.images.Main (
images = [image]))
last_posted_at = now
try:
with open ('./assets/snack-time.jpg', 'rb') as f:
image = models.AppBskyEmbedImages.Image (
alt = 'おやつタイムだ!!!!',
image = client.com.atproto.repo.upload_blob (f).blob)

client.send_post (Talk.main ('おやつタイムだ!!!!'),
embed = models.app.bsky.embed.images.Main (
images = [image]))
last_posted_at = now
except Exception:
pass

has_got_snack_time = True



Loading…
Cancel
Save