Back-End ์ž‘์—…์‹ค/Spring Framework

[Spring Boot] Discord Bot(๋””์Šค์ฝ”๋“œ ๋ด‡) ๋งŒ๋“ค๊ธฐ - ๋””์Šค์ฝ”๋“œ ๋ด‡์„ ์ด์šฉํ•˜์—ฌ API ํ˜ธ์ถœ

์ฃผ๋‹ˆ์“ฐ๐Ÿง‘‍๐Ÿ’ป 2023. 3. 17. 22:37
728x90
๋ฐ˜์‘ํ˜•




 

 

 

 

์ „์ž์ •๋ถ€ ํ‘œ์ค€ ํ”„๋ ˆ์ž„์›Œํฌ์˜ ์–‘๋Œ€ ํ•ต์‹ฌ ๊ธฐ์ˆ  ์„ธํŠธ : ์Šคํ”„๋ง + ๋งˆ์ด๋ฐ”ํ‹ฐ์Šค

COUPANG

www.coupang.com

"์ด ํฌ์ŠคํŒ…์€ ์ฟ ํŒก ํŒŒํŠธ๋„ˆ์Šค ํ™œ๋™์˜ ์ผํ™˜์œผ๋กœ, ์ด์— ๋”ฐ๋ฅธ ์ผ์ •์•ก์˜ ์ˆ˜์ˆ˜๋ฃŒ๋ฅผ ์ œ๊ณต๋ฐ›์Šต๋‹ˆ๋‹ค."

 

 

 

 




๐Ÿ—‚ ๋ชฉ์ฐจ

1. [Spring Boot] Discord Bot(๋””์Šค์ฝ”๋“œ ๋ด‡) ๋งŒ๋“ค๊ธฐ
2. [Spring Boot] Discord Bot(๋””์Šค์ฝ”๋“œ ๋ด‡) ๋งŒ๋“ค๊ธฐ - Spring Boot(์Šคํ”„๋ง ๋ถ€ํŠธ)๋ฅผ ์ด์šฉํ•œ ๊ฐ„๋‹จํ•œ API ๋งŒ๋“ค๊ธฐ feat.Mybatis(๋งˆ์ด๋ฐ”ํ‹ฐ์Šค)

3. [Spring Boot] Discord Bot(๋””์Šค์ฝ”๋“œ ๋ด‡) ๋งŒ๋“ค๊ธฐ - JAVA๋ฅผ ์ด์šฉํ•œ API ํ˜ธ์ถœ

4. [Spring Boot] Discord Bot(๋””์Šค์ฝ”๋“œ ๋ด‡) ๋งŒ๋“ค๊ธฐ - ๋””์Šค์ฝ”๋“œ ๋ด‡์„ ์ด์šฉํ•˜์—ฌ API ํ˜ธ์ถœ

 

 

 

 

๐Ÿš€ ์‹œ์ž‘ํ•˜๊ธฐ ์ „์—

    ๐Ÿ”ฝ  ๊ฐœ์š”

์•ˆ๋…•ํ•˜์„ธ์š”? ์ฃผ๋‹ˆ์ž…๋‹ˆ๋‹ค.

์ด๋ฒˆ ๊ธ€์—์„œ๋Š” ์ง€๋‚œ๋ฒˆ์— JAVA(์ž๋ฐ”)๋ฅผ ํ†ตํ•ด API ํ˜ธ์ถœ์ด ๊ฐ€๋Šฅํ•˜๊ฒŒ ๋งŒ๋“  ์ฝ”๋“œ์™€ ๋”๋ถˆ์–ด ๋ณธ๊ฒฉ์ ์œผ๋กœ ๋””์Šค์ฝ”๋“œ ๋ด‡์„ ํ†ตํ•ด ํ•ด๋‹น API๋ฅผ ํ˜ธ์ถœํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ์ •๋ฆฌํ•ด ๋ณด๋ ค๊ณ  ํ•ด์š”.

์ด ๊ธฐ๋Šฅ์„ ํ†ตํ•ด Data Base(๋ฐ์ดํ„ฐ ๋ฒ ์ด์Šค)์— ์žˆ๋Š” ๊ฐ’์„ ์›น ํŽ˜์ด์ง€๋ฅผ ํ†ตํ•ด ๋ณผ์ˆ˜๋„ ์žˆ๊ฒ ์ง€๋งŒ, ๋””์Šค์ฝ”๋“œ์—์„œ ๋ณด๋‹ค ๊ฐ„ํŽธํ•˜๊ฒŒ ๋ณผ ์ˆ˜ ์žˆ๋‹ค๋ฉด ์–ผ๋งˆ๋‚˜ ์ข‹์„๊นŒ? ๋ผ๋Š” ์˜๋ฌธ๊ณผ ํ•„์š”์— ์˜ํ•ด ๋งŒ๋“ค์–ด ๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

 

 

 

GitHub - junyharang-personal-project/juny-discord-bot-test: JDA๋ฅผ ์ด์šฉํ•œ Spring Boot Discord Bot ์—ฐ์Šต์ด์—์š”.

JDA๋ฅผ ์ด์šฉํ•œ Spring Boot Discord Bot ์—ฐ์Šต์ด์—์š”. Contribute to junyharang-personal-project/juny-discord-bot-test development by creating an account on GitHub.

github.com

 

 

 

 

    ๐Ÿ”ฝ Discord Bot ๋งŒ๋“ค๊ธฐ

com/junyss/discordbottest/listener/JunyssDiscordListener.java 1 ~ 39๋ฒˆ์งธ ์ค„

 


์ตœ์ดˆ JDA์˜ ListenerAdapter๋ฅผ ์ƒ์†ํ•˜์—ฌ onMessageReceived()๋ฅผ ์žฌ ์ •์˜(Override) ํ•ด ์ฃผ์—ˆ์–ด์š”.

29๋ฒˆ์งธ ์ค„์— MessageReceivedEvent ๊ฐ์ฒด์•ˆ์— getAuthor()๋ฅผ ํ˜ธ์ถœํ•˜๊ฒŒ ๋˜๋ฉด ๋””์Šค์ฝ”๋“œ์—์„œ ๋ฉ”์‹œ์ง€๋ฅผ ๋ณด๋‚ธ ์‚ฌ์šฉ์ž์˜ ์ •๋ณด๋ฅผ User ๊ฐ์ฒด๋ฅผ ํ†ตํ•ด ์–ป์„ ์ˆ˜ ์žˆ์–ด์š”.


๊ทธ๋ฆฌ๊ณ , MessageReceivedEvent ๊ฐ์ฒด์•ˆ์— getMessage()๋ฅผ ํ†ตํ•ด ์‚ฌ์šฉ์ž๊ฐ€ ๋ณด๋‚ธ Message(๋ฉ”์‹œ์ง€) ๊ฐ’์„ ๋ฉ”์‹œ์ง€ ๊ฐ์ฒด๋ฅผ ํ†ตํ•ด ์–ป์„ ์ˆ˜ ์žˆ๋‹ต๋‹ˆ๋‹ค.

34๋ฒˆ์งธ ๋ถ„๊ธฐ๋ฌธ์€ ๋ฉ”์‹œ์ง€๋ฅผ ๋ณด๋‚ธ ์ฃผ์ฒด๊ฐ€ Bot(๋ด‡)์ธ์ง€ ํ™•์ธ์„ ํ•˜๊ณ  ์žˆ์–ด์š”.
๋งŒ์•ฝ ๋ด‡์ด ๋ณด๋‚ธ ๋ฉ”์‹œ์ง€๊นŒ์ง€ ๋‹ต์žฅ์„ ์ฒ˜๋ฆฌํ•˜๊ฒŒ ๋˜๋ฉด ์–ด๋–ค ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ์„ ๋•Œ, ์—„์ฒญ๋‚œ ๋ถ€ํ•˜๊ฐ€ ๊ฑธ๋ฆฌ๊ฒŒ ๋  ๊ฒƒ์ด๊ธฐ ๋•Œ๋ฌธ์— ๋ด‡์ด ๋ณด๋‚ธ ๋ฉ”์‹œ์ง€๋Š” ๋ฌด์‹œํ•˜๋„๋ก ํ•˜๊ณ , 36๋ฒˆ์งธ ๋ถ„๊ธฐ๋ฌธ์€ ๋””์Šค์ฝ”๋“œ์—์„œ ๋ณด๋‚ด์˜จ ๋ฉ”์‹œ์ง€ ๊ฐ’์ด ๊ณต๋ฐฑ์ผ ๊ฒฝ์šฐ ๊ณต๋ฐฑ์ด๋ผ๋Š” ๋‚ด์šฉ์„ ์„œ๋ฒ„์—์„œ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด Log(๋กœ๊ทธ)๋ฅผ ์ฐ์–ด์ฃผ๋Š” ๋ถ€๋ถ„์ด์—์š”.

com/junyss/discordbottest/listener/JunyssDiscordListener.java 22 ~ 49๋ฒˆ์งธ ์ค„

 

 

40๋ฒˆ์งธ ์ค„์— CheckDicordCommand ๊ฐ์ฒด์˜ Static Method(๋ฉ”์†Œ๋“œ) checkCommand()๋ฅผ ํ˜ธ์ถœํ•˜๋Š”๋ฐ, ์ด ๋•Œ,  ๋ฉ”์‹œ์ง€ Event(์ด๋ฒคํŠธ)๋ฅผ ์ฒ˜๋ฆฌํ•˜๊ธฐ ์œ„ํ•œ MessageReceivedEvent์™€ ์‚ฌ์šฉ์ž๊ฐ€ ๋ณด๋‚ธ ๋ฉ”์‹œ์ง€ ๋ฌธ์ž์—ด์„ ๊ณต๋ฐฑ์œผ๋กœ ๋ถ„ํ• ํ•˜์—ฌ String[] (๋ฌธ์ž์—ด ๋ฐฐ์—ด)๋กœ ๋งŒ๋“ค์–ด์ ธ์„œ ๋ณด๋‚ด์ง€๊ฒŒ ํ•ด ์ฃผ์—ˆ์–ด์š”.


com/junyss/discordbottest/command/CheckDiscordCommand.java 1 ~ 45๋ฒˆ์งธ ์ค„

 


CheckDiscordCommand ๊ฐ์ฒด๋Š” ์‹ค์ œ ์‚ฌ์šฉ์ž๊ฐ€ ๋ณด๋‚ธ ๋ฉ”์‹œ์ง€๋ฅผ ํ™•์ธํ•˜์—ฌ ๊ทธ์— ๋งž๋Š” ๋‹ต๋ณ€์„ ์ฒ˜๋ฆฌํ•˜๊ธฐ ์œ„ํ•œ ๋””์Šค์ฝ”๋“œ ๋ด‡์˜ ํ•ต์‹ฌ ๊ฐ์ฒด ์ค‘ ํ•˜๋‚˜์—์š”.

์œ„์—์„œ ํ˜ธ์ถœํ•œ checkCommand()๋Š” ๋ฉ”์‹œ์ง€ Event(์ด๋ฒคํŠธ)๋ฅผ ์ฒ˜๋ฆฌํ•˜๊ธฐ ์œ„ํ•œ MessageReceivedEvent์™€ ์‚ฌ์šฉ์ž๊ฐ€ ๋ณด๋‚ธ ๋ฉ”์‹œ์ง€ ๋ฌธ์ž์—ด์„ ๊ณต๋ฐฑ์œผ๋กœ ๋ถ„ํ• ํ•˜์—ฌ String[] (๋ฌธ์ž์—ด ๋ฐฐ์—ด)์„ ๋ฐ›๊ฒŒ ๋˜๊ณ , ํ•ด๋‹น ๋ฌธ์ž์—ด ๋ฐฐ์—ด 0๋ฒˆ์งธ์— ์ฃผ๋‹ˆ์•ผ ํ˜น์€ ๋ฐฐ์—ด 1๋ฒˆ์งธ์— ํฌ๋ฃจ์ „์ฒด์กฐํšŒ๊ฐ€ AND ์—ฐ์‚ฐ (๋ชจ๋‘ ์ฐธ์ด์—ฌ์•ผ ์ฐธ) ์ธ์ง€๋ฅผ ํ™•์ธํ•˜๊ณ  ์žˆ์–ด์š”.


์™œ๋ƒํ•˜๋ฉด ์ฃผ๋‹ˆ๋Š” ์œ„์™€ ๊ฐ™์€ ๋ฐฉ์‹์œผ๋กœ ๋ช…๋ น์–ด๋ฅผ ๋ฐ›๊ณ  ์ฒ˜๋ฆฌํ•˜๊ณ  ์‹ถ๊ธฐ ๋•Œ๋ฌธ์ด์—์š”.

