-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcommands.js
170 lines (160 loc) · 4.68 KB
/
commands.js
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
/* eslint-disable no-console */
const { REST, Routes, SlashCommandBuilder } = require('discord.js');
const playCommand = new SlashCommandBuilder()
.setName('play')
.setDescription('plays a song')
.addSubcommand((subcommand) =>
subcommand
.setName('lucky')
.setDescription('searches for a song and plays the first result')
.addStringOption((option) =>
option
.setName('query')
.setDescription('song title and/or artist')
.setRequired(true)
)
)
.addSubcommand((subcommand) =>
subcommand
.setName('song')
.setDescription('plays a song from the library')
.addStringOption((option) =>
option.setName('title').setDescription('song title').setRequired(true)
)
)
.addSubcommand((subcommand) =>
subcommand
.setName('playlist')
.setDescription('plays a playlist')
.addStringOption((option) =>
option
.setName('name')
.setDescription('name of the playlist')
.setRequired(true)
)
);
const searchCommand = new SlashCommandBuilder()
.setName('search')
.setDescription('Searches for your song and gives the list of results')
.addStringOption((option) =>
option
.setName('query')
.setDescription('song title and/or artist')
.setRequired(true)
);
const playlistCommand = new SlashCommandBuilder()
.setName('playlist')
.setDescription('interact with saved playlists')
.addSubcommand((subcommand) =>
subcommand
.setName('create')
.setDescription('creates a new playlist')
.addStringOption((option) =>
option
.setName('name')
.setDescription('the name of your new playlist')
.setRequired(true)
)
)
.addSubcommand((subcommand) =>
subcommand
.setName('delete')
.setDescription('deletes a playlist by name')
.addStringOption((option) =>
option
.setName('name')
.setDescription('name of the playlist you want deleted')
.setRequired(true)
)
)
.addSubcommand((subcommand) =>
subcommand
.setName('remove-song')
.setDescription('remove a song from a playlist by title')
.addStringOption((option) =>
option
.setName('playlist_name')
.setDescription('name of playlist')
.setRequired(true)
)
.addStringOption((option) =>
option
.setName('song_title')
.setDescription('title of song to be removed')
.setRequired(true)
)
)
.addSubcommand((subcommand) =>
subcommand
.setName('view')
.setDescription('view a saved playlist')
.addStringOption((option) =>
option
.setName('name')
.setDescription('name of playlist to be viewed')
.setRequired(true)
)
)
.addSubcommand((subcommand) =>
subcommand
.setName('view-all')
.setDescription('view all playlists'));
const queueCommand = new SlashCommandBuilder()
.setName('queue')
.setDescription('interact with the queue')
.addSubcommand((subcommand) =>
subcommand.setName('clear').setDescription('clear the queue')
)
.addSubcommand((subcommand) =>
subcommand.setName('pause').setDescription('pauses current song')
)
.addSubcommand((subcommand) =>
subcommand.setName('play').setDescription('resumes playback')
)
.addSubcommand((subcommand) =>
subcommand.setName('skip').setDescription('skips the current song')
)
.addSubcommand((subcommand) =>
subcommand.setName('shuffle').setDescription('shuffles queue')
)
.addSubcommand((subcommand) =>
subcommand.setName('view').setDescription('displays the current queue')
);
const libraryCommand = new SlashCommandBuilder()
.setName('library')
.setDescription('interact with your saved songs')
.addSubcommand((subcommand) =>
subcommand
.setName('search')
.setDescription('search the library for a song')
.addStringOption((option) =>
option
.setName('query')
.setDescription('song title and/or artist')
.setRequired(true)
)
)
.addSubcommand((subcommand) =>
subcommand.setName('view').setDescription('view all songs in library')
);
const commands = [
playCommand,
searchCommand,
playlistCommand,
queueCommand,
libraryCommand,
];
const rest = new REST({ version: '10' }).setToken(
process.env.DISCORD_BOT_TOKEN
);
(async () => {
try {
console.log('Started refreshing application (/) commands.');
await rest.put(Routes.applicationCommands(process.env.CLIENT_ID), {
body: commands,
});
console.log('Successfully reloaded application (/) commands.');
} catch (error) {
console.error(error);
}
})();