Message object, help message

This commit is contained in:
mmacierzanka committed 2021-06-20 00:43:38 +02:00
1 parent be20c57974
commit f0f3921c09
5 files changed
+160 -21

No files matched your search

+44
View File
@@ -0,0 +1,44 @@
import { Message, MessageEmbed } from 'discord.js';
import { Command, CommandsManager } from './Commands';
interface HelpMessageParams {
title: string,
bottomText: string
color: string,
description: string,
usage: string
}
class HelpMessage extends Command {
constructor(cmdManager: CommandsManager, params: HelpMessageParams, prefix: string, botName?: string) {
super({
name: 'help',
usage: params.usage,
permissions: 0,
description: params.description,
function: (m?: Message) => {
const helpMsg = new MessageEmbed()
if(helpMsg != null) {
helpMsg.setColor(params.color);
helpMsg.setDescription(params.bottomText);
helpMsg.setTimestamp();
helpMsg.setTitle(params.title);
helpMsg.setFooter(botName || '');
cmdManager.list.map((c) => {
if(c.visible) {
helpMsg.addField(
`${prefix}${c.name} ${c.usage}`,
c.description,
false
)
}
});
}
return helpMsg;
}
});
}
}
export { HelpMessage, HelpMessageParams };