Repository navigation
Expand file tree
/
Copy pathcommands.ts
More file actions
316 lines (282 loc) · 10.1 KB
/
Copy pathcommands.ts
File metadata and controls
316 lines (282 loc) · 10.1 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
import {
REST,
Routes,
SlashCommandBuilder,
RESTPostAPIApplicationCommandsJSONBody,
} from "discord.js";
const commands: RESTPostAPIApplicationCommandsJSONBody[] = [
new SlashCommandBuilder()
.setName("밥")
.setDescription("현재 시간대 급식을 확인합니다")
.addStringOption((opt) =>
opt
.setName("설정")
.setDescription("급식 기능 on/off (관리자 전용)")
.setRequired(false)
.addChoices({ name: "on", value: "on" }, { name: "off", value: "off" }),
)
.toJSON(),
new SlashCommandBuilder()
.setName("급식")
.setDescription("특정 끼니/날짜의 급식을 확인합니다")
.addStringOption((opt) =>
opt
.setName("끼니")
.setDescription("조회할 끼니")
.setRequired(true)
.addChoices(
{ name: "아침", value: "아침" },
{ name: "점심", value: "점심" },
{ name: "저녁", value: "저녁" },
),
)
.addStringOption((opt) =>
opt
.setName("날짜")
.setDescription("오늘, 내일 또는 모레 (기본: 오늘)")
.setRequired(false)
.addChoices(
{ name: "오늘", value: "오늘" },
{ name: "내일", value: "내일" },
{ name: "모레", value: "모레" },
),
)
.addStringOption((opt) =>
opt
.setName("특정날짜")
.setDescription("조회할 날짜 (예: 10/5, 1005, 2026-10-05) — 입력 시 날짜 선택보다 우선")
.setRequired(false)
.setMaxLength(10),
)
.toJSON(),
new SlashCommandBuilder()
.setName("시간표")
.setDescription("시간표를 확인합니다")
.addStringOption((opt) =>
opt
.setName("학년반")
.setDescription("조회할 학년-반 (예: 2-3). 없으면 내 역할 사용")
.setRequired(false),
)
.toJSON(),
new SlashCommandBuilder()
.setName("학사일정")
.setDescription("학사일정을 확인합니다")
.addIntegerOption((opt) =>
opt
.setName("월")
.setDescription("조회할 월 (1~12). 없으면 이번 달")
.setRequired(false)
.setMinValue(1)
.setMaxValue(12),
)
.toJSON(),
new SlashCommandBuilder()
.setName("날씨")
.setDescription("현재 날씨 및 미세먼지를 확인합니다")
.toJSON(),
new SlashCommandBuilder()
.setName("상태")
.setDescription("봇 업타임, 핑, 메모리, API 상태를 확인합니다")
.toJSON(),
new SlashCommandBuilder()
.setName("출석")
.setDescription("매일 출석 체크 (150,000원 지급)")
.toJSON(),
new SlashCommandBuilder()
.setName("일")
.setDescription("10,000~30,000원 벌기 (1분 쿨다운)")
.toJSON(),
new SlashCommandBuilder().setName("잔액").setDescription("내 잔액을 확인합니다").toJSON(),
new SlashCommandBuilder()
.setName("지원금")
.setDescription("잔액 0원일 때 100,000원 지원금 신청")
.toJSON(),
new SlashCommandBuilder().setName("랭킹").setDescription("서버 잔액 TOP 10 랭킹").toJSON(),
new SlashCommandBuilder()
.setName("송금")
.setDescription("다른 유저에게 송금합니다")
.addUserOption((opt) => opt.setName("대상").setDescription("송금할 대상").setRequired(true))
.addStringOption((opt) =>
opt.setName("금액").setDescription("송금할 금액 (숫자, 올인, 반)").setRequired(true),
)
.toJSON(),
new SlashCommandBuilder()
.setName("도박")
.setDescription("도박 기능 활성화/비활성화 (관리자 전용) 또는 상태 확인")
.addStringOption((opt) =>
opt
.setName("설정")
.setDescription("on 또는 off")
.setRequired(false)
.addChoices({ name: "on", value: "on" }, { name: "off", value: "off" }),
)
.toJSON(),
new SlashCommandBuilder()
.setName("코인")
.setDescription("코인플립 게임")
.addStringOption((opt) =>
opt.setName("금액").setDescription("베팅 금액 (숫자, 올인, 반)").setRequired(true),
)
.toJSON(),
new SlashCommandBuilder()
.setName("블랙잭")
.setDescription("블랙잭 게임")
.addStringOption((opt) =>
opt.setName("금액").setDescription("베팅 금액 (숫자, 올인, 반)").setRequired(true),
)
.toJSON(),
new SlashCommandBuilder()
.setName("바카라")
.setDescription("바카라 게임")
.addStringOption((opt) =>
opt.setName("금액").setDescription("베팅 금액 (숫자, 올인, 반)").setRequired(true),
)
.toJSON(),
new SlashCommandBuilder()
.setName("룰렛")
.setDescription("룰렛 게임")
.addStringOption((opt) =>
opt.setName("금액").setDescription("베팅 금액 (숫자, 올인, 반)").setRequired(true),
)
.toJSON(),
new SlashCommandBuilder()
.setName("play")
.setDescription("유튜브에서 음악을 검색하거나 URL로 재생합니다")
.addStringOption((opt) =>
opt.setName("검색어").setDescription("검색할 제목 또는 유튜브 URL").setRequired(true),
)
.toJSON(),
new SlashCommandBuilder().setName("스킵").setDescription("현재 곡을 건너뜁니다").toJSON(),
new SlashCommandBuilder()
.setName("정지")
.setDescription("재생을 정지하고 음성채널에서 나갑니다")
.toJSON(),
new SlashCommandBuilder().setName("일시정지").setDescription("재생을 일시정지합니다").toJSON(),
new SlashCommandBuilder().setName("재개").setDescription("일시정지된 재생을 재개합니다").toJSON(),
new SlashCommandBuilder().setName("큐").setDescription("재생 대기열을 확인합니다").toJSON(),
new SlashCommandBuilder()
.setName("노추")
.setDescription("Spotify 랜덤 노래 추천")
.addStringOption((opt) =>
opt
.setName("장르")
.setDescription("장르 선택 (없으면 랜덤)")
.setRequired(false)
.addChoices(
{ name: "케이팝", value: "케이팝" },
{ name: "팝", value: "팝" },
{ name: "제이팝", value: "제이팝" },
{ name: "밴드", value: "밴드" },
{ name: "힙합", value: "힙합" },
{ name: "알앤비", value: "알앤비" },
{ name: "인디", value: "인디" },
),
)
.toJSON(),
new SlashCommandBuilder()
.setName("가수")
.setDescription("Spotify에서 노래/아티스트를 검색합니다")
.addStringOption((opt) =>
opt.setName("검색어").setDescription("검색할 노래 또는 아티스트").setRequired(true),
)
.toJSON(),
new SlashCommandBuilder()
.setName("보내기")
.setDescription("정기 알림을 설정합니다")
.addChannelOption((opt) =>
opt.setName("채널").setDescription("메시지를 보낼 채널").setRequired(true),
)
.addStringOption((opt) =>
opt.setName("메시지").setDescription("보낼 메시지 내용").setRequired(true),
)
.addStringOption((opt) =>
opt.setName("시간").setDescription("보낼 시간 (HH:MM 형식, 예: 08:30)").setRequired(true),
)
.addStringOption((opt) =>
opt
.setName("반복")
.setDescription("반복 유형")
.setRequired(true)
.addChoices(
{ name: "매일", value: "daily" },
{ name: "평일만 (월~금)", value: "weekdays" },
{ name: "주말만 (토~일)", value: "weekends" },
{ name: "매주 특정 요일", value: "weekly" },
{ name: "매월 특정 날짜", value: "monthly" },
{ name: "특정 날짜 1회", value: "once" },
),
)
.addStringOption((opt) =>
opt
.setName("요일")
.setDescription("반복:매주 선택 시 요일 (예: 월,금 또는 1,5)")
.setRequired(false),
)
.addStringOption((opt) =>
opt
.setName("날짜")
.setDescription("반복:매월 → 날짜(1~31) | 반복:1회 → 날짜(YYYY-MM-DD)")
.setRequired(false),
)
.toJSON(),
new SlashCommandBuilder()
.setName("알림목록")
.setDescription("등록된 알림 목록을 확인합니다")
.toJSON(),
new SlashCommandBuilder()
.setName("알림삭제")
.setDescription("등록된 알림을 삭제합니다")
.addIntegerOption((opt) =>
opt.setName("번호").setDescription("삭제할 알림 번호").setRequired(true),
)
.toJSON(),
new SlashCommandBuilder()
.setName("알림삭제전체")
.setDescription("이 서버의 알림을 전체 삭제합니다")
.toJSON(),
new SlashCommandBuilder()
.setName("gif등록")
.setDescription("키워드에 GIF를 등록합니다")
.addStringOption((opt) =>
opt
.setName("키워드")
.setDescription("GIF를 부를 키워드 (예: @충동적 구매@)")
.setRequired(true),
)
.addAttachmentOption((opt) =>
opt.setName("파일").setDescription("등록할 GIF 파일").setRequired(false),
)
.addStringOption((opt) =>
opt
.setName("주소")
.setDescription("GIF 이미지 직링크 (파일을 첨부하지 않을 때)")
.setRequired(false),
)
.toJSON(),
new SlashCommandBuilder()
.setName("gif목록")
.setDescription("등록된 GIF 키워드 목록을 확인합니다")
.toJSON(),
new SlashCommandBuilder()
.setName("gif삭제")
.setDescription("등록된 GIF 키워드를 삭제합니다")
.addStringOption((opt) =>
opt.setName("키워드").setDescription("삭제할 키워드").setRequired(true),
)
.toJSON(),
new SlashCommandBuilder()
.setName("명령어")
.setDescription("사용 가능한 명령어 목록을 확인합니다")
.toJSON(),
];
export async function registerCommands(clientId: string, guildId?: string): Promise<void> {
const token = process.env.DISCORD_TOKEN;
if (!token) throw new Error("DISCORD_TOKEN이 없습니다.");
const rest = new REST().setToken(token);
const route = guildId
? Routes.applicationGuildCommands(clientId, guildId)
: Routes.applicationCommands(clientId);
await rest.put(route, { body: commands });
console.log(`[Slash] ${commands.length}개 커맨드 등록 완료`);
}