vin-spiegel / punkland-chat-gpt-demo

펑크랜드 OpenApi 사용 예제

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

punkland-chat-gpt-demo

펑크랜드 OpenApi 사용 예제

사용법

local send_request = require("send_request")
-- 함수 호출 예시
local function chat_to_mina(message)
    local me = Client.myPlayerUnit
    local mina = Client.field.FindNearUnit(me.x, me.y, 200, 1, me)

    send_request_module.send_request_to_openai(message, function(response)
        if mina then
            print("Robot: " .. response)
            mina.Say(response)
        end
    end)
end

-- 채팅이 일어날때마다 chat_to_mina 함수 호출
Client.onChat.Add(function(chat)
    chat_to_mina(chat.text)
end)

About

펑크랜드 OpenApi 사용 예제

License:MIT License


Languages

Language:Lua 100.0%