#help

1 messages · Page 1 of 1 (latest)

vestal nova
keen plume
#

??

vestal nova
#

Alright

#

I maybe can help

keen plume
#

ok

vestal nova
vestal nova
keen plume
# vestal nova
const { SlashCommandBuilder } = require('@discordjs/builders')
const  currencySystem = require('discord-mongo-currency')

module.exports = {
    data: new SlashCommandBuilder()
    .setName('search')
    .setDescription('Sends a random gif!')
    .addStringOption(option =>
        option.setName('where')
            .setDescription('mention where to search')
            .setRequired(true)
            .addChoice('bank')
            .addChoice('sofa')
            .addChoice('dustbin')),
    async execute(interaction){
        searchIn = interaction.options.getString('search')
        number = Math.floor(Math.random()*499)+1;
        currencySystem.giveCoins(interaction.member.id, interaction.guild.id , number)
        interaction.reply(`you searched in ${searchIn} and found ${number} coins`)
    }
}

#

it is correct

vestal nova
#

give me a sec

#

You are trying to get the wrong option

#

try changing it to where

keen plume
vestal nova
#

I am not a 100% sure

#

line 15

keen plume
#
C:\Users\admin\Desktop\discord bot\node_modules\zod\lib\types.js:175
        throw result.error;
        ^

ZodError: [
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "undefined",
    "path": [],
    "message": "Required"
  }
]
    at new ZodError (C:\Users\admin\Desktop\discord bot\node_modules\zod\lib\ZodError.js:80:28)
    at handleResult (C:\Users\admin\Desktop\discord bot\node_modules\zod\lib\types.js:115:21)
    at ZodString.ZodType.safeParse (C:\Users\admin\Desktop\discord bot\node_modules\zod\lib\types.js:191:16)
    at ZodString.ZodType.parse (C:\Users\admin\Desktop\discord bot\node_modules\zod\lib\types.js:172:27)
    at MixedClass.addChoice (C:\Users\admin\Desktop\discord bot\node_modules\@discordjs\builders\dist\index.js:3:4300)
    at C:\Users\admin\Desktop\discord bot\commands\search.js:12:5
    at MixedClass._sharedAddOptionMethod (C:\Users\admin\Desktop\discord bot\node_modules\@discordjs\builders\dist\index.js:3:7762)
    at MixedClass.addStringOption (C:\Users\admin\Desktop\discord bot\node_modules\@discordjs\builders\dist\index.js:3:7535)   
    at Object.<anonymous> (C:\Users\admin\Desktop\discord bot\commands\search.js:8:3)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\Users\admin\Desktop\discord bot\deploy-commands.js:12:18) {
  issues: [
    {
      code: 'invalid_type',
      expected: 'string',
      received: 'undefined',
      path: [],
      message: 'Required'
    }
  ],
  format: [Function (anonymous)],
  addIssue: [Function (anonymous)],
  addIssues: [Function (anonymous)],
  flatten: [Function (anonymous)]
}
#

@vestal nova

vestal nova