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