๋งŒ์•ฝ 33๋ฒˆ์งธ ์ค„์ด ์ฐธ์ด๋ผ๋ฉด 


์œ„์™€ ๊ฐ™์€ ๋‹ต๋ณ€์„ ๋‚จ๊ธธ ๋•Œ, Embed๊ฐ€ ์•„๋‹Œ ๋‚ด์šฉ์„ ์ตœ์ดˆ result List์— ๋„ฃ์–ด์ฃผ๊ฒŒ ๋˜์š”.
๊ทธ๋Ÿฐ ๋’ค ์ƒ์„ธ ๋‚ด์šฉ์€ Embed์— ๋“ค์–ด๊ฐ€๊ฒŒ ํ•˜๊ธฐ ์œ„ํ•ด ๋‹ค์Œ List์— ๋„ฃ์–ด์ฃผ๊ฒŒ ํ•ด ์ฃผ์—ˆ์–ด์š”.

checkBodyCommandForAPICall()์„ ํ˜ธ์ถœํ•˜๋ฉด์„œ ์‚ฌ์šฉ์ž๊ฐ€ ๋ณด๋‚ธ ๋ฉ”์‹œ์ง€ ๋ฌธ์ž์—ด์„ ๊ณต๋ฐฑ์œผ๋กœ ๋ถ„ํ• ํ•˜์—ฌ String[] (๋ฌธ์ž์—ด ๋ฐฐ์—ด)์„ ๋ณด๋‚ด์ฃผ๊ณ  ์ฒ˜๋ฆฌ๋ฅผ ํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.


com/junyss/discordbottest/command/CheckDiscordCommand.java 45 ~ 72๋ฒˆ์งธ ์ค„


checkBodyCommandForAPICall์€ ์‹ค์ œ API ํ˜ธ์ถœ์„ ๋‹ด๋‹นํ•˜๋Š” ๋ฉ”์†Œ๋“œ๋ฅผ ํ˜ธ์ถœํ•˜๋Š” ์—ญํ• ์„ ๋งก๊ณ  ์žˆ์–ด์š”.
์ด ๋•Œ, ์‚ฌ์šฉ์ž๊ฐ€ ๋ณด๋‚ธ ๋ฉ”์‹œ์ง€๋ฅผ ํ†ตํ•ด ์—ฌ๋Ÿฌ๊ฐ€์ง€ ๊ฒฝ์šฐ๋ฅผ ํ™•์ธํ•˜๊ณ , ๊ทธ์— ๋งž๋Š” API ํ˜ธ์ถœ ๋ฉ”์†Œ๋“œ๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ ๊ฐ’์„ ์ฒ˜๋ฆฌํ•˜๊ฒŒ ๋˜๋Š”๋ฐ, ์ตœ์ดˆ 57๋ฒˆ์งธ ์ค„์— commandOption()์— ๋Œ€ํ•ด ์•Œ์•„๋ณผ๊ฒŒ์š”.

com/junyss/discordbottest/command/CheckDiscordCommand.java 118 ~ 127๋ฒˆ์งธ ์ค„


์œ„ ๋ฉ”์†Œ๋“œ๋Š” ์‚ฌ์šฉ์ž๊ฐ€ ๋ณด๋‚ธ ๋ฉ”์‹œ์ง€์— - ๋ฌธ์ž๊ฐ€ ์žˆ๋Š”์ง€๋ฅผ ํ™•์ธํ•˜๊ณ , ์žˆ๋‹ค๋ฉด True, ์—†๋‹ค๋ฉด False๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋Š” ์—ญํ• ์„ ๋งก๊ณ  ์žˆ์–ด์š”.


์œ„์™€ ๊ฐ™์ด ์‚ฌ์šฉ์ž๊ฐ€ ๋ฉ”์‹œ์ง€๋ฅผ ๋ณด๋ƒˆ์„ ๋•Œ, ๊ฒ€์ƒ‰ ์กฐ๊ฑด์„ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด -๋ฅผ ๋ณด๋‚ด๊ฒŒ ํ•  ๊ฒƒ์ด๊ณ , ์ด -๋ฅผ ํ†ตํ•ด ๋””์Šค์ฝ”๋“œ ๋ด‡์ด ๊ฒ€์ƒ‰ ์กฐ๊ฑด์ด๋ผ๋Š” ๊ฒƒ์„ ํŒ๋‹จํ•˜๊ฒŒ ํ•˜๊ธฐ ์œ„ํ•จ์ด์—์š”.


com/junyss/discordbottest/command/CheckDiscordCommand.java 45 ~ 72๋ฒˆ์งธ ์ค„


๊ทธ๋ ‡๋‹ค๋ฉด 57๋ฒˆ์งธ ์ค„์— ๊ฒ€์ƒ‰ ์กฐ๊ฑด์ด ์žˆ๋‹ค๋Š” ๊ฒƒ์ด ํ™•์ธ์ด ๋˜๋ฉด 58 ~ 64๋ฒˆ์งธ ๊นŒ์ง€ ๋‚ด์šฉ์ด ๋™์ž‘ํ•˜๊ฒŒ ๋ ๊ฑฐ์—์š”.

์ด๋ฒˆ์—๋Š” 58๋ฒˆ์งธ ์ค„์— checkCommandOption()์— ๋Œ€ํ•ด ์•Œ์•„๋ณผ๊ฒŒ์š”.

com/junyss/discordbottest/command/CheckDiscordCommand.java 128 ~ 154๋ฒˆ์งธ ์ค„

์œ„ ๋ฉ”์†Œ๋“œ๋Š” ๊ฒ€์ƒ‰์–ด์— ๋Œ€ํ•œ ๊ฒ€์ƒ‰ ํƒ€์ž…๊ณผ ๊ฒ€์ƒ‰์–ด๋ฅผ ๋ถ„๋ฆฌํ•˜์—ฌ Map์— Key์™€ Value๋กœ ๋‹ด๊ธฐ ์œ„ํ•œ ์—ญํ• ์„ ํ•˜๊ณ  ์žˆ์–ด์š”.

๊ฒ€์ƒ‰ ์กฐ๊ฑด์€ =์„ ํ†ตํ•ด ๊ฒ€์ƒ‰ ํƒ€์ž…๊ณผ ๊ฒ€์ƒ‰์–ด๋ฅผ ์ž…๋ ฅํ•˜๊ฒŒ ๋˜๋Š”๋ฐ, ์ด๋ฅผ ํ†ตํ•ด =์„ ๊ธฐ์ค€์œผ๋กœ ๋ฌธ์ž์—ด์„ ๋ถ„๋ฆฌํ•˜์—ฌ ๋ฌธ์ž์—ด ๋ฐฐ์—ด์„ ๋งŒ๋“ค์–ด ์ฃผ๊ณ , ํ•ด๋‹น ๋ฌธ์ž์—ด ๋ฐฐ์—ด์˜ ํฌ๊ธฐ๊ฐ€ 2 ์ด์ƒ์ด๋ผ๋ฉด ๋ณธ๊ฒฉ์ ์œผ๋กœ ์ž‘์—…์„ ํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

์ตœ์ดˆ ๋ฐ˜๋ณต๋ฌธ์„ ํ†ตํ•ด ํ•ด๋‹น ๋ฐฐ์—ด ํฌ๊ธฐ๋ณด๋‹ค 1 ์ž‘์€ ํšŒ์ˆ˜๋งŒํผ ๋Œ๊ฒŒ ๋˜๋Š”๋ฐ, ์ด๋Š” ๋ฐฐ์—ด์˜ ํฌ๊ธฐ๊ฐ€ 2์ผ ๋•Œ, 0๋ถ€ํ„ฐ ์‹œ์ž‘ํ•˜์—ฌ 1๊นŒ์ง€ ๋Œ๊ฒŒ ๋˜๋ฉด ์ด ๋‘๋ฒˆ์„ ๋Œ๊ฒŒ ๋˜์š”.

๊ทผ๋ฐ, 144๋ฒˆ์งธ ์ค„์— ๋ฐฐ์—ด์˜ ๊ฐ’์„ ์ •์ˆ˜๋กœ ๋ช…์‹œํ•˜๊ณ  ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ArrayOutOfBound Exception์ด ํ„ฐ์ง€๊ฒŒ ๋ ๊ฑฐ์—์š”. ๊ทธ๋ ‡๊ธฐ ๋•Œ๋ฌธ์— ๋ฐฐ์—ด ํฌ๊ธฐ๋ณด๋‹ค 1 ์ž‘์€ ํšŒ์ˆ˜๋กœ ๋Œ๊ฒŒ ๋งŒ๋“ค์–ด ์ฃผ์—ˆ์–ด์š”.


๋˜ํ•œ 140๋ฒˆ์งธ ์ค„์„ ๋ณด๋ฉด ํ•ด๋‹น ๋ฐฐ์—ด์— ๋ฐ˜๋ณต๋ฌธ ํšŒ์ˆ˜์•ˆ์— ๋ฌธ์ž์—ด์„ -๋กœ ๋ถ„๋ฆฌํ•˜๋Š”๋ฐ, ๊ฒ€์ƒ‰ ํƒ€์ž…์—๋งŒ -๊ฐ€ ์žˆ์–ด์š”. ์ฆ‰, ๊ฒ€์ƒ‰ ํƒ€์ž…๋งŒ ํ•ด๋‹น ๋‚ด์šฉ์„ ์ฒ˜๋ฆฌํ•˜๋ฉด ๋˜๊ธฐ ๋•Œ๋ฌธ์— ๋ฐฐ์—ด ํฌ๊ธฐ๋ณด๋‹ค 1 ์ž‘์€ ํšŒ์ˆ˜๋กœ ๋Œ๋„๋ก ํ•ด ์ค€ ์ด์œ ๋„ ์žˆ์–ด์š”.

 

๋ฐ˜์‘ํ˜•


๊ฒ€์ƒ‰ ์กฐ๊ฑด์€ -๊ฒ€์ƒ‰ํƒ€์ž…=๊ฒ€์ƒ‰์–ด๋กœ ๋“ค์–ด์˜ค๊ฒŒ ๋˜์š”. ์ตœ์ดˆ =๋งŒ ๊ธฐ์ค€์œผ๋กœ ํ•ด์„œ ๋ฌธ์ž์—ด ๋ฐฐ์—ด์— ๋„ฃ์–ด์คฌ๊ธฐ ๋•Œ๋ฌธ์— ๊ฒ€์ƒ‰ ํƒ€์ž…์— ๋ถˆํ•„์š”ํ•œ -๋ผ๋Š” ํŠน์ˆ˜๋ฌธ์ž๊ฐ€ ๋“ค์–ด ์žˆ์–ด์š”. ์ด๋ฅผ ์ฒ˜๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด ๋‹ค์‹œ - ๊ธฐ์ค€์œผ๋กœ ๊ฒ€์ƒ‰ ํƒ€์ž…์˜ ๋ฌธ์ž์—ด์„ ๋ถ„๋ฆฌ ์‹œ์ผœ ๋ฌธ์ž์—ด ๋ฐฐ์—ด searchTypeArray๋ฅผ ๋งŒ๋“ค์–ด ์ฃผ์—ˆ์–ด์š”.

๊ทธ๋Ÿฐ ๋’ค ๊ฒ€์ƒ‰ ํƒ€์ž…๋งŒ์„ ๋ฐ›์„ ๋ฌธ์ž์—ด ๋ณ€์ˆ˜ searchType์„ Null๋กœ ์ดˆ๊ธฐํ™” ํ•˜๊ณ , searchTypeArray ์ฆ‰, ๊ฒ€์ƒ‰ ํƒ€์ž…์„ ๋ฐ›์„ ๋ฐฐ์—ด์˜ ํฌ๊ธฐ๊ฐ€ 0๋ณด๋‹ค ํฐ์ง€ ํ™•์ธ์„ ํ•˜๊ณ  ์žˆ์–ด์š”.

-์™€ ๋ฌธ์ž์—ด๋กœ ๋‚˜๋‰˜์–ด์„œ ๋ฐฐ์—ด์— ๋‹ด๊ฒจ ์žˆ์„ ๊ฒƒ์ด๊ธฐ ๋•Œ๋ฌธ์— searchType ๋ณ€์ˆ˜์—๋Š” ๋ฐฐ์—ด ๋‘๋ฒˆ์งธ์— ์œ„์น˜ํ•˜๊ณ  ์žˆ์„ ๊ฒ€์ƒ‰ ํƒ€์ž… ๋ฌธ์ž์—ด์„ ๋‹ด์•„ ์ค๋‹ˆ๋‹ค.

