how to make this concept work?
i'm trying to make a command where i can set the bot's status & then choose the playing/watching/listening etc type in a select menu, & here is this attempt:
however every selection i make simply returns
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}!`);
});
},
};however every selection i make simply returns
ActivityType.PlayingActivityType.Playing despite me trying to make the PlayingPlaying give whichever value, i'm pretty sure i missed something but i can't really figure out what. no worries if no help is able to be given, but i feel like there's probably an easy fix or i overlooked something?