ニジカ返答の改行と,改行をログに記録しないやぅ修正
このコミットが含まれているのは:
@@ -31,7 +31,7 @@ class Main:
|
|||||||
italic = True)
|
italic = True)
|
||||||
nizika_font = pygame.font.SysFont ('07nikumarufont', 50)
|
nizika_font = pygame.font.SysFont ('07nikumarufont', 50)
|
||||||
|
|
||||||
messages: list[str] = []
|
chat_items: list = []
|
||||||
|
|
||||||
while (True):
|
while (True):
|
||||||
screen.fill ((0, 255, 0))
|
screen.fill ((0, 255, 0))
|
||||||
@@ -49,7 +49,7 @@ class Main:
|
|||||||
if live_chat.is_alive ():
|
if live_chat.is_alive ():
|
||||||
screen.blit (
|
screen.blit (
|
||||||
system_font.render (
|
system_font.render (
|
||||||
f'messages == {messages}',
|
f'chat_items == {chat_items}',
|
||||||
True, (0, 0, 0)),
|
True, (0, 0, 0)),
|
||||||
(i % 2, 64 + i // 2 * 2))
|
(i % 2, 64 + i // 2 * 2))
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ class Main:
|
|||||||
chat_item = random.choice (chat_items)
|
chat_item = random.choice (chat_items)
|
||||||
chat_item.author = chat_item.author.__dict__
|
chat_item.author = chat_item.author.__dict__
|
||||||
message: str = chat_item.message
|
message: str = chat_item.message
|
||||||
answer: str = Talk.main (message, chat_item.author['name'])
|
answer: str = Talk.main (message, chat_item.author['name']).replace ('\n', ' ')
|
||||||
|
|
||||||
with open ('log.txt', 'a') as f:
|
with open ('log.txt', 'a') as f:
|
||||||
f.write (f'{datetime.now ()}\t{json.dumps (chat_item.__dict__)}\t{answer}\n')
|
f.write (f'{datetime.now ()}\t{json.dumps (chat_item.__dict__)}\t{answer}\n')
|
||||||
@@ -73,17 +73,35 @@ class Main:
|
|||||||
<= 21)
|
<= 21)
|
||||||
else (CommonModule.mid_by_full (
|
else (CommonModule.mid_by_full (
|
||||||
message, 0, 19.5)
|
message, 0, 19.5)
|
||||||
+ '...')), True, (0, 0, 0)),
|
+ '...')),
|
||||||
|
True,
|
||||||
|
(0, 0, 0)),
|
||||||
(120, 70))
|
(120, 70))
|
||||||
screen.blit (
|
screen.blit (
|
||||||
nizika_font.render (answer, True, (192, 0, 0)),
|
nizika_font.render (
|
||||||
|
(answer
|
||||||
|
if CommonModule.len_by_full (answer) <= 26
|
||||||
|
else CommonModule.mid_by_full (answer, 0, 26)),
|
||||||
|
True,
|
||||||
|
(192, 0, 0)),
|
||||||
(100, 150))
|
(100, 150))
|
||||||
|
if CommonModule.len_by_full (answer) > 26:
|
||||||
|
screen.blit (
|
||||||
|
nizika_font.render (
|
||||||
|
(CommonModule.mid_by_full (answer, 26, 26)
|
||||||
|
if CommonModule.len_by_full (answer) <= 52
|
||||||
|
else (CommonModule.mid_by_full (
|
||||||
|
answer, 26, 24.5)
|
||||||
|
+ '...')),
|
||||||
|
True,
|
||||||
|
(192, 0, 0)),
|
||||||
|
(100, 200))
|
||||||
|
|
||||||
pygame.display.update ()
|
pygame.display.update ()
|
||||||
|
|
||||||
noon.play ()
|
noon.play ()
|
||||||
|
|
||||||
time.sleep (2)
|
time.sleep (1.5)
|
||||||
|
|
||||||
wav: bytearray | None = Aques.main (answer)
|
wav: bytearray | None = Aques.main (answer)
|
||||||
if wav is not None:
|
if wav is not None:
|
||||||
|
|||||||
新しい課題から参照
ユーザをブロックする