๊ทธ๋Ÿฐ ๋’ค 147๋ฒˆ์งธ ์ค„์— ์ด ๋ฌธ์ž์—ด์ด ์ •์ƒ์ ์œผ๋กœ ๋‹ด๊ฒผ๋Š”์ง€๋ฅผ ํ™•์ธํ•˜๊ณ  ์žˆ์–ด์š”. ๋ฌธ์ž์—ด์ด ์ •์ƒ์ ์œผ๋กœ ๋‹ด๊ฒผ๋‹ค๋ฉด Map์— ๊ฒ€์ƒ‰ ํƒ€์ž…์„ Key ๊ฐ’์œผ๋กœ ๊ฒ€์ƒ‰์–ด๋ฅผ Value๊ฐ’์œผ๋กœ ๋‹ด์•„์ฃผ๊ฒŒ ๋˜๊ณ , ๊ฒ€์ƒ‰ ํƒ€์ž…์ด Null์ด๋ผ๋ฉด ์ผ๋‹จ ์ด ๊ณณ์—์„œ๋Š” Map์— ๊ฐ’์ด ๋‹ด๊ธฐ๊ฒŒ ํ•˜๊ธฐ ์œ„ํ•ด commandOptionArray์˜ 0๋ฒˆ์งธ ๋ฐฐ์—ด๊ฐ’๊ณผ 1๋ฒˆ์งธ ๋ฐฐ์—ด๊ฐ’์ด ๋‹ด๊ธฐ๋„๋ก ํ•˜์—ฌ ์ฃผ์—ˆ์–ด์š”.

com/junyss/discordbottest/command/CheckDiscordCommand.java 45 ~ 72๋ฒˆ์งธ ์ค„

 

checkCommandOption()์— ๋‹ค๋…€์˜ค๊ฒŒ ๋˜๋ฉด 53๋ฒˆ์งธ ์ค„์— ๋งŒ๋“ค์–ด์ค€ Map์— ๊ฒ€์ƒ‰ ํƒ€์ž…๊ณผ ๊ฒ€์ƒ‰์–ด๊ฐ€ ๋‹ด๊ฒจ์žˆ์„ ๊ฑฐ์—์š”.

๊ทธ Map์„ commandOptionValidate()๋ฅผ ํ˜ธ์ถœํ•ด์„œ ๊ฒ€์ƒ‰ ์กฐ๊ฑด์ด ๋‹ด๊ฒจ ์žˆ๋Š”์ง€๋ฅผ ํ™•์ธํ•˜๊ฒŒ ๋˜๊ณ , ๊ฒ€์ƒ‰ ์กฐ๊ฑด์ด ์—†๋‹ค๋ฉด URL Parameter์— ๊ฐ’ ์—†์ด API๋ฅผ ํ˜ธ์ถœํ•˜๋Š” ๋ฉ”์†Œ๋“œ๋ฅผ ํ˜ธ์ถœํ•˜๊ฒŒ ํ•ด ์ฃผ์—ˆ์–ด์š”.

com/junyss/discordbottest/command/CheckDiscordCommand.java 104 ~ 118๋ฒˆ์งธ ์ค„

 

com/junyss/discordbottest/api/crew/model/dto/enumuration/SearchType.java


commandOptionValidate()๋Š” ๊ฒ€์ƒ‰ ํƒ€์ž…๊ณผ ๊ฒ€์ƒ‰์–ด๊ฐ€ ๋‹ด๊ธด Map์„ ๋ฐ›์•„ ํ•ด๋‹น Key ์ฆ‰, ๊ฒ€์ƒ‰ ํƒ€์ž…์ด Enum์œผ๋กœ ์ •์˜๋œ ๊ฒ€์ƒ‰ ํƒ€์ž…๊ณผ ์ผ์น˜ํ•˜๋Š”์ง€ ํ™•์ธํ•˜๊ณ  ์žˆ์–ด์š”.

๋งŒ์•ฝ ์ผ์น˜ํ•œ๋‹ค๋ฉด ๊ฒ€์ƒ‰์„ ํ•˜๊ฒ ๋‹ค๋Š” ์˜๋ฏธ์ด๊ธฐ ๋•Œ๋ฌธ์— True(์ฐธ)์„ ๋ฐ˜ํ™˜ํ• ๊ฑฐ๊ณ , ์ผ์น˜ํ•˜์ง€ ์•Š๋Š”๋‹ค๋ฉด ๊ฒ€์ƒ‰ ์กฐ๊ฑด์„ ์ž˜๋ชป ์ž…๋ ฅํ–ˆ๊ฑฐ๋‚˜, ๊ฒ€์ƒ‰ ์กฐ๊ฑด ์—†์ด ๊ฒ€์ƒ‰์„ ํ•˜๊ฒ ๋‹ค๋Š” ์˜๋ฏธ์ด๊ธฐ ๋•Œ๋ฌธ์— False(๊ฑฐ์ง“)์„ ๋ฐ˜ํ™˜ํ•ด ์ฃผ๊ฒŒ ํ•˜์—ฌ ์ฃผ์—ˆ์–ด์š”.

com/junyss/discordbottest/command/CheckDiscordCommand.java 45 ~ 72๋ฒˆ์งธ ์ค„


61๋ฒˆ์งธ ์ค„์— ์œ„์—์„œ ๊ฑฐ์ง“์œผ๋กœ ๋ฐ˜ํ™˜๊ฐ’์ด ์™”๋‹ค๋ฉด API๋ฅผ ํ˜ธ์ถœํ•  ๋•Œ, URL Parameter ์—†์ด ์ฆ‰, DTO ์—†์ด ํ˜ธ์ถœํ•˜๋Š” ๋ฉ”์†Œ๋“œ๋ฅผ ํ˜ธ์ถœํ•ด ์ค๋‹ˆ๋‹ค.


ํ•˜์ง€๋งŒ, ๊ฒ€์ƒ‰ ์กฐ๊ฑด์ด ์žˆ๋‹ค๊ณ  ํŒ๋‹จ์ด ๋˜๋ฉด 63๋ฒˆ์งธ makeUriParam()์„ ํ˜ธ์ถœํ•˜์—ฌ Map์„ ๋˜์ ธ์ฃผ๊ฒŒ ํ•ด ์ฃผ์—ˆ์–ด์š”.

com/junyss/discordbottest/command/CheckDiscordCommand.java 155 ~ 191๋ฒˆ์งธ ์ค„

makeParam()์€ ๋””์Šค์ฝ”๋“œ๋ฅผ ํ†ตํ•ด ์‚ฌ์šฉ์ž๊ฐ€ API ํ˜ธ์ถœ ๊ด€๋ จ ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ–ˆ์„ ๋•Œ, ๊ฒ€์ƒ‰ ์กฐ๊ฑด์„ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•œ ๋ฉ”์†Œ๋“œ๋กœ Map์œผ๋กœ ๋“ค์–ด์˜จ ๊ฒ€์ƒ‰ ํƒ€์ž…๊ณผ ๊ฒ€์ƒ‰์–ด๋ฅผ ๋ถ„๋ฆฌํ•ด์„œ ๊ฐ๊ฐ DTO์— ๋„ฃ์–ด์ฃผ๊ธฐ ์œ„ํ•œ ์ž‘์—…์„ ํ•ด์ฃผ๊ธฐ ์œ„ํ•œ ๋ฉ”์†Œ๋“œ์—์š”.

165๋ฒˆ์งธ ์ค„์— Map์˜ entrySet()์„ ํ†ตํ•ด Map์˜ ์ „์ฒด Key์™€ Value๋ฅผ ํ•˜๋‚˜ํ•˜๋‚˜ ๊บผ๋‚ด์–ด entry ๋ณ€์ˆ˜์— ๋„ฃ์–ด ์ฃผ์—ˆ์–ด์š”.

๊ทธ๋Ÿฐ ๋’ค Key ๋ฌธ์ž์—ด ๋ณ€์ˆ˜์—๋Š” Key ๋ฌธ์ž์—ด์„ value์—๋Š” value ๋ฌธ์ž์—ด ๊ฐ’์„ ๋„ฃ์–ด์ง€๊ฒŒ ํ–ˆ๊ณ , Switch ๋ฌธ์„ ํ†ตํ•ด key์˜ ๊ฐ’์ด ๊ฒ€์ƒ‰ ํƒ€์ž…์— ์ •์˜ํ•œ ๋‚ด์šฉ๊ณผ ์ผ์น˜ํ•˜๊ฒŒ ๊ฒ€์ƒ‰ ํƒ€์ž…์„ ๋ณด๋ƒˆ๋Š”์ง€ ํ™•์ธํ•˜๊ณ , ๋งž๋‹ค๋ฉด ํ•œ๊ธ€๋กœ ์ž…๋ ฅ๋˜์–ด ์ „์†ก๋œ ๊ฒ€์ƒ‰ ํƒ€์ž…์„ ์˜์–ด๋กœ ๋ฐ”๊ฟ”์ฃผ๋„๋ก ํ•˜์˜€์–ด์š”.

๊ทธ๋ ‡๊ฒŒ ๋ฐ˜๋ณต๋ฌธ์ด ๋๋‚˜๋ฉด setCrewSearchDTO()๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ ๋ณธ๊ฒฉ์ ์œผ๋กœ DTO ๋งŒ๋“ค๊ธฐ ์ž‘์—…์— ๋Œ์ž…ํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.


com/junyss/discordbottest/command/CheckDiscordCommand.java 192 ~ 223๋ฒˆ์งธ ์ค„


setCrewSearchDTO()
๋Š” ์œ„ ๋ฉ”์†Œ๋“œ์—์„œ ์ „๋‹ฌ๋ฐ›์€ ๋งค๊ฐœ ๋ณ€์ˆ˜๋ฅผ ์ด์šฉํ•ด์„œ DTO์— Setter(์„ธํ„ฐ)๋ฅผ ์ด์šฉํ•ด์„œ ๊ฒ€์ƒ‰ ์กฐ๊ฑด์„ ๋„ฃ์–ด์ฃผ๋Š” ์—ญํ• ์„ ๋‹ด๋‹นํ•˜๊ณ  ์žˆ์–ด์š”.

์ตœ์ดˆ ๊ฒ€์ƒ‰ ์กฐ๊ฑด์— ๋‚ ์งœ ๋ฒ”์œ„ ๊ฒ€์ƒ‰ ์กฐ๊ฑด์ด ์žˆ์–ด ์žˆ๋Š”์ง€๋ฅผ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

์žˆ๋‹ค๋ฉด ๋‚ ์งœ ๋ฒ”์œ„ ์กฐ๊ฑด์€ -๋‚ ์งœ=2023.03.10~2023.03.15 ์ด๋ ‡๊ฒŒ ์ž…๋ ฅ์„ ๋ฐ›๊ฒŒ ํ•  ๊ฒƒ์ด๊ธฐ ๋•Œ๋ฌธ์— ~์„ ๊ธฐ์ค€์œผ๋กœ ๋ฌธ์ž์—ด์„ ๋‚˜๋ˆ„๊ณ , ๋ฌธ์ž์—ด ๋ฐฐ์—ด์— ๋“ค์–ด๊ฐ€๋„๋ก ํ•ด ์ฃผ์—ˆ์–ด์š”.

๊ทธ๋ฆฌ๊ณ , ๋‚ ์งœ ๊ฒ€์ƒ‰ ์กฐ๊ฑด์˜ ์‹œ์ž‘ ๋‚ ์งœ์™€ ๋ ๋‚ ์งœ๋ฅผ ์ฒ˜๋ฆฌํ•  ๋ฌธ์ž์—ด ๋ณ€์ˆ˜๋ฅผ ๊ฐ๊ฐ Null๋กœ ์กฐ๊ธฐํ™” ํ•˜๊ณ , For-Each ๋ฌธ์—์„œ ๋ฐ˜๋ณต ํšŒ์ˆ˜๋ฅผ ํŒ๋‹จํ•˜๊ธฐ ์œ„ํ•œ loopCount ๋ณ€์ˆ˜๋ฅผ 0์œผ๋กœ ์ดˆ๊ธฐํ™” ํ•ด ์ฃผ์—ˆ์–ด์š”.

