This repository has been archived by the owner on Apr 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
menu.js
54 lines (50 loc) · 2.2 KB
/
menu.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
const { ReactionCollector } = require('discord.js-collector')
const { Client, MessageEmbed } = require("discord.js");
const client = new Client();
client.on("ready", () => {
console.log("ready");
});
const pages = {
'📥': {
embed: {
title: 'Welcome Join Config',
description: `React below embed to configure channel or message of welcome settings.\n\n📜 Channel settings\n📢 Message settings`,
},
reactions: ['📜', '📢'],
pages: {
'📜': {
backEmoji: '🔙',
embed: {
description: 'Please mention or use channel id to set as welcome channel.'
},
onMessage: async (controller, message) => {
const channel = message.mentions.channels.first() || message.guild.channels.cache.get(message.content);
if (!channel)
return message.reply('🚫 | You\'ve forgot mention a channel or use their id.').then((m) => m.delete({ timeout: 3000 }));
// Do what you want here, like set it on database...
return await message.reply(`✅ | Success! You've settled welcome channel as ${channel}.`).then(m => m.delete({ timeout: 3000 }));
}
},
'📢': {
backEmoji: '🔙',
embed: {
description: 'Make the message used when a member join in the server.',
},
onMessage: async (controller, message) => {
// Do what you want here, like set it on database..
return await message.reply('✅ | Success!').then(m => m.delete({ timeout: 3000 }));
}
}
}
},
};
client.on("message", async (message) => {
if (message.content.startsWith('>config')) {
const embed = new MessageEmbed()
.setTitle('Server Settings')
.setDescription('React below to configure modules in this server.\n\n📥 Welcome module')
const botMessage = await message.reply(embed);
ReactionCollector.menu({ botMessage, user: message.author, pages });
}
});
client.login("Token");