I’m using node.js with typescript for a server which receives WAV files and I’m trying to check wether a WAV file is valid, however I’m not sure exactly how the best way to do it would be, I have figured out how to check a few things but I’m not sure that I’m not doing it correct…
Tag: node.js
How to get distinct elements(case insensitive) from array of objects using lodash
I have an array that looks something like below, now I need only one Microsoft, instead of these case combinations using lodash. expected output, can anyone help me out with this? found many solution, but i need the case insensitive filter. thanks in advance. Answer You can use lodash’s _.uniqBy(), whic…
Filtering files in directory with regex.match using Puppeteer
I’m having issues with regex.match not matching filenames which do match when I test them individually in an online checker https://regex101.com Can anyone spot the problem in code below? Q: Should I be using regex.test instead of match? If yes, how do I create the regex when it contains variables? It s…
Discord js v13 channel filter not working
I’m currently trying to get the total amount of text channels and voice channels to display in my embed, when I try to filter them as I did in discord.js v12 it gives me an output of 0 but if I use no filter and do guild.channels.cache.size, it prints 4 which is the correct amount ( 2 text channels, 1
Guild.commands is undefined in discord.js v12.5.3
So I’m using discord.js version 12.5.3 to rebuild a music bot I did a while back. I’m trying to use slash commands but when I use guild.commands.set([commands]) it says that guild.commands is undefined. Here’s that part of my code. Answer Guild.commands was only introduced in v13. In v12, th…
Catching an permission error problem discord.js?
I’m having an issue trying to catch an error. The error I’m wanting to catch is a 403 discord Missing Permission error. However instead of catching the error it’s causing my bot to go offline when the error occurs. Here is how I’m trying to catch my error. Help appreciated. Answer Text…
Please fix the error: “TypeError: Cannot read property ‘id’ of undefined.”
I am trying to code a discord bot for a friend’s server. It’s supposed to be a fun bot so I thought it would be funny to add a spam command. But I keep getting Errors when I do. Can someone help me out with the error? The code and the error are both given below. It works fine when
Check role that is added guildmemberupdate discordjs
On the event guildmemberupdate, I am trying to see if the event is in my server and if the role is a certain role. If all things are true, it will send a message. It does not send a message though Here is the code It doesn’t send ‘test’ Answer The guildMemberUpdate event requires the server …
How to export function as function expression in express node js
I have a function I am exporting this in the main route file But when I running the code it’s giving this error Error: Route.post() requires a callback function but got a [object] Object What I am doing wrong? Answer You’re trying to use the exports object as though it were a function. If you want…
Unhandled Promise Rejection Warning Error
ERROR (node:39756) UnhandledPromiseRejectionWarning: Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client at ServerResponse.setHeader (_http_outgoing.js:561:11) at ServerResponse.header (C:UserselegmOneDriveРабочий столanimflexapinode_modulesexpresslibresponse.js:771:10) at Serv…