This repository has been archived by the owner on Aug 5, 2021. It is now read-only.
/
helpMenu.js
49 lines (38 loc) · 1.45 KB
/
helpMenu.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
require('dotenv').config();
const { DiscordActivity } = require('..');
const Discord = require('discord.js');
const activityClient = new DiscordActivity();
var mainActivity = activityClient.createActivity({
isActive: true
});
var component = mainActivity.createComponent('messageEmbed', {
isHidden: true
});
component.setTitle("Help Menu");
component.setAuthor("My server name");
component.setThumbnail('https://github.com/google/material-design-icons/raw/master/png/action/help/materialicons/24dp/2x/baseline_help_black_24dp.png');
component.setDescription('Display all available commands');
component.addField('\u200b', '\u200b');
component.addField('!help', 'Show this menu', true);
component.addField('!ban :username:', 'Show this menu', true);
component.addField('!mute :username:', 'Mute Someone', true);
component.addField('!kick :username:', 'Exclude Someone', true);
var closeButton = component.addButton('❌');
closeButton.setCooldown(1000);
closeButton.on('click', (event) => {
console.log('Close button click by', event.user.username);
component.setVisibile(false);
});
activityClient.on('ready', async () => {
console.log('Client ready');
});
activityClient.on('error', async (err) => {
console.log('Client error');
console.error(err);
});
activityClient.on('message', (message) => {
if (message.content === '!help') {
component.setVisibile(true);
}
});
activityClient.login(process.env.TOKEN, process.env.CHANNEL_ID);