๋ฐ˜๋ณต๋ฌธ์—์„œ ๋‚ ์งœ ๊ฒ€์ƒ‰์–ด๋ฅผ ๋‚˜๋ˆ„์–ด ๋‹ด์€ ๋ฐฐ์—ด์— ๊ฐ’์„ ํ•˜๋‚˜ํ•˜๋‚˜ ๊บผ๋‚ด์„œ isValidSearchDate ๋ฌธ์ž์—ด ๋ณ€์ˆ˜์— ๋„ฃ์–ด์ฃผ๊ณ , loopCount์˜ ๊ฐ’์„ 1์”ฉ ์ฆ๊ฐ€ ์‹œ์ผœ ์ค๋‹ˆ๋‹ค.

๋งŒ์•ฝ loopCount์˜ ๊ฐ’์ด 1๋ณด๋‹ค ํฌ๋‹ค๋ฉด ์ด๋Š” ๋‚ ์งœ ๊ฒ€์ƒ‰ ์‹œ์ž‘์— ๊ฐ’์ด ์•„๋‹Œ ๋์„ ์˜๋ฏธํ•˜๊ธฐ ๋•Œ๋ฌธ์— endDate์— ํ•ด๋‹น ๊ฐ’์„ ๋„ฃ๊ฒŒ ํ•ด ์ฃผ์—ˆ๊ณ , 1๋ณด๋‹ค ์ž‘๋‹ค๋ฉด ์‹œ์ž‘ ๊ฒ€์ƒ‰์„ ์˜๋ฏธํ•˜๊ธฐ ๋•Œ๋ฌธ์— startDate๋ฅผ ๋‹ด๊ฒŒ ํ•ด ์ฃผ์—ˆ์–ด์š”.

com/junyss/discordbottest/command/CheckDiscordCommand.java 224 ~ 243๋ฒˆ์งธ ์ค„


๋‚ ์งœ ๋ณ€์ˆ˜์— ๊ฐ’์„ ๋‹ด์„ ๋•Œ ์œ„ ๋ฉ”์†Œ๋“œ๊ฐ€ ํ˜ธ์ถœ ๋˜๋Š”๋ฐ, ์ด๋Š” ๊ฒ€์ƒ‰์–ด๊ฐ€ ์ •์ƒ์ ์œผ๋กœ ์ž‘์„ฑ๋˜์„œ ๋“ค์–ด์™”๋Š”์ง€์™€ API๋ฅผ ํ†ตํ•ด ๋ฐ์ดํ„ฐ ๋ฒ ์ด์Šค ์กฐํšŒ๋ฅผ ํ•  ๋•Œ, SQL ๋ฌธ์— ๋งž๊ฒŒ ๋ณ€ํ™˜์„ ์‹œ์ผœ์ฃผ๊ธฐ ์œ„ํ•ด ๋ฌธ์ž์—ด Format(ํฌ๋งท)์„ ํ™•์ธํ•˜๊ณ , ๋งž์ถฐ์ฃผ๋Š” ์—ญํ• ์„ ํ•˜๋Š” ๋ฉ”์†Œ๋“œ์—์š”.

SimpleDateFomat ๋ณ€์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋‚ ์งœ ํ˜•์‹์„ ๋งž์ถฐ์ค„ ๋•Œ, parse()๋ฅผ ํ†ตํ•ด ๋ฌธ์ž์—ด๋กœ ์ž…๋ ฅ๋œ ๋‚ ์งœ ๊ฐ’์„ Parsing(ํŒŒ์‹ฑ)ํ•˜์—ฌ SimpleDateFormat ๊ฐ์ฒด๋กœ ๋ณ€ํ™˜ํ•˜๊ฒŒ ๋˜๋Š”๋ฐ, ์ด ๋•Œ, ํŒŒ์‹ฑ์ด ์ œ๋Œ€๋กœ ๋˜์ง€ ์•Š์œผ๋ฉด ParseException์ด ํ„ฐ์ง€๊ธฐ ๋•Œ๋ฌธ์— Catch ๋ฌธ์„ ํ†ตํ•ด ์ด๋ฅผ ์ฒ˜๋ฆฌํ•˜๊ฒŒ ํ•ด ์ฃผ์—ˆ์–ด์š”.

237๋ฒˆ์งธ ์ค„์— ๋ฌธ์ž์—ด์„ ๊ฐ์ฒด๋กœ ๋ฐ”๊พผ ๊ฐ’์„ "yyyy.MM.dd" ํ˜•ํƒœ๋กœ ๋ฐ”๊ฟ”์ค€ ๋’ค ๋ฌธ์ž์—ด๋กœ ๋ฐ˜ํ™˜ํ•˜๊ฒŒ ํ•ด ์ฃผ์—ˆ๊ณ , try ๋ฌธ์—์„œ ๋ฌธ์ œ๊ฐ€ ์ƒ๊ฒจ ์ฒ˜๋ฆฌ ๋˜์ง€ ๋ชปํ•˜๋ฉด Null์ด ๋ฐ˜ํ™˜๋˜๊ฒŒ ํ•ด ์ฃผ์—ˆ์–ด์š”.

com/junyss/discordbottest/command/CheckDiscordCommand.java 192 ~ 223๋ฒˆ์งธ ์ค„

 

217 ~ 218๊นŒ์ง€ Start Date์™€ End Date์— ํŒ๋‹จ์ด ์™„๋ฃŒ ๋˜์—ˆ์œผ๋‹ˆ DTO Setter(์„ธํ„ฐ)๋ฅผ ํ†ตํ•ด ๊ฐ’์ด ๋“ค์–ด๊ฐ€๋„๋ก ํ•ด ์ฃผ์—ˆ๊ณ , ๊ฒ€์ƒ‰ ์กฐ๊ฑด์ด ๋‚ ์งœ ๊ฒ€์ƒ‰์ด ์•„๋‹ˆ๋ผ๋ฉด ๊ฒ€์ƒ‰ ํƒ€์ž…์— Key ๊ฐ’์ธ ๊ฒ€์ƒ‰ ํƒ€์ž… ๋ฌธ์ž์—ด์ด ๊ฒ€์ƒ‰์–ด์— Value์ธ ๊ฒ€์ƒ‰์–ด ๋ฌธ์ž์—ด์ด ๋“ค์–ด๊ฐ€๋„๋ก ํ•ด ์ฃผ์—ˆ์–ด์š”.

com/junyss/discordbottest/command/CheckDiscordCommand.java 155 ~ 191๋ฒˆ์งธ ์ค„

๊ทธ๋Ÿฐ ๋’ค DTO๋ฅผ ๋ฐ˜ํ™˜ํ•˜์—ฌ API ํ˜ธ์ถœ ๋•Œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก ์ฒ˜๋ฆฌํ•ด ์ฃผ์—ˆ์–ด์š”.

com/junyss/discordbottest/command/CheckDiscordCommand.java 45 ~ 72๋ฒˆ์งธ ์ค„


67๋ฒˆ์งธ ์ค„์— DTO๊ฐ€ Null์ธ์ง€ ํ™•์ธํ•˜๊ณ , Null์ด ์•„๋‹ˆ๋ผ๋ฉด ๊ฒ€์ƒ‰ ์กฐ๊ฑด์ด ์žˆ๋Š” ๊ฒƒ์ด๊ธฐ ๋•Œ๋ฌธ์— URL ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ๋งŒ๋“œ๋Š” API ํ˜ธ์ถœ์šฉ ๋ฉ”์†Œ๋“œ๋ฅผ ํ˜ธ์ถœํ•˜๊ฒŒ ํ•˜๋ฉด์„œ DTO์™€ HTTP Method Type์„ ๋˜์ ธ ์ฃผ๊ฒŒ ํ•˜์˜€๊ณ ,


DTO๊ฐ€ Null์ด๋ผ๋ฉด ๊ฒ€์ƒ‰ ์กฐ๊ฑด์ด ์—†๋Š” ๊ฒƒ์ด๊ธฐ ๋•Œ๋ฌธ์— ๊ฒ€์ƒ‰ ์กฐ๊ฑด ์—†์ด API๋ฅผ ํ˜ธ์ถœํ•˜๋Š” Method๋ฅผ ํ˜ธ์ถœํ•˜๋ฉด์„œ HTTP Method Type์„ ๋˜์ ธ์ฃผ๊ฒŒ ํ•˜์˜€์–ด์š”.


com/junyss/discordbottest/command/CheckDiscordCommand.java 1 ~ 45๋ฒˆ์งธ ์ค„


35๋ฒˆ์งธ ์ค„์— API๋ฅผ ํ˜ธ์ถœํ•ด์„œ ๋ฐ›์„ ๋ฌธ์ž์—ด ๊ฐ’์ด ๋ฐ˜ํ™˜๋˜๊ฒŒ ๋ ๊ฑฐ๊ณ , ์ด๋ฅผ List์— ๋‹ด์•„ ์ค€ ๋’ค ๋ฐ˜ํ™˜ํ•˜๊ฒŒ ํ•ด ์ฃผ์—ˆ์–ด์š”.


๋งŒ์•ฝ ๊ฒ€์ƒ‰ ์กฐ๊ฑด ์—†์ด ๋””์Šค์ฝ”๋“œ ๋ด‡๋งŒ ๋ถˆ๋ €๋‹ค๋ฉด ๊ทธ ์ฒ˜๋ฆฌ๋ฅผ ๋”ฐ๋กœ ํ•ด ์ค„ ๋ฉ”์†Œ๋“œ๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ ๊ทธ ๊ฐ’๋“ค์„ ๋ฆฌ์ŠคํŠธ์— ๋‹ด๊ฒŒ ํ•˜๊ณ , ๋ฐ˜ํ™˜ํ•ด ์ค๋‹ˆ๋‹ค.

com/junyss/discordbottest/command/CheckDiscordCommand.java 73 ~ 103๋ฒˆ์งธ ์ค„

 


API๋ฅผ ํ†ตํ•ด ๊ฐ’์„ ํ˜ธ์ถœํ•˜๋Š” ๋ช…๋ น์–ด๊ฐ€ ์•„๋‹Œ ๋‹จ์ˆœํžˆ ๋””์Šค์ฝ”๋“œ ๋ด‡๊ณผ ๊ฐ„๋‹จํ•œ ๋Œ€ํ™”๋ฅผ ํ•ด ๋ณผ ์ˆ˜ ์žˆ๋Š” ๋ช…๋ น์–ด์— ๋Œ€ํ•ด ์‘๋‹ต ๋ฉ”์‹œ์ง€๋ฅผ ๋งŒ๋“ค ๋ฉ”์†Œ๋“œ์—์š”.

์‚ฌ์šฉ์ž๊ฐ€ ์ž…๋ ฅํ•œ ๋ช…๋ น์–ด๋ฅผ ๊ณต๋ฐฑ์œผ๋กœ ๋‚˜๋ˆ„์–ด ๋‹ด์€ ๋ฐฐ์—ด์—๋Š” ๋””์Šค์ฝ”๋“œ ๋ด‡(์ฃผ๋‹ˆ์•ผ)๋ฅผ ๋ถ€๋ฅธ ๋’ค ์–ด๋–ค ๋‚ด์šฉ์ด ๋‹ด๊ฒจ ์žˆ์„ ๊ฑฐ์—์š”.
๊ทธ ๋‚ด์šฉ์€ ๋ฐฐ์—ด์˜ 1๋ฒˆ์งธ์— ์œ„์น˜ํ•ด ์žˆ์„ ๊ฒƒ์ด๊ณ , ๊ทธ ๋‚ด์šฉ์„ switch๋ฌธ์„ ํ†ตํ•ด ํ™•์ธํ•˜๋Š”๋ฐ, case ๋ฌธ์— ์ž…๋ ฅ๋œ ๋ฌธ์ž์—ด์„ ํ™•์ธํ•˜๊ณ , ๊ทธ์— ๋งž๋Š” ๋Œ€๋‹ต์„ ํ•ด ์ค„ ์ˆ˜ ์žˆ๊ฒŒ ํ•ด ์ฃผ์—ˆ์–ด์š”.

๊ทธ๋Ÿฐ๋ฐ, ๋งŒ์•ฝ ํฌ๋ฃจ์ „์ฒด์กฐํšŒ ๋ผ๋Š” ๋ช…๋ น์–ด๊ฐ€ ๋“ค์–ด์˜ค๊ฒŒ ๋œ๋‹ค๋ฉด ๋‹ค์‹œ checkBodyCommandForAPICall()์„ ํ˜ธ์ถœํ•˜์—ฌ ๋ช…๋ น์–ด ๋ฐฐ์—ด์„ ์ „๋‹ฌํ•˜๊ฒŒ ํ•ด ์ฃผ์—ˆ์–ด์š”.

