-
Notifications
You must be signed in to change notification settings - Fork 0
/
commands.go
162 lines (159 loc) · 4.11 KB
/
commands.go
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
package main
import (
"github.com/disgoorg/disgo/bot"
"github.com/disgoorg/disgo/discord"
"github.com/disgoorg/disgolink/v3/lavalink"
"github.com/disgoorg/json"
"github.com/disgoorg/log"
)
var commands = []discord.ApplicationCommandCreate{
discord.SlashCommandCreate{
Name: "setup",
Description: "Setup dedicated music player channel",
DefaultMemberPermissions: json.NewNullablePtr(discord.PermissionAdministrator),
},
discord.SlashCommandCreate{
Name: "play",
Description: "Queue tracks",
Options: []discord.ApplicationCommandOption{
discord.ApplicationCommandOptionString{
Name: "query",
Description: "Search query or links (Youtube, Spotify, etc.)",
Required: true,
},
},
},
discord.SlashCommandCreate{
Name: "pause",
Description: "Pauses the current song",
},
discord.SlashCommandCreate{
Name: "now-playing",
Description: "Shows the current playing song",
},
discord.SlashCommandCreate{
Name: "stop",
Description: "Stops the current song and stops the player",
},
discord.SlashCommandCreate{
Name: "disconnect",
Description: "Disconnects the player",
},
discord.SlashCommandCreate{
Name: "queue",
Description: "Show queue",
},
discord.SlashCommandCreate{
Name: "clear-queue",
Description: "Clear queue",
},
discord.SlashCommandCreate{
Name: "repeat",
Description: "Select repeat type",
Options: []discord.ApplicationCommandOption{
discord.ApplicationCommandOptionString{
Name: "mode",
Description: "Repeat mode",
Required: true,
Choices: []discord.ApplicationCommandOptionChoiceString{
{
Name: QueueTypeNoRepeat.String(),
Value: string(QueueTypeNoRepeat),
},
{
Name: QueueTypeRepeatTrack.String(),
Value: string(QueueTypeRepeatTrack),
},
{
Name: QueueTypeRepeatQueue.String(),
Value: string(QueueTypeRepeatQueue),
},
},
},
},
},
discord.SlashCommandCreate{
Name: "remove",
Description: "Remove item from queue",
Options: []discord.ApplicationCommandOption{
discord.ApplicationCommandOptionInt{
Name: "id",
Description: "ID of the track in queue",
Required: true,
},
},
},
discord.SlashCommandCreate{
Name: "skip",
Description: "Skips the current song",
Options: []discord.ApplicationCommandOption{
discord.ApplicationCommandOptionInt{
Name: "amount",
Description: "The amount of songs to skip",
Required: false,
},
},
},
discord.SlashCommandCreate{
Name: "volume",
Description: "Sets the volume of the player",
Options: []discord.ApplicationCommandOption{
discord.ApplicationCommandOptionInt{
Name: "level",
Description: "The volume level to set",
Required: true,
MaxValue: json.Ptr(100),
MinValue: json.Ptr(0),
},
},
},
discord.SlashCommandCreate{
Name: "seek",
Description: "Seeks to a specific position in the current song",
Options: []discord.ApplicationCommandOption{
discord.ApplicationCommandOptionInt{
Name: "position",
Description: "The position to seek to",
Required: true,
},
discord.ApplicationCommandOptionInt{
Name: "unit",
Description: "The unit of the position",
Required: false,
Choices: []discord.ApplicationCommandOptionChoiceInt{
{
Name: "Milliseconds",
Value: int(lavalink.Millisecond),
},
{
Name: "Seconds",
Value: int(lavalink.Second),
},
{
Name: "Minutes",
Value: int(lavalink.Minute),
},
{
Name: "Hours",
Value: int(lavalink.Hour),
},
},
},
},
},
discord.SlashCommandCreate{
Name: "shuffle",
Description: "Shuffles the current queue",
},
}
func registerCommands(client bot.Client) {
if Debug {
if _, err := client.Rest().SetGuildCommands(client.ApplicationID(), GuildId, commands); err != nil {
log.Warn(err)
}
} else {
if _, err := client.Rest().SetGlobalCommands(client.ApplicationID(), commands); err != nil {
log.Error(err)
}
}
}