I am making a command to enable and disable events and when choosing any options it returns
TypeError: interaction.options.getString is not a function
I dont know why it does this as ive used interaction.options.getString before like how i did below and it works fine
Code:
module.exports = {
name: 'settings',
description: 'Toggle Certain Functions',
timeout: 5000,
category: 'general',
options: [
{
name: 'action',
description: 'Action to perform',
type: 3,
required: true,
choices: [
{
name: 'show',
value: 'action_show',
},
{
name: 'enable',
value: 'action_enable',
},
{
name: 'disable',
value: 'action_disable',
},
],
},
{
name: 'module',
description: 'Module to toggle',
type: 3,
required: true,
choices: [
{
name: 'all',
value: 'module_all',
},
{
name: 'premium',
value: 'module_starboard',
},
{
name: 'logging',
value: 'module_logging',
},
],
},
],
run: async (client, interaction) => {
const actions = interaction.options.getString('action');
const modules = interaction.options.getString('module');
if (actions === action_show) {
if (modules === module_all) {
// CODE
What version of DiscordJS are you on? Some older versions use different options systems.
You can update your version by running:
npm i discord.js@latest
or
yarn upgrade discord.js