์ด๋ ‡๊ฒŒ ๋˜๋ฉด ๊ฒ€์ƒ‰ ์กฐ๊ฑด์ด ์—†๊ธฐ ๋•Œ๋ฌธ์— URL Parameter๊ฐ€ ์—†๋Š” API ํ˜ธ์ถœ ๋ฉ”์†Œ๋“œ๋ฅผ ํ˜ธ์ถœํ•˜๊ฒŒ ๋ ๊ฑฐ๊ณ , ๊ทธ์— ๋งž๋Š” ์ „์ฒด ๋ชฉ๋ก ์กฐํšŒ ๊ฒฐ๊ณผ๊ฐ€ ๋ฐ˜ํ™˜๋˜๊ฒŒ ๋ ๊ฑฐ์—์š”.

์ด๋ ‡๊ฒŒ ๋””์Šค์ฝ”๋“œ ๋ด‡์— ์‘๋‹ต ๋ฉ”์‹œ์ง€๋ฅผ ๋‹ด์€ ๋ฌธ์ž์—ด ๋ณ€์ˆ˜ result๋ฅผ ๋ฐ˜ํ™˜ํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.


com/junyss/discordbottest/listener/JunyssDiscordListener.java 26 ~ 48๋ฒˆ์งธ ์ค„


checkCommand()
๋ฅผ ํ†ตํ•ด ๋ณต์žกํ•˜๊ณ , ๊ธฐ๋‚˜๊ธด ์—ฌํ–‰์„ ํ•˜๊ณ , ๋””์Šค์ฝ”๋“œ ๋ด‡์— ์‘๋‹ต ๋ฉ”์‹œ์ง€๋ฅผ ๋ฐ›๊ฒŒ ๋˜๋ฉด ์ด๋ฅผ resultList๊ฐ€ ๋ฐ›๊ฒŒ ๋˜์š”.


๊ทธ๋ฆฌ๊ณ , ๊ทธ List๊ฐ€ Null์ธ์ง€๋ฅผ ํ™•์ธํ•˜๊ฒŒ ๋˜๊ณ , Null์ด ์•„๋‹ˆ๋ฉด ๋ณธ๊ฒฉ์ ์œผ๋กœ ์‘๋‹ต ๋ฉ”์‹œ์ง€๋ฅผ ์˜ˆ์˜๊ฒŒ ๊พธ๋ฉฐ์ค„ createSendMessage()๋ฅผ ํ˜ธ์ถœํ•˜๋Š”๋ฐ, MessageReceivedEvent ๊ฐ์ฒด์™€ ์ผ๋ฐ˜ ์‘๋‹ต ๋ฉ”์‹œ์ง€๋ฅผ ๋‹ด์€ List 0๋ฒˆ์งธ ๋ฌธ์ž์—ด, Embed๋กœ ๊พธ๋ฉฐ์ค„ ์‘๋‹ต ๋ฉ”์‹œ์ง€๋ฅผ ๋‹ด์€ 1๋ฒˆ์งธ ๋ฌธ์ž์—ด์„ Null ์ฒดํฌ๋ฅผ ํ•˜๊ณ  ๋ณด๋‚ด์ฃผ๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.


com/junyss/discordbottest/listener/JunyssDiscordListener.java 48 ~ 78๋ฒˆ์งธ ์ค„


createSendMessage()
๋Š” ๋””์Šค์ฝ”๋“œ ๋ด‡์˜ ์‘๋‹ต ๋ฉ”์‹œ์ง€๋ฅผ ์˜ˆ์˜๊ฒŒ, ์•Œ๋งž๊ฒŒ ๋งŒ๋“ค์–ด์ฃผ๋Š” ์—ญํ• ์„ ํ•˜๊ณ  ์žˆ์–ด์š”.


์ตœ์ดˆ 56๋ฒˆ์งธ ๋ณ€์ˆ˜์— 1950 ์ •์ˆ˜๋ฅผ ๋„ฃ์€ ์ด์œ ๋Š” ๋””์Šค์ฝ”๋“œ๋Š” ํ•œ๋ฒˆ์— 2000์ž ์ดํ•˜์˜ ๋ฉ”์‹œ์ง€๋งŒ ๋ณด๋‚ผ ์ˆ˜ ์žˆ์–ด์š”.
๊ทธ๋ž˜์„œ ํ˜น์‹œ ๋ชจ๋ฅผ ๋„˜์นจ์„ ์˜ˆ๋ฐฉํ•˜๊ธฐ ์œ„ํ•ด 1950๊นŒ์ง€ ๋ฌธ์ž์—ด ๊ฐ’์„ ํ™•์ธํ•  ์ƒํƒœ ๋ณ€์ˆ˜๋ฅผ ๋งŒ๋“ค์–ด ์ฃผ์—ˆ๊ณ ,

resultMessageSize ๋ณ€์ˆ˜์— Embed๋กœ ๋ณด๋‚ผ ๋ฌธ์ž์—ด ํฌ๊ธฐ๋ฅผ ๋‹ด์•„ ์ฃผ์—ˆ์–ด์š”.

59๋ฒˆ์งธ ์ค„์— ๊ฐ์ฒด๋Š” ๋””์Šค์ฝ”๋“œ์˜ Embed ๋ฉ”์‹œ์ง€๋ฅผ ๊พธ๋ฉฐ์ฃผ๊ณ , ๋ณด๋‚ผ ์ˆ˜ ์žˆ๋Š” ๊ฐ์ฒด์—์š”.

60๋ฒˆ์งธ ์ค„์— Embed์— ํ‘œ์‹œ๋  ์ œ๋ชฉ์„ ๋„ฃ์–ด์ฃผ๊ณ , Embed์— ์ƒ‰์ƒ์„ ๊พธ๋ฉฐ์ฃผ์—ˆ์–ด์š”. ๊ทธ๋Ÿฐ ๋‹ค์Œ Fotter(ํ‘ธํ„ฐ)์— ์ฃผ๋‹ˆ๊ฐ€ ๋ณด๋‚ด๊ณ  ์‹ถ์€ ๋‚ด์šฉ์„ ์ ์–ด ์ฃผ์—ˆ์–ด์š”.

๊ทธ๋Ÿฐ๋ฐ ๋งŒ์•ฝ ๋ช…๋ น์–ด๋ฅผ ์ž˜ ๋ชป ์ž…๋ ฅํ–ˆ๊ฑฐ๋‚˜, ์–ด๋–ค ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•˜์—ฌ returnEmbedMessage ๋ณ€์ˆ˜์— "๋ช…๋ น์–ด๋ฅผ ํ™•์ธํ•ด ์ฃผ์„ธ์š”." ๋ผ๋Š” ๊ฐ’์ด ๋‹ด๊ฒจ ์žˆ๋‹ค๋ฉด embed ์ƒ‰์ƒ์„ ๋นจ๊ฐ„์ƒ‰์œผ๋กœ ํ‘œ์‹œ ๋˜๊ฒŒ ํ•ด ์ฃผ์—ˆ์–ด์š”.

728x90


๊ทธ๋Ÿฐ ๋’ค ๋ฉ”์‹œ์ง€ ํฌ๊ธฐ๋ฅผ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด 68๋ฒˆ์งธ ์ค„์—์„œ ํ™•์ธ์„ ํ•˜๊ณ , 1950๋ณด๋‹ค ํฌ๊ฑฐ๋‚˜ ๊ฐ™๋‹ค๋ฉด ์ผ๋‹จ ๋ฉ”์‹œ์ง€๋ฅผ ๋ณด๋‚ด์ค˜์•ผ ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋ฐ˜๋ณต๋ฌธ์„ ๋Œ๋ ค ์ค๋‹ˆ๋‹ค.

์—ฌ๊ธฐ์„œ ๋ฐ˜๋ณต๋ฌธ์„ ์‚ฌ์šฉํ•œ ์ด์œ ๋Š” ํฌ๊ธฐ์— ๋งž์ถฐ ์—ฌ๋Ÿฌ๋ฒˆ ๋ณด๋‚ด์•ผ ํ•˜๊ธฐ ๋•Œ๋ฌธ์ด์—์š”.

๋ฐ˜๋ณต๋ฌธ์—์„œ ์‘๋‹ต ๋ฉ”์‹œ์ง€ ํฌ๊ธฐ๋ฅผ 1950์œผ๋กœ ๋‚˜๋ˆˆ ๋’ค 1์„ ๋”ํ•ด์ฃผ๋Š”๋ฐ, ์˜ˆ๋ฅผ ๋“ค์–ด 1951์™€ ๋˜‘๊ฐ™๋‹ค๋ฉด ๋‚˜๋ˆˆ ๊ฐ’์€ 0.xxx๊ฐ€ ๋ ๊ฑฐ์—์š”. ๊ทธ๋Ÿฌ๋ฉด ๋ฐ˜๋ณต๋ฌธ์ด ํ•œ๋ฒˆ๋งŒ ๋Œ๊ฒŒ ๋˜๊ณ , ์ด๋ ‡๊ฒŒ ๋˜๋ฉด 1950 ์ดํ›„์— ๋ฌธ์ž์—ด์€ ์ „์†ก์ด ๋˜์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์— 1์„ ๋”ํ•ด ์ฃผ์–ด ๋ฐ˜๋ณต๋˜๊ฒŒ ํ•ด ์ฃผ์—ˆ์–ด์š”.

setDescription()์€ Embed์— ๋ณธ๋ฌธ ๋‚ด์šฉ์„ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ด์ฃผ๋Š” ๋ฉ”์†Œ๋“œ ์ด๊ณ , ์ด ๊ณณ์— ์‘๋‹ต ๋ฉ”์‹œ์ง€๋ฅผ 0๋ถ€ํ„ฐ 1950๊นŒ์ง€ ์งค๋ผ์„œ ๋„ฃ๊ฒŒ ํ•ด์ฃผ๊ณ , ๋ฐ”๋กœ sendMessage()๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ ๋””์Šค์ฝ”๋“œ์— ์‘๋‹ต์ด ๊ฐˆ ์ˆ˜ ์žˆ๊ฒŒ ํ•ด ์ฃผ์—ˆ์–ด์š”.

๋งŒ์•ฝ 1950๋ณด๋‹ค ์‘๋‹ต ๋ฉ”์‹œ์ง€๊ฐ€ ์ž‘๋‹ค๋ฉด ๊ทธ๋ƒฅ ๋ณด๋‚ด๋ฉด ๋˜๊ธฐ ๋•Œ๋ฌธ์— ๋ฐ”๋กœ sendMessage()๋กœ ๋ณด๋‚ด์ฃผ๋„๋ก ํ•˜๊ณ , ๋งˆ์ง€๋ง‰์œผ๋กœ Embed๋ฅผ ์ •๋ฆฌํ•ด ์ฃผ๋Š” clear()๋ฅผ ํ˜ธ์ถœํ•˜๊ณ  ๋๋‚ด๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.



com/junyss/discordbottest/listener/JunyssDiscordListener.java 79 ~ 91๋ฒˆ์งธ ์ค„


๋ฐ”๋กœ ์ด ๋ฉ”์†Œ๋“œ๊ฐ€ ์ตœ์ข…์ ์œผ๋กœ ๋””์Šค์ฝ”๋“œ์— ์‘๋‹ต ๋ฉ”์‹œ์ง€๋ฅผ ๋ณด๋‚ด์ฃผ๋Š” ๋ฉ”์†Œ๋“œ์—์š”.


