このコミットが含まれているのは:
2023-12-02 04:46:57 +09:00
コミット 3be7478c42
4個のファイルの変更39行の追加4行の削除
+2 -2
ファイルの表示
@@ -1,7 +1,7 @@
# 各変数に適切な値を設定し,ファイル名を connection.py として保存すること # 各変数に適切な値を設定し,ファイル名を connection.py として保存すること
OPENAI_ORGANISATION = 'org-XXXXXXXXXXXXXXXXXXXXXXXX' \ OPENAI_ORGANISATION: str = 'org-XXXXXXXXXXXXXXXXXXXXXXXX' \
# Organisation ID # Organisation ID
OPENAI_API_KEY = 'sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' \ OPENAI_API_KEY: str = 'sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' \
# API Key # API Key
+37 -2
ファイルの表示
@@ -1,17 +1,51 @@
import pygame import pygame
from pygame.locals import * from pygame.locals import *
import sys import sys
import pytchat
import time
import random
from talk import Talk
YOUTUBE_ID: str = 'aq3QwuYz-KU'
class Main: class Main:
@classmethod @classmethod
def main (cls) -> None: def main (cls) -> None:
pygame.init () pygame.init ()
screen: pygame.Surface = pygame.display.set_mode ((1024, 768))
balloon = pygame.transform.scale (pygame.image.load ('talking.png'),
(1024, 384))
pygame.mixer.init (frequency = 44100)
noon = pygame.mixer.Sound ('noon.wav')
screen: pygame.Surface = pygame.display.set_mode ((640, 480)) live_chat = pytchat.create (video_id = YOUTUBE_ID)
user_font = pygame.font.SysFont ('notosansjpregular', 32,
italic = True)
nizika_font = pygame.font.SysFont ('07にくまるフォント', 50)
while (True): while (True):
screen.fill ((255, 255, 255)) screen.fill ((0, 255, 0))
if live_chat.is_alive ():
messages: list[str] = [c.message
for c in live_chat.get ().items]
if messages:
message: str = random.choice (messages)
answer: str = Talk.main (message)
screen.blit (balloon, (0, 0))
screen.blit (user_font.render ('> ' + message, True,
(0, 0, 0)),
(120, 70))
screen.blit (nizika_font.render (
answer, True, (128, 0, 0)), (100, 150))
noon.play ()
pygame.display.update () pygame.display.update ()
for event in pygame.event.get (): for event in pygame.event.get ():
@@ -19,6 +53,7 @@ class Main:
pygame.quit () pygame.quit ()
sys.exit () sys.exit ()
time.sleep (10)
if __name__ == '__main__': if __name__ == '__main__':
Main.main () Main.main ()
バイナリ
ファイルの表示
バイナリファイルは表示されません.
バイナリ
ファイルの表示
バイナリファイルは表示されません.

変更後

幅:  |  高さ:  |  サイズ: 17 KiB