Just getting back into discord bots

Recently just returned to going back to code my discord bot and notice that when i run the file i get "punnycode" module is deprecated. How do i fix this? Ive updated all dependencies to the current versions and still shows up. Tried to google it and nothing gives me a result to fix this Versions: Discord.js: 14.15.3 Node: 22.7.0
No description
23 Replies
d.js toolkit
d.js toolkit3mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Deimoss
Deimoss3mo ago
you can use npm ls punycode to see which package is using it and either replace it or just continue using it, ignoring the warning however i don't think it's related to discord.js
MrFangs
MrFangsOP3mo ago
what would i use if i replaced punycode? or can i just use punycode for ever?
Deimoss
Deimoss3mo ago
oh you're using it directly?
MrFangs
MrFangsOP3mo ago
no i run the command above and got this
No description
Deimoss
Deimoss3mo ago
doesn't look like unirest will be updated any time soon, as it hasn't been for 5 years, why not just use axios or the native node fetch instead?
MrFangs
MrFangsOP3mo ago
i dont know how to use them just saw unirest and learned that
Deimoss
Deimoss3mo ago
unirest looks pretty similar to axios, i'm sure you'll be fine there's not much to learn, it's just to make http requests anyway
MrFangs
MrFangsOP3mo ago
truuuuuu ok
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
Deimoss
Deimoss3mo ago
i mean that's not really a long term solution
MrFangs
MrFangsOP3mo ago
also got another question if u dont mind trying to figure this out it pops up when i try to run it, think it might be cause im missing sommething ill just learn axios since uni is starting to go out dated kinda
MrFangs
MrFangsOP3mo ago
it runs all the command files then shows this imm not sure what im looking at
No description
MrFangs
MrFangsOP3mo ago
imm thinking either a permission i forgot or something i didnt download
Deimoss
Deimoss3mo ago
can you share the code where you're doing this rest request?
MrFangs
MrFangsOP3mo ago
thats the thing im not sure cause each file has one oh one sec thought rest was something else ill show require ('dotenv').config(); const { Client, GatewayIntentBits, Partials, Routes, Collection } = require('discord.js') const client = new Client({ intents:[ GatewayIntentBits.GuildMessages, GatewayIntentBits.Guilds, GatewayIntentBits.MessageContent ], rest: {version: '10'}, partials: [Partials.Channel] }); const {TOKEN, APP, GUILD} = process.env; const {registerCommands} = require('./handler/registercommand'); client.rest.setToken(TOKEN); client.on('interactionCreate', (interaction) => { if (interaction.isChatInputCommand()) { const {commandName} = interaction; const cmd = client.slashCommands.get(commandName); if (cmd) { cmd.execute(client, interaction); } else { interaction.reply({content: 'Error running this slash command'}); } } }); async function main() { try { client.slashCommands = new Collection; await registerCommands(client, '../commands'); //console.log(client.slashCommands); const slashCommandsJson = client.slashCommands.map((cmd) => cmd.getSlashCommandJSON()); //console.log(slashCommandsJson); await client.rest.put(Routes.applicationCommands(APP), { body: slashCommandsJson, }); const registeredSlashCommands = await client.rest.get( Routes.applicationCommands(APP) ); //console.log(registeredSlashCommands); await client.login(TOKEN); } catch(err) { console.log(err) } } process.on("uncaughtException", (err) => { console.error('Uncaught Exception:', err); }); process.on("unhandledRejection", (reason, promise) => { console.error("[FATAL] Possibly Unhandled Rejection at: Promise", promise, "\nreason:", reason.message); }); main() welp i was trying to put in a txt file -_-
Deimoss
Deimoss3mo ago
btw you can do ```js <code> ``` to get codeblocks with syntax highlighting
MrFangs
MrFangsOP3mo ago
ohh ok ty
Deimoss
Deimoss3mo ago
seems like the APP variable is not your bot's id
MrFangs
MrFangsOP3mo ago
u know now that i think of it i do think so cause i remeber changing the token to another bot but not the app var.
Deimoss
Deimoss3mo ago
just double check to be sure also it's probably better to get the client's id in your code, instead of storing it inside of an .env file, because if you decide to switch bots you have to change 2 things in your .env instead of one
MrFangs
MrFangsOP3mo ago
ok, also it works now thank you so much for helping me! ill look up how to do that
Deimoss
Deimoss3mo ago
glad to help 👍
Want results from more Discord servers?
Add your server