#update bot to v 14

45 messages · Page 1 of 1 (latest)

late crane
slate rune
slate rune
#

don't we all

#

if you try to fix the most pressing errors and post the ones you don't understand here in full, I am confident you'll have your bot back up and running in no time

late crane
#

okay i wil try

#

https://prnt.sc/0VuluHmqnsCC

        if (channel && !channel.isText()) return;
                                ^

TypeError: channel.isText is not a function
    at InteractionCreateAction.handle (C:\Users\stefa\Desktop\AtlanticCity-DiscordBot-main\node_modules\discord.js\src\client\actions\InteractionCreate.js:48:33)
    at module.exports [as INTERACTION_CREATE] (C:\Users\stefa\Desktop\AtlanticCity-DiscordBot-main\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
    at WebSocketManager.handlePacket (C:\Users\stefa\Desktop\AtlanticCity-DiscordBot-main\node_modules\discord.js\src\client\websocket\WebSocketManager.js:346:31)
    at WebSocketShard.onPacket (C:\Users\stefa\Desktop\AtlanticCity-DiscordBot-main\node_modules\discord.js\src\client\websocket\WebSocketShard.js:478:22)
    at WebSocketShard.onMessage (C:\Users\stefa\Desktop\AtlanticCity-DiscordBot-main\node_modules\discord.js\src\client\websocket\WebSocketShard.js:317:10)
    at WebSocket.onMessage (C:\Users\stefa\Desktop\AtlanticCity-DiscordBot-main\node_modules\ws\lib\event-target.js:199:18)
    at WebSocket.emit (node:events:513:28)
    at Receiver.receiverOnMessage (C:\Users\stefa\Desktop\AtlanticCity-DiscordBot-main\node_modules\ws\lib\websocket.js:1178:20)
    at Receiver.emit (node:events:513:28)
    at Receiver.dataMessage (C:\Users\stefa\Desktop\AtlanticCity-DiscordBot-main\node_modules\ws\lib\receiver.js:528:14)

Node.js v18.16.0

Process finished with exit code 1
Lightshot

Captured with Lightshot

slate rune
late crane
slate rune
#

Remove your node_modules folder and do a fresh npm i

late crane
#

okay

#

stil the same error

slate rune
#

Show your package.json and package-lock.json

late crane
#

package.json

  "name": "atlanticcity-discordbot",
  "version": "1.0.0",
  "description": "Atlantic City 2.0s Discord Bot",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/Zuntie/AtlanticCity-DiscordBot.git"
  },
  "keywords": [
    "discordbot"
  ],
  "author": "Zuntie",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/Zuntie/AtlanticCity-DiscordBot/issues"
  },
  "homepage": "https://github.com/Zuntie/AtlanticCity-DiscordBot#readme",
  "dependencies": {
    "@livecord/notify": "^1.2.3",
    "discord-modals": "^1.3.7",
    "discord.js": "^13.8.1",
    "fivem": "^2.1.8",
    "fivereborn-query": "^1.0.4",
    "fs": "^0.0.1-security",
    "readline": "^1.3.0",
    "twitchrequest": "^1.4.9"
  }
}
slate rune
#

you still have discord.js V 13 as dependency

late crane
#

"discord.js": "^13.8.1", this

slate rune
#

yes

late crane
#

i need to change to "discord.js": "^14.0.0", ?

slate rune
late crane
#

nice now my node m updates

#

now i cant run my bot

slate rune
#

thoughts and prayers

#

imagine yourself in my shoes. What on earth should I make from "now i cant run my bot"?

late crane
#

oh sorry my fualt :/

#
C:\Users\stefa\Desktop\AtlanticCity-DiscordBot-main\node_modules\discord.js\src\util\BitField.js:172
    throw new DiscordjsRangeError(ErrorCodes.BitFieldInvalid, bit);
    ^

RangeError [BitFieldInvalid]: Invalid bitfield flag or number: DIRECT_MESSAGES.
    at IntentsBitField.resolve (C:\Users\stefa\Desktop\AtlanticCity-DiscordBot-main\node_modules\discord.js\src\util\BitField.js:172:11)
    at C:\Users\stefa\Desktop\AtlanticCity-DiscordBot-main\node_modules\discord.js\src\util\BitField.js:167:54
    at Array.map (<anonymous>)
    at IntentsBitField.resolve (C:\Users\stefa\Desktop\AtlanticCity-DiscordBot-main\node_modules\discord.js\src\util\BitField.js:167:40)
    at new BitField (C:\Users\stefa\Desktop\AtlanticCity-DiscordBot-main\node_modules\discord.js\src\util\BitField.js:33:38)
    at new IntentsBitField (C:\Users\stefa\Desktop\AtlanticCity-DiscordBot-main\node_modules\discord.js\src\util\IntentsBitField.js:9:1)
    at Client._validateOptions (C:\Users\stefa\Desktop\AtlanticCity-DiscordBot-main\node_modules\discord.js\src\client\Client.js:494:25)
    at new Client (C:\Users\stefa\Desktop\AtlanticCity-DiscordBot-main\node_modules\discord.js\src\client\Client.js:78:10)
    at Object.<anonymous> (C:\Users\stefa\Desktop\AtlanticCity-DiscordBot-main\index.js:3:16)
    at Module._compile (node:internal/modules/cjs/loader:1254:14) {
  code: 'BitFieldInvalid'
}

slate rune
late crane
#

i need to change this "DIRECT_MESSAGES. "

#

?

#

meby i find the error 2 sec

#

i donnt find the error

late crane
#

i find the line whit errores const client = new Discord.Client({ intents: ['GUILDS', 'GUILD_BANS', 'GUILD_MEMBERS', 'GUILD_MESSAGES', 'GUILD_WEBHOOKS'], partials: ['CHANNEL', 'MESSAGE']

slate rune
late crane
#

i got this error now Modal is not a constructor

#

i fix the error

late crane
#

you stil here i got a now error

slate rune
#

I'm sorry to hear

late crane
#

when i try to make i ticket i get this error
node:18292) DeprecationWarning: BaseInteraction#isSelectMenu() is deprecated. Use BaseInteraction#isStringSelectMenu() instead.
(Use node --trace-deprecation ... to show where the warning was created)
index.js:2287
ReferenceError: err is not defined
at Client.<anonymous> (c:\Users\stefa\Desktop\AtlanticCity-DiscordBot-main\index.js:4559:40)
at Client.emit (c:\Users\stefa\Desktop\AtlanticCity-DiscordBot-main\lib\events.js:513:28)
at emitUnhandledRejectionOrErr (c:\Users\stefa\Desktop\AtlanticCity-DiscordBot-main\lib\events.js:394:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21) {stack: 'ReferenceError: err is not defined
at Cli…ons (node:internal/process/task_queues:84:21)', message: 'err is not defined'}

slate rune
#

I am fairly certain that you are referring to a variable called err in your index.js line 4559 on column 40, which does not exist in that scope. That is exactly what the error tells you.

Side note: if your files contain several thousand lines of codes, you may want to consider splitting your code up into smaller units.

late crane
#

/ Error Handler \
client.on("error", (error) => {
try {
log(**ERROR RECIEVED**\n\n**${err.name}**: ${err.message}, 'error');
console.log(error);
} catch (err) {
console.log(err);
log(**ERROR RECIEVED**\n\n**${err.name}**: ${err.message}, 'error');
}
})

#

4559
log(**ERROR RECIEVED**\n\n**${err.name}**: ${err.message}, 'error');

slate rune
#

Please add proper formatting and syntax highlighting to your code. Check #faq on how to do that. It really helps to read and understand your code and increases the chances of someone jumping in to help.