コミットを比較
3 コミット
a103093e9c
..
main
| 作成者 | SHA1 | 日付 | |
|---|---|---|---|
| 99a5dca5a3 | |||
| a6af306204 | |||
| 9f36cfea28 |
@@ -1,3 +1,5 @@
|
||||
/__pycache__
|
||||
/account.py
|
||||
/connection.py
|
||||
/db
|
||||
/eloquent.pyi
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
/db
|
||||
/eloquent.pyi
|
||||
@@ -1,6 +1,3 @@
|
||||
[submodule "nizika_nico"]
|
||||
path = nizika_nico
|
||||
url = https://git.miteruzo.com/miteruzo/nizika_nico
|
||||
[submodule "nizika_ai"]
|
||||
path = nizika_ai
|
||||
url = https://git.miteruzo.com/miteruzo/nizika_ai.git
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
db/eloquent.pyi
|
||||
@@ -10,9 +10,9 @@ from typing import Any, TypedDict
|
||||
import atproto # type: ignore
|
||||
import requests
|
||||
from atproto import Client # type: ignore
|
||||
from atproto.models import AppBskyEmbedExternal, AppBskyEmbedImages # type: ignore
|
||||
from atproto.models.AppBskyFeedPost import ReplyRef # type: ignore
|
||||
from atproto_client.models import AppBskyEmbedExternal, AppBskyEmbedImages, ComAtprotoRepoStrongRef # type: ignore
|
||||
from atproto_client.models.app.bsky.feed.get_timeline import Response # type: ignore
|
||||
from atproto_client.models.app.bsky.feed.post import ReplyRef # type: ignore
|
||||
from requests.exceptions import Timeout
|
||||
|
||||
import account
|
||||
@@ -92,6 +92,8 @@ async def answer (
|
||||
for answered_flag in answered_flags:
|
||||
td: dict[str, Any]
|
||||
answer = answered_flag.answer
|
||||
answered_flag.answered = True
|
||||
answered_flag.save ()
|
||||
match QueryType (answer.query_rel.query_type):
|
||||
case QueryType.BLUESKY_COMMENT:
|
||||
td = answer.query_rel.transfer_data or { }
|
||||
@@ -100,16 +102,13 @@ async def answer (
|
||||
if (not uri) or (not cid):
|
||||
continue
|
||||
|
||||
sref = { 'uri': uri, 'cid': cid }
|
||||
strong_ref = atproto.models.create_strong_ref (sref) # type: ignore
|
||||
strong_ref = ComAtprotoRepoStrongRef.Main (uri = uri, cid = cid)
|
||||
reply_ref = ReplyRef (root = strong_ref, parent = strong_ref)
|
||||
try:
|
||||
client.post (answer.content, reply_to = reply_ref)
|
||||
client.post (answer.content[:250], reply_to = reply_ref)
|
||||
except Exception as e:
|
||||
print (f"[answer/reply] { type (e).__name__ }: { e }")
|
||||
continue
|
||||
answered_flag.answered = True
|
||||
answered_flag.save ()
|
||||
case QueryType.KIRIBAN | QueryType.NICO_REPORT:
|
||||
td = answer.query_rel.transfer_data or { }
|
||||
video_code: str | None = td.get ('video_code')
|
||||
@@ -136,12 +135,10 @@ async def answer (
|
||||
uri = uri)
|
||||
embed_external = AppBskyEmbedExternal.Main (external = external)
|
||||
try:
|
||||
client.post (answer.content, embed = embed_external)
|
||||
client.post (answer.content[:250], embed = embed_external)
|
||||
except Exception as e:
|
||||
print (f"[answer/nico-post] { type (e).__name__ }: { e }")
|
||||
continue
|
||||
answered_flag.answered = True
|
||||
answered_flag.save ()
|
||||
case QueryType.SNACK_TIME:
|
||||
try:
|
||||
with open ('./assets/snack-time.jpg', 'rb') as f:
|
||||
@@ -159,10 +156,8 @@ async def answer (
|
||||
'下部に「おやつタイムだ!!!!」という'
|
||||
'日本語のテキストが表示されている。'),
|
||||
image = client.com.atproto.repo.upload_blob (f).blob)
|
||||
client.post (answer.content,
|
||||
client.post (answer.content[:250],
|
||||
embed = AppBskyEmbedImages.Main (images = [image]))
|
||||
answered_flag.answered = True
|
||||
answered_flag.save ()
|
||||
except Exception:
|
||||
pass
|
||||
case QueryType.HOT_SPRING:
|
||||
@@ -180,10 +175,8 @@ async def answer (
|
||||
'下部に「温泉に入ろう!!!」という'
|
||||
'日本語のテキストが表示されている。'),
|
||||
image = client.com.atproto.repo.upload_blob (f).blob)
|
||||
client.post (answer.content,
|
||||
client.post (answer.content[:250],
|
||||
embed = AppBskyEmbedImages.Main (images = [image]))
|
||||
answered_flag.answered = True
|
||||
answered_flag.save ()
|
||||
except Exception:
|
||||
pass
|
||||
await asyncio.sleep (10)
|
||||
|
||||
+1
-1
サブモジュール nicolib が更新されました: 32ecf2d00f...85670982f0
+1
-1
サブモジュール nizika_ai が更新されました: 3be6d9063c...1f75763038
-1
サブモジュール nizika_nico が b2f5f81ca8 から削除されました
新しい課題から参照
ユーザをブロックする