const { ActionRowBuilder, ButtonBuilder, ButtonStyle, SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const { ActivityType } = require('discord.js');
module.exports = {
cooldown: 120,
data: new SlashCommandBuilder()
.setName('status')
.setDescription('Set the bot\'s status')
.addStringOption(option =>
option.setName('input')
.setDescription('The status to set')
.setMaxLength(128)
.setRequired(true)),
category: 'dev',
async execute(interaction) {
const status = interaction.options.getString('input');
const cancel = new ButtonBuilder()
.setCustomId('Cancel')
.setLabel('Cancel')
.setStyle(ButtonStyle.Secondary);
const playing = new ButtonBuilder()
.setCustomId('Playing')
.setLabel('Playing')
.setStyle(ButtonStyle.Primary);
const watching = new ButtonBuilder()
.setCustomId('Watching')
.setLabel('Watching')
.setStyle(ButtonStyle.Primary);
const listening = new ButtonBuilder()
.setCustomId('Listening')
.setLabel('Listening')
.setStyle(ButtonStyle.Primary);
const reset = new ButtonBuilder()
.setCustomId('Reset')
.setLabel('Reset')
.setStyle(ButtonStyle.Danger);
const row = new ActionRowBuilder()
.addComponents(cancel, playing, watching, listening, reset);
const content = `\`/status\` from ${interaction.user}`;
const type = interaction.customId;
const preType = new EmbedBuilder()
.setColor(0x2b2d31)
.setTitle('_No status type, moo?_ š')
.setDescription(`**Status:** ${status}\n\nPlease pick a type for this status!`);
const selectType = EmbedBuilder.from(preType)
.setTitle('_Successful moo!_ š')
.setDescription(`**Status:** ${status}\n**Type:** ${type}\n\nI have set the status!`)
.setFooter({ text: 'To set a different status, use /status again.' });
const resetType = EmbedBuilder.from(preType)
.setDescription('**Status:** reset\n\nI have reset the status!')
.setFooter({ text: 'To set another status, use /status again.' });
const response = await interaction.reply({
embeds: [preType], content: `${content}`, fetchReply: true,
components: [row],
});
const collectorFilter = i => i.user.id === interaction.user.id;
const selection = await response.awaitMessageComponent({ filter: collectorFilter });
if (selection.customId === 'Cancel') {
await response.suppressEmbeds();
await interaction.editReply({ content: '`/status` type selection cancelled.', components: [] });
}
else if (selection.customId === 'Reset') {
await interaction.client.user.setActivity(null);
await interaction.editReply({ embeds: [resetType], content: `${content}`, components: [] });
}
else if (selection.customId === 'Playing') {
await interaction.client.user.setActivity(`${status}`, { type: ActivityType.Playing });
await interaction.editReply({ embeds: [selectType], content: `${content}`, components: [] });
}
else if (selection.customId === 'Watching') {
await interaction.client.user.setActivity(`${status}`, { type: ActivityType.Watching });
await interaction.editReply({ embeds: [selectType], content: `${content}`, components: [] });
}
else if (selection.customId === 'Listening') {
await interaction.client.user.setActivity(`${status}`, { type: ActivityType.Listening });
await interaction.editReply({ embeds: [selectType], content: `${content}`, components: [] });
}
},
};
const { ActionRowBuilder, ButtonBuilder, ButtonStyle, SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const { ActivityType } = require('discord.js');
module.exports = {
cooldown: 120,
data: new SlashCommandBuilder()
.setName('status')
.setDescription('Set the bot\'s status')
.addStringOption(option =>
option.setName('input')
.setDescription('The status to set')
.setMaxLength(128)
.setRequired(true)),
category: 'dev',
async execute(interaction) {
const status = interaction.options.getString('input');
const cancel = new ButtonBuilder()
.setCustomId('Cancel')
.setLabel('Cancel')
.setStyle(ButtonStyle.Secondary);
const playing = new ButtonBuilder()
.setCustomId('Playing')
.setLabel('Playing')
.setStyle(ButtonStyle.Primary);
const watching = new ButtonBuilder()
.setCustomId('Watching')
.setLabel('Watching')
.setStyle(ButtonStyle.Primary);
const listening = new ButtonBuilder()
.setCustomId('Listening')
.setLabel('Listening')
.setStyle(ButtonStyle.Primary);
const reset = new ButtonBuilder()
.setCustomId('Reset')
.setLabel('Reset')
.setStyle(ButtonStyle.Danger);
const row = new ActionRowBuilder()
.addComponents(cancel, playing, watching, listening, reset);
const content = `\`/status\` from ${interaction.user}`;
const type = interaction.customId;
const preType = new EmbedBuilder()
.setColor(0x2b2d31)
.setTitle('_No status type, moo?_ š')
.setDescription(`**Status:** ${status}\n\nPlease pick a type for this status!`);
const selectType = EmbedBuilder.from(preType)
.setTitle('_Successful moo!_ š')
.setDescription(`**Status:** ${status}\n**Type:** ${type}\n\nI have set the status!`)
.setFooter({ text: 'To set a different status, use /status again.' });
const resetType = EmbedBuilder.from(preType)
.setDescription('**Status:** reset\n\nI have reset the status!')
.setFooter({ text: 'To set another status, use /status again.' });
const response = await interaction.reply({
embeds: [preType], content: `${content}`, fetchReply: true,
components: [row],
});
const collectorFilter = i => i.user.id === interaction.user.id;
const selection = await response.awaitMessageComponent({ filter: collectorFilter });
if (selection.customId === 'Cancel') {
await response.suppressEmbeds();
await interaction.editReply({ content: '`/status` type selection cancelled.', components: [] });
}
else if (selection.customId === 'Reset') {
await interaction.client.user.setActivity(null);
await interaction.editReply({ embeds: [resetType], content: `${content}`, components: [] });
}
else if (selection.customId === 'Playing') {
await interaction.client.user.setActivity(`${status}`, { type: ActivityType.Playing });
await interaction.editReply({ embeds: [selectType], content: `${content}`, components: [] });
}
else if (selection.customId === 'Watching') {
await interaction.client.user.setActivity(`${status}`, { type: ActivityType.Watching });
await interaction.editReply({ embeds: [selectType], content: `${content}`, components: [] });
}
else if (selection.customId === 'Listening') {
await interaction.client.user.setActivity(`${status}`, { type: ActivityType.Listening });
await interaction.editReply({ embeds: [selectType], content: `${content}`, components: [] });
}
},
};