const { ComponentType, ActivityType, ActionRowBuilder, StringSelectMenuBuilder, StringSelectMenuOptionBuilder, SlashCommandBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('status')
.setDescription('Select a status for the bot')
.addStringOption(option =>
option.setName('status')
.setDescription('The status to set')
.setRequired(true)
.setMaxLength(128)),
async execute(interaction) {
const status = interaction.options.getString('status');
const select = new StringSelectMenuBuilder()
.setCustomId('type')
.setPlaceholder('Type of status')
.addOptions(
new StringSelectMenuOptionBuilder()
.setLabel('Playing')
.setDescription('Playing /status')
.setValue('Playing'),
new StringSelectMenuOptionBuilder()
.setLabel('Watching')
.setDescription('Watching /status')
.setValue('Watching'),
new StringSelectMenuOptionBuilder()
.setLabel('Listening')
.setDescription('Listening to /status')
.setValue('Listening'),
);
const row = new ActionRowBuilder()
.addComponents(select);
const response = await interaction.reply({
content: 'Choose the type of status you want to set',
components: [row],
});
const collector = response.createMessageComponentCollector({ componentType: ComponentType.StringSelect, time: 3_600_000 });
collector.on('collect', async i => {
const selection = i.values[0].toLowerCase();
await interaction.client.user.setActivity(interaction.options.getString('status'), { type: ActivityType.select });
await i.reply(`${i.user} has set my status as ${selection} ${status}!`);
});
},
};
const { ComponentType, ActivityType, ActionRowBuilder, StringSelectMenuBuilder, StringSelectMenuOptionBuilder, SlashCommandBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('status')
.setDescription('Select a status for the bot')
.addStringOption(option =>
option.setName('status')
.setDescription('The status to set')
.setRequired(true)
.setMaxLength(128)),
async execute(interaction) {
const status = interaction.options.getString('status');
const select = new StringSelectMenuBuilder()
.setCustomId('type')
.setPlaceholder('Type of status')
.addOptions(
new StringSelectMenuOptionBuilder()
.setLabel('Playing')
.setDescription('Playing /status')
.setValue('Playing'),
new StringSelectMenuOptionBuilder()
.setLabel('Watching')
.setDescription('Watching /status')
.setValue('Watching'),
new StringSelectMenuOptionBuilder()
.setLabel('Listening')
.setDescription('Listening to /status')
.setValue('Listening'),
);
const row = new ActionRowBuilder()
.addComponents(select);
const response = await interaction.reply({
content: 'Choose the type of status you want to set',
components: [row],
});
const collector = response.createMessageComponentCollector({ componentType: ComponentType.StringSelect, time: 3_600_000 });
collector.on('collect', async i => {
const selection = i.values[0].toLowerCase();
await interaction.client.user.setActivity(interaction.options.getString('status'), { type: ActivityType.select });
await i.reply(`${i.user} has set my status as ${selection} ${status}!`);
});
},
};