From 0e6fe1251035e402c1f932bf11609b4cae2a30f7 Mon Sep 17 00:00:00 2001 From: miteruzo Date: Thu, 5 Sep 2024 01:22:59 +0900 Subject: [PATCH] =?UTF-8?q?=E3=81=8A=E3=82=84=E3=81=A4=E3=82=BF=E3=82=A4?= =?UTF-8?q?=E3=83=A0=E5=A4=B1=E6=95=97=E6=99=82=E3=81=AB=E3=81=AF=E3=82=A8?= =?UTF-8?q?=E3=83=A9=E3=83=BC=E3=82=92=E6=8F=A1=E3=82=8A=E6=BD=B0=E3=81=99?= =?UTF-8?q?=E3=82=84=E3=81=85=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/main.py b/main.py index b85f6e4..0bc0908 100644 --- a/main.py +++ b/main.py @@ -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