MessageReceivedEvent ๊ฐ์ฒด์•ˆ์— getChannel()์€ ๋””์Šค์ฝ”๋“œ์˜ ์‘๋‹ตํ•  ์ฑ„๋„ ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์˜ค๊ฒŒ ํ•ด ์ฃผ๊ณ , asTextChannel()์€ ์Œ์„ฑ ๋ฐ ํ™”์ƒ ํšŒ์˜๊ฐ€ ๊ฐ€๋Šฅํ•œ ์ฑ„๋„์ด ์•„๋‹Œ ๋ฌธ์ž๋งŒ ์ฃผ๊ณ  ๋ฐ›์„ ์ˆ˜ ์žˆ๋Š” ์ฑ„๋„์„ ์„ ํƒํ•ด ์ฃผ๋ฉฐ, ์ด๋ฅผ TextChannel ๊ฐ์ฒด๋กœ ๋ฐ›์•„์ฃผ๊ณ , ๊ทธ ๊ฐ์ฒด์•ˆ์— sendMessage()๋ฅผ ํ†ตํ•ด ์ผ๋‹จ ๋ฉ”์‹œ์ง€ ๊ฐ’์„ ๋„ฃ์–ด์ฃผ๊ณ , setEmbeds()๋ฅผ ํ†ตํ•ด Embed์— ๋„ฃ์„ ๋‚ด์šฉ์ด ๋‹ด๊ธด EmbedBuilder ๊ฐ์ฒด๋ฅผ build()๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ ๋„ฃ์–ด์ฃผ๊ณ , queue()๋ฅผ ํ˜ธ์ถœํ•˜๊ฒŒ ๋˜๋ฉด ๋””์Šค์ฝ”๋“œ์— ์ •์ƒ์ ์œผ๋กœ ๋ฉ”์‹œ์ง€๊ฐ€ ์ „๋‹ฌ์ด ๋œ๋‹ต๋‹ˆ๋‹ค!

 

 

    ๐Ÿ”ฝ ๊ฒฐ๊ณผ๋ฌผ

๋ช…๋ น์–ด: ์ฃผ๋‹ˆ์•ผ ์•ˆ๋…•

 

 

๋ช…๋ น์–ด: ์ฃผ๋‹ˆ์•ผ test

 



๋ช…๋ น์–ด: ์ฃผ๋‹ˆ์•ผ ๋ˆ„๊ตฌ์•ผ

 



๋ช…๋ น์–ด: ์ฃผ๋‹ˆ์•ผ ํฌ๋ฃจ์ „์ฒด์กฐํšŒ



// Spring Boot Console Log


2023-03-17 16:07:37.210  INFO 4331 --- [inWS-ReadThread] c.j.d.listener.JunyssDiscordListener     : get message : ์ฃผ๋‹ˆ์•ผ ํฌ๋ฃจ์ „์ฒด์กฐํšŒ
2023-03-17 16:07:37.287  INFO 4331 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2023-03-17 16:07:37.287  INFO 4331 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2023-03-17 16:07:37.288  INFO 4331 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 1 ms
2023-03-17 16:07:37.307  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. Connection.isValid(5) returned true
2023-03-17 16:07:37.308  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. Connection.setReadOnly(true) returned 
2023-03-17 16:07:37.308  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. Connection.getAutoCommit() returned true
2023-03-17 16:07:37.308  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. Connection.setAutoCommit(false) returned 
2023-03-17 16:07:37.337  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. Connection.getAutoCommit() returned false
2023-03-17 16:07:37.343  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. PreparedStatement.new PreparedStatement returned 
2023-03-17 16:07:37.343  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. Connection.prepareStatement(select *
        from crew) returned net.sf.log4jdbc.sql.jdbcapi.PreparedStatementSpy@79eaa2dc
2023-03-17 16:07:37.346  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. select * from crew  {executed in 2 ms}
2023-03-17 16:07:37.346  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. PreparedStatement.execute() returned true
2023-03-17 16:07:37.347  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.new ResultSet returned 
2023-03-17 16:07:37.347  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. PreparedStatement.getResultSet() returned net.sf.log4jdbc.sql.jdbcapi.ResultSetSpy@1d56f127
2023-03-17 16:07:37.350  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getMetaData() returned rsMeta0: columns=5
2023-03-17 16:07:37.353  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getType() returned 1003
2023-03-17 16:07:37.353  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.isClosed() returned false
2023-03-17 16:07:37.353  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.next() returned true
2023-03-17 16:07:37.355  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getLong(IDX) returned 1
2023-03-17 16:07:37.355  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getString(ID) returned u12345678
2023-03-17 16:07:37.355  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getTimestamp(JOIN_DATE) returned 2023-03-17 00:00:00.0
2023-03-17 16:07:37.355  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getString(NAME) returned ํ™๊ธธ๋™
2023-03-17 16:07:37.355  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getString(EMAIL) returned hong1234@gmail.com
2023-03-17 16:07:37.355  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.isClosed() returned false
2023-03-17 16:07:37.355  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.next() returned true
2023-03-17 16:07:37.355  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getLong(IDX) returned 2
2023-03-17 16:07:37.355  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getString(ID) returned u12345679
2023-03-17 16:07:37.355  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getTimestamp(JOIN_DATE) returned 2023-03-17 00:00:00.0
2023-03-17 16:07:37.355  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getString(NAME) returned ๊น€๊ธธ๋™
2023-03-17 16:07:37.355  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getString(EMAIL) returned kim2393@gmail.com
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.isClosed() returned false
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.next() returned true
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getLong(IDX) returned 3
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getString(ID) returned u12345671
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getTimestamp(JOIN_DATE) returned 2023-03-17 00:00:00.0
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getString(NAME) returned ํƒ๊ธธ๋™
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getString(EMAIL) returned tak2934@gmail.com
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.isClosed() returned false
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.next() returned true
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getLong(IDX) returned 4
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getString(ID) returned u12345672
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getTimestamp(JOIN_DATE) returned 2023-03-17 00:00:00.0
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getString(NAME) returned ์ด๊ธธ๋™
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getString(EMAIL) returned lee9038@gmail.com
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.isClosed() returned false
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.next() returned true
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getLong(IDX) returned 5
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getString(ID) returned u12345680
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getTimestamp(JOIN_DATE) returned 2023-03-10 00:00:00.0
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getString(NAME) returned ์ตœ๊ธธ๋™
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getString(EMAIL) returned kim2393@gmail.com
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.isClosed() returned false
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.next() returned true
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getLong(IDX) returned 6
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getString(ID) returned u12345681
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getTimestamp(JOIN_DATE) returned 2023-03-11 00:00:00.0
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getString(NAME) returned ๋ฐ•๊ธธ๋™
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getString(EMAIL) returned tak2934@gmail.com
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.isClosed() returned false
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.next() returned true
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getLong(IDX) returned 7
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getString(ID) returned u12345682
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getTimestamp(JOIN_DATE) returned 2023-03-12 00:00:00.0
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getString(NAME) returned ์œ ๊ธธ๋™
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getString(EMAIL) returned lee9038@gmail.com
2023-03-17 16:07:37.356  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.isClosed() returned false
2023-03-17 16:07:37.357  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 
|----|----------|----------------------|-----|-------------------|
|idx |id        |join_date             |name |email              |
|----|----------|----------------------|-----|-------------------|
|1   |u12345678 |2023-03-17 00:00:00.0 |ํ™๊ธธ๋™  |hong1234@gmail.com |
|2   |u12345679 |2023-03-17 00:00:00.0 |๊น€๊ธธ๋™  |kim2393@gmail.com  |
|3   |u12345671 |2023-03-17 00:00:00.0 |ํƒ๊ธธ๋™  |tak2934@gmail.com  |
|4   |u12345672 |2023-03-17 00:00:00.0 |์ด๊ธธ๋™  |lee9038@gmail.com  |
|5   |u12345680 |2023-03-10 00:00:00.0 |์ตœ๊ธธ๋™  |kim2393@gmail.com  |
|6   |u12345681 |2023-03-11 00:00:00.0 |๋ฐ•๊ธธ๋™  |tak2934@gmail.com  |
|7   |u12345682 |2023-03-12 00:00:00.0 |์œ ๊ธธ๋™  |lee9038@gmail.com  |
|----|----------|----------------------|-----|-------------------|

2023-03-17 16:07:37.357  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.next() returned false
2023-03-17 16:07:37.357  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.close() returned void
2023-03-17 16:07:37.357  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. Connection.getMetaData() returned dbMeta1: conn0: url=jdbc:h2:~/giggal-discord-bot?serverTimezone=UTC&characterEncoding=UTF-8 user=SA
2023-03-17 16:07:37.357  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. PreparedStatement.close() returned 
2023-03-17 16:07:37.358  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. Connection.commit() returned 
2023-03-17 16:07:37.358  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. Connection.setAutoCommit(true) returned 
2023-03-17 16:07:37.358  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. Connection.setReadOnly(false) returned 
2023-03-17 16:07:37.359  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. Connection.clearWarnings() returned 
2023-03-17 16:07:37.729  INFO 4331 --- [inWS-ReadThread] c.j.d.listener.JunyssDiscordListener     : get message : ์ค€์ด๋‹˜ ํฌ๋ฃจ๋“ค์˜ ์ •๋ณด๋Š” ์•„๋ž˜์™€ ๊ฐ™์•„์š”!

 



๋ช…๋ น์–ด: ์ฃผ๋‹ˆ์•ผ ํฌ๋ฃจ์ „์ฒด์กฐํšŒ -์ด๋ฆ„=ํ™๊ธธ๋™

 

// Spring Boot Console Log

2023-03-17 16:09:26.478  INFO 4331 --- [inWS-ReadThread] c.j.d.listener.JunyssDiscordListener     : get message : ์ฃผ๋‹ˆ์•ผ ํฌ๋ฃจ์ „์ฒด์กฐํšŒ -์ด๋ฆ„=ํ™๊ธธ๋™
2023-03-17 16:09:26.495  INFO 4331 --- [nio-8080-exec-3] log4jdbc.log4j2                          : 1. Connection.isValid(5) returned true
2023-03-17 16:09:26.496  INFO 4331 --- [nio-8080-exec-3] log4jdbc.log4j2                          : 1. Connection.setReadOnly(true) returned 
2023-03-17 16:09:26.496  INFO 4331 --- [nio-8080-exec-3] log4jdbc.log4j2                          : 1. Connection.getAutoCommit() returned true
2023-03-17 16:09:26.497  INFO 4331 --- [nio-8080-exec-3] log4jdbc.log4j2                          : 1. Connection.setAutoCommit(false) returned 
2023-03-17 16:09:26.504  INFO 4331 --- [nio-8080-exec-3] log4jdbc.log4j2                          : 1. Connection.getAutoCommit() returned false
2023-03-17 16:09:26.508  INFO 4331 --- [nio-8080-exec-3] log4jdbc.log4j2                          : 1. PreparedStatement.new PreparedStatement returned 
2023-03-17 16:09:26.508  INFO 4331 --- [nio-8080-exec-3] log4jdbc.log4j2                          : 1. Connection.prepareStatement(select *
        from crew

         
             
                    where name like CONCAT('%', ?, '%')) returned net.sf.log4jdbc.sql.jdbcapi.PreparedStatementSpy@6abf3c13
2023-03-17 16:09:26.508  INFO 4331 --- [nio-8080-exec-3] log4jdbc.log4j2                          : 1. PreparedStatement.setString(1, "ํ™๊ธธ๋™") returned 
2023-03-17 16:09:26.509  INFO 4331 --- [nio-8080-exec-3] log4jdbc.log4j2                          : 1. select * from crew where name like CONCAT('%', 'ํ™๊ธธ๋™', '%')  {executed in 1 ms}
2023-03-17 16:09:26.509  INFO 4331 --- [nio-8080-exec-3] log4jdbc.log4j2                          : 1. PreparedStatement.execute() returned true
2023-03-17 16:09:26.509  INFO 4331 --- [nio-8080-exec-3] log4jdbc.log4j2                          : 1. ResultSet.new ResultSet returned 
2023-03-17 16:09:26.509  INFO 4331 --- [nio-8080-exec-3] log4jdbc.log4j2                          : 1. PreparedStatement.getResultSet() returned net.sf.log4jdbc.sql.jdbcapi.ResultSetSpy@6cdcbc6e
2023-03-17 16:09:26.509  INFO 4331 --- [nio-8080-exec-3] log4jdbc.log4j2                          : 1. ResultSet.getMetaData() returned rsMeta2: columns=5
2023-03-17 16:09:26.509  INFO 4331 --- [nio-8080-exec-3] log4jdbc.log4j2                          : 1. ResultSet.getType() returned 1003
2023-03-17 16:09:26.509  INFO 4331 --- [nio-8080-exec-3] log4jdbc.log4j2                          : 1. ResultSet.isClosed() returned false
2023-03-17 16:09:26.509  INFO 4331 --- [nio-8080-exec-3] log4jdbc.log4j2                          : 1. ResultSet.next() returned true
2023-03-17 16:09:26.509  INFO 4331 --- [nio-8080-exec-3] log4jdbc.log4j2                          : 1. ResultSet.getLong(IDX) returned 1
2023-03-17 16:09:26.509  INFO 4331 --- [nio-8080-exec-3] log4jdbc.log4j2                          : 1. ResultSet.getString(ID) returned u12345678
2023-03-17 16:09:26.509  INFO 4331 --- [nio-8080-exec-3] log4jdbc.log4j2                          : 1. ResultSet.getTimestamp(JOIN_DATE) returned 2023-03-17 00:00:00.0
2023-03-17 16:09:26.510  INFO 4331 --- [nio-8080-exec-3] log4jdbc.log4j2                          : 1. ResultSet.getString(NAME) returned ํ™๊ธธ๋™
2023-03-17 16:09:26.510  INFO 4331 --- [nio-8080-exec-3] log4jdbc.log4j2                          : 1. ResultSet.getString(EMAIL) returned hong1234@gmail.com
2023-03-17 16:09:26.510  INFO 4331 --- [nio-8080-exec-3] log4jdbc.log4j2                          : 1. ResultSet.isClosed() returned false
2023-03-17 16:09:26.510  INFO 4331 --- [nio-8080-exec-3] log4jdbc.log4j2                          : 
|----|----------|----------------------|-----|-------------------|
|idx |id        |join_date             |name |email              |
|----|----------|----------------------|-----|-------------------|
|1   |u12345678 |2023-03-17 00:00:00.0 |ํ™๊ธธ๋™  |hong1234@gmail.com |
|----|----------|----------------------|-----|-------------------|

