message.content doesn’t have any value in Discord.js

Make sure you enable the message content intent on your developer portal and add the GatewayIntentBits.MessageContent enum to your intents array. Applications ↦ Settings ↦ Bot ↦ Privileged Gateway Intents You’ll also need to add the MessageContent intent: const client = new Client({ intents: [ GatewayIntentBits.DirectMessages, GatewayIntentBits.Guilds, GatewayIntentBits.GuildBans, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent, ], partials: [Partials.Channel], }); If … Read more

React Native Android build failure with different errors without any changes in code for past days due to publish of React Native version 0.71.0-rc.0

The build failures for Android was due to the publish of the React Native version 0.71.0-rc0. Note: Error may be different but this would be the solution if you are getting android build failures without any changes in code for past two days before trying these methods please revert back every changes you have done … Read more

How to format a number with commas as thousands separators?

I used the idea from Kerry’s answer, but simplified it since I was just looking for something simple for my specific purpose. Here is what I have: function numberWithCommas(x) { return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, “,”); } function numberWithCommas(x) { return x.toString().replace(/\B(?<!\.\d*)(?=(\d{3})+(?!\d))/g, “,”); } function test(x, expect) { const result = numberWithCommas(x); const pass = result === expect; … Read more

How to ignore acute accent in a javascript regex match?

The standard ecmascript regex isn’t ready for unicode (see http://blog.stevenlevithan.com/archives/javascript-regex-and-unicode). So you have to use an external regex library. I used this one (with the unicode plugin) in the past : http://xregexp.com/ In your case, you may have to escape the char é as \u00E9 and defining a range englobing e, é, ê, etc. EDIT … Read more

Cross-browser (IE8-) getComputedStyle with Javascript?

Here’s a cross-browser function to get a computed style… getStyle = function (el, prop) { if (typeof getComputedStyle !== ‘undefined’) { return getComputedStyle(el, null).getPropertyValue(prop); } else { return el.currentStyle[prop]; } } You may store it as an utility within an object, or just use it as provided. Here’s a sample demo! // Create paragraph element … Read more