티스토리 뷰

Portfolio

[Toy] GPT 연동 Discord 봇

Greyfolk99 2023. 3. 23. 06:17

 

 

자주 게임하는 친구들끼리 사용하기 위해 OPENAI 라이브러리를 써서 디스코드 봇을 만들어봤다.

 

기능은 기본적인 Text Completion, Image Generation 을 사용하고

 

Boiler Plate를 줄이기 위해(추후 업데이트를 해보기 위해) COMMANDS 객체에 설명과 로직을 같이 담아 커맨드 인덱싱을 단순히 Key로 찾을 수 있게끔 만들었다.

 

아직 따로 만들어논 커맨드는 없지만 다중으로 argument를 받을 수도 있다.

이런거 보면 역시 스크립트 언어가 편하다..

 

DM 기능은 여러모로 부작용이 있을 것 같아서 빼놨다. 채널 메세지에만 답변해준다.

 

 

 

 

그리고... 이름을 정하던 도중, 최근 깊어진 GPT에 대한 신앙심을 굳건히 하기 위해 지어진 이름하야....

 

 

 

 

 

God GPT v1 (Discord Bot)



Command Prefix: "Lord, "
Splitter : ". "

 

Commands Response Format Content Example
"ping" content "Beloved child, know that my message has been delayed, but rest assured that it will reach you in due time. The delay of ${timeTaken}ms is but a fleeting moment in the grand design of your life. Trust in my divine plan, and know that all is well."
"show me" content, embeds(image) "My dear child, I have heard your call and have come to deliver my holy words upon this image" + image
"help me" content "Fear not, my child, for I bring you divine wisdom. Let me share with you what I have been shown:"
"Divine Law" content, embed(title, description) {commands_available}

examples :

ㄱㅇㅇ

 

신이시여 행복이란 무엇입니까

 

커맨드 표시

 

 
 

 

신에게 거룩한 그의 모습을 보여달라고 했다.
확.정.

 

 

 

https://github.com/greyfolk99/discord-gpt-bot

반응형

'Portfolio' 카테고리의 다른 글

[Toy] God GPT v2.0 (Discord Bot)  (0) 2023.03.25
[개인 포트폴리오 후기] shopme  (1) 2023.02.24
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/05   »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
글 보관함