-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-commands.js
More file actions
162 lines (155 loc) · 5.65 KB
/
Copy pathdeploy-commands.js
File metadata and controls
162 lines (155 loc) · 5.65 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
// ════════════════════════════════════════════════════════════════
// 🤖 VibeBot — Slash Command Registration
// ════════════════════════════════════════════════════════════════
// Run this ONCE to register slash commands with Discord:
// node deploy-commands.js
// ════════════════════════════════════════════════════════════════
require("dotenv").config();
const { REST, Routes, SlashCommandBuilder, PermissionFlagsBits } = require("discord.js");
const commands = [
// ── Announcements ────────────────────────────────
new SlashCommandBuilder()
.setName("announce")
.setDescription("📢 Post a fancy announcement embed")
.addStringOption((o) =>
o.setName("title").setDescription("Announcement title").setRequired(true)
)
.addStringOption((o) =>
o
.setName("message")
.setDescription("Announcement body text")
.setRequired(true)
)
.addChannelOption((o) =>
o
.setName("channel")
.setDescription("Channel to post in (defaults to current)")
.setRequired(false)
)
.addStringOption((o) =>
o
.setName("color")
.setDescription("Embed color (e.g. #7c3aed)")
.setRequired(false)
)
.addStringOption((o) =>
o
.setName("image")
.setDescription("Image URL to attach")
.setRequired(false)
)
.setDefaultMemberPermissions(0),
// ── Schedule Announcement ────────────────────────
new SlashCommandBuilder()
.setName("schedule")
.setDescription("⏰ Schedule an announcement (in minutes from now)")
.addStringOption((o) =>
o.setName("title").setDescription("Announcement title").setRequired(true)
)
.addStringOption((o) =>
o.setName("message").setDescription("Announcement body").setRequired(true)
)
.addIntegerOption((o) =>
o
.setName("minutes")
.setDescription("Minutes from now to post")
.setRequired(true)
)
.addChannelOption((o) =>
o
.setName("channel")
.setDescription("Channel to post in")
.setRequired(false)
)
.setDefaultMemberPermissions(0),
// ── Proxy Post (Send as Bot) ──────────────────────
new SlashCommandBuilder()
.setName("post")
.setDescription("✉️ Post a message as the bot in a styled category")
.addStringOption((o) =>
o
.setName("category")
.setDescription("Message category")
.setRequired(true)
.addChoices(
{ name: "📢 Announcement", value: "announcement" },
{ name: "💡 Insight", value: "insight" },
{ name: "ℹ️ Info", value: "info" },
{ name: "🔔 Reminder", value: "reminder" }
)
)
.addStringOption((o) =>
o
.setName("message")
.setDescription("The message content to post")
.setRequired(true)
)
.addStringOption((o) =>
o
.setName("title")
.setDescription("Optional title/heading")
.setRequired(false)
)
.addChannelOption((o) =>
o
.setName("channel")
.setDescription("Channel to post in (defaults to current)")
.setRequired(false)
)
.addBooleanOption((o) =>
o
.setName("ping_everyone")
.setDescription("Ping @everyone with this message?")
.setRequired(false)
)
.setDefaultMemberPermissions(0),
// ── Deadline Reminder ─────────────────────────────
new SlashCommandBuilder()
.setName("remind")
.setDescription("⏰ Schedule a deadline reminder that pings @everyone")
.addStringOption((o) =>
o
.setName("title")
.setDescription("What's the reminder about?")
.setRequired(true)
)
.addStringOption((o) =>
o
.setName("message")
.setDescription("Reminder details")
.setRequired(true)
)
.addIntegerOption((o) =>
o
.setName("minutes")
.setDescription("Minutes from now to send the reminder")
.setRequired(true)
)
.addChannelOption((o) =>
o
.setName("channel")
.setDescription("Channel to post reminder in")
.setRequired(false)
)
.setDefaultMemberPermissions(0),
// ── Ping Command ──────────────────────────────────
new SlashCommandBuilder()
.setName("ping")
.setDescription("🏓 Check the bot's latency"),
].map((cmd) => cmd.toJSON());
// ── Deploy ─────────────────────────────────────────
const rest = new REST({ version: "10" }).setToken(process.env.DISCORD_TOKEN);
(async () => {
try {
console.log(`🔄 Registering ${commands.length} slash commands...`);
await rest.put(Routes.applicationCommands(process.env.CLIENT_ID), {
body: commands,
});
console.log("✅ All slash commands registered successfully!");
console.log(
"💡 Note: It may take up to 1 hour for global commands to appear everywhere."
);
} catch (error) {
console.error("❌ Error registering commands:", error);
}
})();