2023-03-17 16:09:26.510  INFO 4331 --- [nio-8080-exec-3] log4jdbc.log4j2                          : 1. ResultSet.next() returned false
2023-03-17 16:09:26.510  INFO 4331 --- [nio-8080-exec-3] log4jdbc.log4j2                          : 1. ResultSet.close() returned void
2023-03-17 16:09:26.510  INFO 4331 --- [nio-8080-exec-3] log4jdbc.log4j2                          : 1. Connection.getMetaData() returned dbMeta2: conn0: url=jdbc:h2:~/giggal-discord-bot?serverTimezone=UTC&characterEncoding=UTF-8 user=SA
2023-03-17 16:09:26.510  INFO 4331 --- [nio-8080-exec-3] log4jdbc.log4j2                          : 1. PreparedStatement.close() returned 
2023-03-17 16:09:26.510  INFO 4331 --- [nio-8080-exec-3] log4jdbc.log4j2                          : 1. Connection.commit() returned 
2023-03-17 16:09:26.510  INFO 4331 --- [nio-8080-exec-3] log4jdbc.log4j2                          : 1. Connection.setAutoCommit(true) returned 
2023-03-17 16:09:26.510  INFO 4331 --- [nio-8080-exec-3] log4jdbc.log4j2                          : 1. Connection.setReadOnly(false) returned 
2023-03-17 16:09:26.510  INFO 4331 --- [nio-8080-exec-3] log4jdbc.log4j2                          : 1. Connection.clearWarnings() returned 
2023-03-17 16:09:26.858  INFO 4331 --- [inWS-ReadThread] c.j.d.listener.JunyssDiscordListener     : get message : ์ค€์ด๋‹˜ ํฌ๋ฃจ๋“ค์˜ ์ •๋ณด๋Š” ์•„๋ž˜์™€ ๊ฐ™์•„์š”!

 



๋ช…๋ น์–ด: ์ฃผ๋‹ˆ์•ผ ํฌ๋ฃจ์ „์ฒด์กฐํšŒ -๊ณ„์ •=u1234567

 

// Spring Boot Console Log

2023-03-17 16:10:49.518  INFO 4331 --- [inWS-ReadThread] c.j.d.listener.JunyssDiscordListener     : get message : ์ฃผ๋‹ˆ์•ผ ํฌ๋ฃจ์ „์ฒด์กฐํšŒ -๊ณ„์ •=u1234567
2023-03-17 16:10:49.523  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. Connection.isValid(5) returned true
2023-03-17 16:10:49.523  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. Connection.setReadOnly(true) returned 
2023-03-17 16:10:49.523  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. Connection.getAutoCommit() returned true
2023-03-17 16:10:49.523  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. Connection.setAutoCommit(false) returned 
2023-03-17 16:10:49.525  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. Connection.getAutoCommit() returned false
2023-03-17 16:10:49.525  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. PreparedStatement.new PreparedStatement returned 
2023-03-17 16:10:49.525  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. Connection.prepareStatement(select *
        from crew

         
             
                    where id like CONCAT('%', ?, '%')) returned net.sf.log4jdbc.sql.jdbcapi.PreparedStatementSpy@4a524e3e
2023-03-17 16:10:49.526  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. PreparedStatement.setString(1, "u1234567") returned 
2023-03-17 16:10:49.526  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. select * from crew where id like CONCAT('%', 'u1234567', '%')  {executed in 0 ms}
2023-03-17 16:10:49.526  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. PreparedStatement.execute() returned true
2023-03-17 16:10:49.526  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.new ResultSet returned 
2023-03-17 16:10:49.526  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. PreparedStatement.getResultSet() returned net.sf.log4jdbc.sql.jdbcapi.ResultSetSpy@a6c930e
2023-03-17 16:10:49.527  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.getMetaData() returned rsMeta4: columns=5
2023-03-17 16:10:49.527  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.getType() returned 1003
2023-03-17 16:10:49.527  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.isClosed() returned false
2023-03-17 16:10:49.527  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.next() returned true
2023-03-17 16:10:49.527  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.getLong(IDX) returned 1
2023-03-17 16:10:49.527  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.getString(ID) returned u12345678
2023-03-17 16:10:49.527  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.getTimestamp(JOIN_DATE) returned 2023-03-17 00:00:00.0
2023-03-17 16:10:49.527  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.getString(NAME) returned ํ™๊ธธ๋™
2023-03-17 16:10:49.527  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.getString(EMAIL) returned hong1234@gmail.com
2023-03-17 16:10:49.528  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.isClosed() returned false
2023-03-17 16:10:49.528  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.next() returned true
2023-03-17 16:10:49.528  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.getLong(IDX) returned 2
2023-03-17 16:10:49.528  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.getString(ID) returned u12345679
2023-03-17 16:10:49.528  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.getTimestamp(JOIN_DATE) returned 2023-03-17 00:00:00.0
2023-03-17 16:10:49.528  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.getString(NAME) returned ๊น€๊ธธ๋™
2023-03-17 16:10:49.528  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.getString(EMAIL) returned kim2393@gmail.com
2023-03-17 16:10:49.528  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.isClosed() returned false
2023-03-17 16:10:49.528  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.next() returned true
2023-03-17 16:10:49.529  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.getLong(IDX) returned 3
2023-03-17 16:10:49.529  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.getString(ID) returned u12345671
2023-03-17 16:10:49.529  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.getTimestamp(JOIN_DATE) returned 2023-03-17 00:00:00.0
2023-03-17 16:10:49.529  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.getString(NAME) returned ํƒ๊ธธ๋™
2023-03-17 16:10:49.529  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.getString(EMAIL) returned tak2934@gmail.com
2023-03-17 16:10:49.529  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.isClosed() returned false
2023-03-17 16:10:49.529  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.next() returned true
2023-03-17 16:10:49.529  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.getLong(IDX) returned 4
2023-03-17 16:10:49.529  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.getString(ID) returned u12345672
2023-03-17 16:10:49.529  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.getTimestamp(JOIN_DATE) returned 2023-03-17 00:00:00.0
2023-03-17 16:10:49.529  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.getString(NAME) returned ์ด๊ธธ๋™
2023-03-17 16:10:49.529  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.getString(EMAIL) returned lee9038@gmail.com
2023-03-17 16:10:49.529  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.isClosed() returned false
2023-03-17 16:10:49.530  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 
|----|----------|----------------------|-----|-------------------|
|idx |id        |join_date             |name |email              |
|----|----------|----------------------|-----|-------------------|
|1   |u12345678 |2023-03-17 00:00:00.0 |ํ™๊ธธ๋™  |hong1234@gmail.com |
|2   |u12345679 |2023-03-17 00:00:00.0 |๊น€๊ธธ๋™  |kim2393@gmail.com  |
|3   |u12345671 |2023-03-17 00:00:00.0 |ํƒ๊ธธ๋™  |tak2934@gmail.com  |
|4   |u12345672 |2023-03-17 00:00:00.0 |์ด๊ธธ๋™  |lee9038@gmail.com  |
|----|----------|----------------------|-----|-------------------|

2023-03-17 16:10:49.530  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.next() returned false
2023-03-17 16:10:49.530  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. ResultSet.close() returned void
2023-03-17 16:10:49.530  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. Connection.getMetaData() returned dbMeta3: conn0: url=jdbc:h2:~/giggal-discord-bot?serverTimezone=UTC&characterEncoding=UTF-8 user=SA
2023-03-17 16:10:49.530  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. PreparedStatement.close() returned 
2023-03-17 16:10:49.531  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. Connection.commit() returned 
2023-03-17 16:10:49.531  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. Connection.setAutoCommit(true) returned 
2023-03-17 16:10:49.531  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. Connection.setReadOnly(false) returned 
2023-03-17 16:10:49.531  INFO 4331 --- [nio-8080-exec-5] log4jdbc.log4j2                          : 1. Connection.clearWarnings() returned 
2023-03-17 16:10:49.856  INFO 4331 --- [inWS-ReadThread] c.j.d.listener.JunyssDiscordListener     : get message : ์ค€์ด๋‹˜ ํฌ๋ฃจ๋“ค์˜ ์ •๋ณด๋Š” ์•„๋ž˜์™€ ๊ฐ™์•„์š”!

 

๋ช…๋ น์–ด : ์ฃผ๋‹ˆ์•ผ ํฌ๋ฃจ์ „์ฒด์กฐํšŒ -๋‚ ์งœ=2023.03.10~2023.03.14

 

// Spring Boot Console Log

2023-03-17 16:11:58.540  INFO 4331 --- [inWS-ReadThread] c.j.d.listener.JunyssDiscordListener     : get message : ์ฃผ๋‹ˆ์•ผ ํฌ๋ฃจ์ „์ฒด์กฐํšŒ -๋‚ ์งœ=2023.03.10~2023.03.14
2023-03-17 16:11:58.555  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. Connection.isValid(5) returned true
2023-03-17 16:11:58.555  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. Connection.setReadOnly(true) returned 
2023-03-17 16:11:58.555  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. Connection.getAutoCommit() returned true
2023-03-17 16:11:58.555  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. Connection.setAutoCommit(false) returned 
2023-03-17 16:11:58.556  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. Connection.getAutoCommit() returned false
2023-03-17 16:11:58.561  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. PreparedStatement.new PreparedStatement returned 
2023-03-17 16:11:58.562  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. Connection.prepareStatement(select *
        from crew

         

         
             
                    where join_date BETWEEN PARSEDATETIME(?, 'yyyy.MM.dd') AND PARSEDATETIME(?, 'yyyy.MM.dd')) returned net.sf.log4jdbc.sql.jdbcapi.PreparedStatementSpy@47fd043d
