Skip to content

Tag: javascript

Discordjs add space between prefix and command

I created a music bot that streams music when someone taps !play in-text channel Now I want to switch !play with please play but it response only with pleaseplay with no space between them and when I tried to change the code: but it doesn’t work at all with an error log (node:5296) UnhandledPromiseRejec…

Filtering an array returned from Promise

I am porting the following code: Current version should use SerialPort.list(), which returns a promise. So far, I tried something along these lines, without success: Obviously I am not quite getting what I should do. So the question is: how should I represent the same intent of former FindDevices function, us…

Generate an array of dates and year using moment js

I have this code : I want to get something like : Have you an idea about that. My function is not working properly. Answer You can not declare such array structure, but you could use Object where keys would be years and values would be arrays of strings. Therefore I would propose such code which will create a…

React Query with hooks is throwing error, “Uncaught Error: Too many re-renders. React limits the number of renders to prevent an infinite loop.”

I am working on a React JS project that is using React query, https://react-query.tanstack.com/, React hooks and functional components. But it is throwing error when I use react query for API call. This is my component and how I use query within it. This is my getList API call logic When I run my code, I get …