add getValues command
This commit is contained in:
parent
c51909ac13
commit
687c4e6ac1
27
src/bot.ts
27
src/bot.ts
|
@ -20,6 +20,7 @@ import Reset from "./commands/reset";
|
|||
import SetModRole from "./commands/setModRole";
|
||||
import SetIgnorePrefix from "./commands/setIgnorePrefix";
|
||||
import SetAutoEmbedMessages from "./commands/setAutoEmbedMessages";
|
||||
import GetValues from "./commands/getValues";
|
||||
import { pagination, ButtonsTypes, ButtonsStyles } from "@devraelfreeze/discordjs-pagination";
|
||||
|
||||
export class Bot {
|
||||
|
@ -44,6 +45,7 @@ export class Bot {
|
|||
commands.set(SetModRole.data.name, SetModRole);
|
||||
commands.set(SetIgnorePrefix.data.name, SetIgnorePrefix);
|
||||
commands.set(SetAutoEmbedMessages.data.name, SetAutoEmbedMessages);
|
||||
commands.set(GetValues.data.name, GetValues);
|
||||
|
||||
|
||||
client.once(Events.ClientReady, readyClient => {
|
||||
|
@ -123,6 +125,7 @@ export class Bot {
|
|||
SetModRole.data.toJSON(),
|
||||
SetIgnorePrefix.data.toJSON(),
|
||||
SetAutoEmbedMessages.data.toJSON(),
|
||||
GetValues.data.toJSON(),
|
||||
);
|
||||
|
||||
|
||||
|
@ -294,31 +297,55 @@ export class Bot {
|
|||
return this;
|
||||
}
|
||||
|
||||
public getChannel(): string {
|
||||
return this.channel;
|
||||
}
|
||||
|
||||
public setCounter(counter: number): Bot {
|
||||
this.counter = counter;
|
||||
return this;
|
||||
}
|
||||
|
||||
public getCounter(): number {
|
||||
return this.counter;
|
||||
}
|
||||
|
||||
public setLastUser(lastUserId: string): Bot {
|
||||
this.lastUser = lastUserId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public getLastUser(): string {
|
||||
return this.lastUser;
|
||||
}
|
||||
|
||||
public setModRole(roleId: string): Bot {
|
||||
this.modRole = roleId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public getModRole(): string {
|
||||
return this.modRole;
|
||||
}
|
||||
|
||||
public setIgnorePrefix(prefix: string): Bot {
|
||||
this.ignorePrefix = prefix;
|
||||
return this;
|
||||
}
|
||||
|
||||
public getIgnorePrefix(): string {
|
||||
return this.ignorePrefix;
|
||||
}
|
||||
|
||||
public setAutoEmbedMessages(counter: number): Bot {
|
||||
this.autoEmbedMessages = counter;
|
||||
return this;
|
||||
}
|
||||
|
||||
public getAutoEmbedMessages(): number {
|
||||
return this.autoEmbedMessages;
|
||||
}
|
||||
|
||||
public static getInstance(): Bot {
|
||||
if (!Bot.instance) {
|
||||
Bot.instance = new Bot();
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
import {
|
||||
ChatInputCommandInteraction, EmbedBuilder,
|
||||
PermissionsBitField,
|
||||
SlashCommandBuilder,
|
||||
SlashCommandChannelOption,
|
||||
} from 'discord.js';
|
||||
import {ChannelType} from 'discord-api-types/v10';
|
||||
import {Bot} from "../bot";
|
||||
|
||||
export default {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('getvalues')
|
||||
.setDescription('Show all the currently set properties of the bot.')
|
||||
.setDefaultMemberPermissions(PermissionsBitField.Flags.Administrator),
|
||||
async execute(interaction: ChatInputCommandInteraction) {
|
||||
const bot = Bot.getInstance();
|
||||
console.log('channel: ' + bot .getChannel() + ' counter: ' + bot.getCounter() + ' lastUser: ' + bot.getLastUser() + ' modRole: ' + bot.getModRole() + ' ignorePrefix: ' + bot.getIgnorePrefix() + ' autoEmbedMessages: ' + bot.getAutoEmbedMessages());
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('Bot Properties')
|
||||
.setDescription('This is a list of all the bots currently set properties')
|
||||
.setColor(0xffe600)
|
||||
.setFields([
|
||||
{
|
||||
name: 'channel',
|
||||
value: bot.getChannel(),
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: 'counter',
|
||||
value: bot.getCounter().toString(),
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: 'lastUser',
|
||||
value: '<@' + bot.getLastUser() + '>',
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: 'modRole',
|
||||
value: '<@&' + bot.getModRole() + '>',
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: 'ignorePrefix',
|
||||
value: bot.getIgnorePrefix(),
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: 'autoEmbedMessages',
|
||||
value: bot.getAutoEmbedMessages().toString(),
|
||||
inline: true,
|
||||
},
|
||||
]);
|
||||
|
||||
return await interaction.reply({
|
||||
embeds: [embed],
|
||||
ephemeral: true,
|
||||
});
|
||||
},
|
||||
};
|
Loading…
Reference in New Issue