2023-03-17 16:11:58.562  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. PreparedStatement.setString(1, "2023.03.10") returned 
2023-03-17 16:11:58.562  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. PreparedStatement.setString(2, "2023.03.14") returned 
2023-03-17 16:11:58.563  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. select * from crew where join_date BETWEEN PARSEDATETIME('2023.03.10', 'yyyy.MM.dd') AND PARSEDATETIME('2023.03.14', 
'yyyy.MM.dd')  {executed in 1 ms}
2023-03-17 16:11:58.563  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. PreparedStatement.execute() returned true
2023-03-17 16:11:58.563  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. ResultSet.new ResultSet returned 
2023-03-17 16:11:58.563  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. PreparedStatement.getResultSet() returned net.sf.log4jdbc.sql.jdbcapi.ResultSetSpy@2a76a14f
2023-03-17 16:11:58.563  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. ResultSet.getMetaData() returned rsMeta6: columns=5
2023-03-17 16:11:58.563  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. ResultSet.getType() returned 1003
2023-03-17 16:11:58.563  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. ResultSet.isClosed() returned false
2023-03-17 16:11:58.563  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. ResultSet.next() returned true
2023-03-17 16:11:58.563  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. ResultSet.getLong(IDX) returned 5
2023-03-17 16:11:58.563  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. ResultSet.getString(ID) returned u12345680
2023-03-17 16:11:58.563  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. ResultSet.getTimestamp(JOIN_DATE) returned 2023-03-10 00:00:00.0
2023-03-17 16:11:58.563  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. ResultSet.getString(NAME) returned ์ตœ๊ธธ๋™
2023-03-17 16:11:58.563  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. ResultSet.getString(EMAIL) returned kim2393@gmail.com
2023-03-17 16:11:58.564  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. ResultSet.isClosed() returned false
2023-03-17 16:11:58.564  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. ResultSet.next() returned true
2023-03-17 16:11:58.564  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. ResultSet.getLong(IDX) returned 6
2023-03-17 16:11:58.564  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. ResultSet.getString(ID) returned u12345681
2023-03-17 16:11:58.564  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. ResultSet.getTimestamp(JOIN_DATE) returned 2023-03-11 00:00:00.0
2023-03-17 16:11:58.564  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. ResultSet.getString(NAME) returned ๋ฐ•๊ธธ๋™
2023-03-17 16:11:58.564  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. ResultSet.getString(EMAIL) returned tak2934@gmail.com
2023-03-17 16:11:58.564  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. ResultSet.isClosed() returned false
2023-03-17 16:11:58.564  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. ResultSet.next() returned true
2023-03-17 16:11:58.564  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. ResultSet.getLong(IDX) returned 7
2023-03-17 16:11:58.564  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. ResultSet.getString(ID) returned u12345682
2023-03-17 16:11:58.564  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. ResultSet.getTimestamp(JOIN_DATE) returned 2023-03-12 00:00:00.0
2023-03-17 16:11:58.564  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. ResultSet.getString(NAME) returned ์œ ๊ธธ๋™
2023-03-17 16:11:58.564  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. ResultSet.getString(EMAIL) returned lee9038@gmail.com
2023-03-17 16:11:58.564  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. ResultSet.isClosed() returned false
2023-03-17 16:11:58.564  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 
|----|----------|----------------------|-----|------------------|
|idx |id        |join_date             |name |email             |
|----|----------|----------------------|-----|------------------|
|5   |u12345680 |2023-03-10 00:00:00.0 |์ตœ๊ธธ๋™  |kim2393@gmail.com |
|6   |u12345681 |2023-03-11 00:00:00.0 |๋ฐ•๊ธธ๋™  |tak2934@gmail.com |
|7   |u12345682 |2023-03-12 00:00:00.0 |์œ ๊ธธ๋™  |lee9038@gmail.com |
|----|----------|----------------------|-----|------------------|

2023-03-17 16:11:58.564  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. ResultSet.next() returned false
2023-03-17 16:11:58.564  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. ResultSet.close() returned void
2023-03-17 16:11:58.564  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. Connection.getMetaData() returned dbMeta4: conn0: url=jdbc:h2:~/giggal-discord-bot?serverTimezone=UTC&characterEncoding=UTF-8 user=SA
2023-03-17 16:11:58.565  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. PreparedStatement.close() returned 
2023-03-17 16:11:58.565  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. Connection.commit() returned 
2023-03-17 16:11:58.565  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. Connection.setAutoCommit(true) returned 
2023-03-17 16:11:58.565  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. Connection.setReadOnly(false) returned 
2023-03-17 16:11:58.565  INFO 4331 --- [nio-8080-exec-7] log4jdbc.log4j2                          : 1. Connection.clearWarnings() returned 
2023-03-17 16:11:58.947  INFO 4331 --- [inWS-ReadThread] c.j.d.listener.JunyssDiscordListener     : get message : ์ค€์ด๋‹˜ ํฌ๋ฃจ๋“ค์˜ ์ •๋ณด๋Š” ์•„๋ž˜์™€ ๊ฐ™์•„์š”!

 

๋ช…๋ น์–ด : ์ฃผ๋‹ˆ์•ผ ํฌ๋ฃจ์ „์ฒด์กฐํšŒ -๊ณ„์ •=u1234567 -๋‚ ์งœ=2023.03.10~2023.03.17

 

// Spring Boot Console Log

2023-03-17 16:13:57.018  INFO 4331 --- [inWS-ReadThread] c.j.d.listener.JunyssDiscordListener     : get message : ์ฃผ๋‹ˆ์•ผ ํฌ๋ฃจ์ „์ฒด์กฐํšŒ -๊ณ„์ •=u1234567 -๋‚ ์งœ=2023.03.10~2023.03.17
2023-03-17 16:13:57.023  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. Connection.isValid(5) returned true
2023-03-17 16:13:57.023  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. Connection.setReadOnly(true) returned 
2023-03-17 16:13:57.023  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. Connection.getAutoCommit() returned true
2023-03-17 16:13:57.023  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. Connection.setAutoCommit(false) returned 
2023-03-17 16:13:57.024  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. Connection.getAutoCommit() returned false
2023-03-17 16:13:57.024  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. PreparedStatement.new PreparedStatement returned 
2023-03-17 16:13:57.024  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. Connection.prepareStatement(select *
        from crew

         
             
                    where id like CONCAT('%', ?, '%')
                 

             
                    and join_date BETWEEN PARSEDATETIME(?, 'yyyy.MM.dd') AND PARSEDATETIME(?, 'yyyy.MM.dd')) returned net.sf.log4jdbc.sql.jdbcapi.PreparedStatementSpy@4111448b
2023-03-17 16:13:57.025  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. PreparedStatement.setString(1, "u1234567") returned 
2023-03-17 16:13:57.025  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. PreparedStatement.setString(2, "2023.03.10") returned 
2023-03-17 16:13:57.025  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. PreparedStatement.setString(3, "2023.03.17") returned 
2023-03-17 16:13:57.026  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. select * from crew where id like CONCAT('%', 'u1234567', '%') and join_date BETWEEN PARSEDATETIME('2023.03.10', 
'yyyy.MM.dd') AND PARSEDATETIME('2023.03.17', 'yyyy.MM.dd')  {executed in 1 ms}
2023-03-17 16:13:57.027  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. PreparedStatement.execute() returned true
2023-03-17 16:13:57.027  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.new ResultSet returned 
2023-03-17 16:13:57.027  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. PreparedStatement.getResultSet() returned net.sf.log4jdbc.sql.jdbcapi.ResultSetSpy@57fba032
2023-03-17 16:13:57.027  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getMetaData() returned rsMeta12: columns=5
2023-03-17 16:13:57.027  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getType() returned 1003
2023-03-17 16:13:57.027  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.isClosed() returned false
2023-03-17 16:13:57.027  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.next() returned true
2023-03-17 16:13:57.028  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getLong(IDX) returned 1
2023-03-17 16:13:57.029  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getString(ID) returned u12345678
2023-03-17 16:13:57.032  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getTimestamp(JOIN_DATE) returned 2023-03-17 00:00:00.0
2023-03-17 16:13:57.032  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getString(NAME) returned ํ™๊ธธ๋™
2023-03-17 16:13:57.033  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getString(EMAIL) returned hong1234@gmail.com
2023-03-17 16:13:57.033  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.isClosed() returned false
2023-03-17 16:13:57.033  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.next() returned true
2023-03-17 16:13:57.033  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getLong(IDX) returned 2
2023-03-17 16:13:57.033  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getString(ID) returned u12345679
2023-03-17 16:13:57.033  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getTimestamp(JOIN_DATE) returned 2023-03-17 00:00:00.0
2023-03-17 16:13:57.033  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getString(NAME) returned ๊น€๊ธธ๋™
2023-03-17 16:13:57.033  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getString(EMAIL) returned kim2393@gmail.com
2023-03-17 16:13:57.034  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.isClosed() returned false
2023-03-17 16:13:57.034  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.next() returned true
2023-03-17 16:13:57.034  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getLong(IDX) returned 3
2023-03-17 16:13:57.034  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getString(ID) returned u12345671
2023-03-17 16:13:57.034  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getTimestamp(JOIN_DATE) returned 2023-03-17 00:00:00.0
2023-03-17 16:13:57.034  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getString(NAME) returned ํƒ๊ธธ๋™
2023-03-17 16:13:57.034  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getString(EMAIL) returned tak2934@gmail.com
2023-03-17 16:13:57.034  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.isClosed() returned false
2023-03-17 16:13:57.034  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.next() returned true
2023-03-17 16:13:57.034  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getLong(IDX) returned 4
2023-03-17 16:13:57.034  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getString(ID) returned u12345672
2023-03-17 16:13:57.034  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getTimestamp(JOIN_DATE) returned 2023-03-17 00:00:00.0
2023-03-17 16:13:57.035  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getString(NAME) returned ์ด๊ธธ๋™
2023-03-17 16:13:57.035  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.getString(EMAIL) returned lee9038@gmail.com
2023-03-17 16:13:57.035  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.isClosed() returned false
2023-03-17 16:13:57.035  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 
|----|----------|----------------------|-----|-------------------|
|idx |id        |join_date             |name |email              |
|----|----------|----------------------|-----|-------------------|
|1   |u12345678 |2023-03-17 00:00:00.0 |ํ™๊ธธ๋™  |hong1234@gmail.com |
|2   |u12345679 |2023-03-17 00:00:00.0 |๊น€๊ธธ๋™  |kim2393@gmail.com  |
|3   |u12345671 |2023-03-17 00:00:00.0 |ํƒ๊ธธ๋™  |tak2934@gmail.com  |
|4   |u12345672 |2023-03-17 00:00:00.0 |์ด๊ธธ๋™  |lee9038@gmail.com  |
|----|----------|----------------------|-----|-------------------|

2023-03-17 16:13:57.035  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.next() returned false
2023-03-17 16:13:57.035  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. ResultSet.close() returned void
2023-03-17 16:13:57.036  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. Connection.getMetaData() returned dbMeta7: conn0: url=jdbc:h2:~/giggal-discord-bot?serverTimezone=UTC&characterEncoding=UTF-8 user=SA
2023-03-17 16:13:57.036  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. PreparedStatement.close() returned 
2023-03-17 16:13:57.036  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. Connection.commit() returned 
2023-03-17 16:13:57.036  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. Connection.setAutoCommit(true) returned 
2023-03-17 16:13:57.036  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. Connection.setReadOnly(false) returned 
2023-03-17 16:13:57.036  INFO 4331 --- [nio-8080-exec-1] log4jdbc.log4j2                          : 1. Connection.clearWarnings() returned 
2023-03-17 16:13:57.430  INFO 4331 --- [inWS-ReadThread] c.j.d.listener.JunyssDiscordListener     : get message : ์ค€์ด๋‹˜ ํฌ๋ฃจ๋“ค์˜ ์ •๋ณด๋Š” ์•„๋ž˜์™€ ๊ฐ™์•„์š”!



๋ช…๋ น์–ด: ์ฃผ๋‹ˆ์•ผ ๋‚˜์ฒœ์žฌ์•ผ?



์ด๋ ‡๊ฒŒ ๋””์Šค์ฝ”๋“œ ๋ด‡์ด ์›ํ•˜๋Š”๋Œ€๋กœ ๋™์ž‘ํ•˜๋Š” ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.

์ด๋ฒˆ์—๋„ ์ •๋ง ์žฌ๋ฐŒ๊ฒŒ ๋  ๊ฑฐ ๊ฐ™์€๋ฐ? ๋ผ๋Š” ์˜๋ฌธ์„ ํ’€์—ˆ์–ด์š”!

๋‹ค์Œ์—๋„ ์ข‹์€ ๋‚ด์šฉ์œผ๋กœ ์ž‘์„ฑํ•ด ๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค!

๋””์Šค์ฝ”๋“œ ๋ด‡์„ ์ด์šฉํ•˜์—ฌ ๋ณด๋‹ค ํŽธ๋ฆฌํ•œ ์—…๋ฌด ํ•˜์‹œ๊ธฐ ๋ฐ”๋ž„๊ฒŒ์š”!





 

์ „์ž์ •๋ถ€ ํ‘œ์ค€ ํ”„๋ ˆ์ž„์›Œํฌ์˜ ์–‘๋Œ€ ํ•ต์‹ฌ ๊ธฐ์ˆ  ์„ธํŠธ : ์Šคํ”„๋ง + ๋งˆ์ด๋ฐ”ํ‹ฐ์Šค

COUPANG

www.coupang.com

"์ด ํฌ์ŠคํŒ…์€ ์ฟ ํŒก ํŒŒํŠธ๋„ˆ์Šค ํ™œ๋™์˜ ์ผํ™˜์œผ๋กœ, ์ด์— ๋”ฐ๋ฅธ ์ผ์ •์•ก์˜ ์ˆ˜์ˆ˜๋ฃŒ๋ฅผ ์ œ๊ณต๋ฐ›์Šต๋‹ˆ๋‹ค."

 

 

 

 

 

 

 

728x90
๋ฐ˜์‘ํ˜•