String.gsub with Java Script?

Hi there! Before we start, I do not know if other coding languages are allowed, so if not, please tell me and I will delete my topic! I am trying to remove part of a string to set my discord bot’s status. Looking at the Java Script website, it tells me to use subtraction symbols, but that returns NaN. Here is my current code:

require('dotenv').config();
exports.run = async (client, message, args) => {
 client.user.setActivity(`${message}`, { type: 'WATCHING' })
 return message.charAt(1)
  .then(presence => console.log(`Activity set to ${presence.game ? presence.game.name : 'none'}`))
  .catch(console.error);
}

I am fairly new to java script but am trying to learn through resources made. Any help is appreciated!

string.replace is probably the closest match.

4 Likes

Roblox is based on Lua. Not sure why this posted here, this is for Roblox development.

Sorry! I did not really know if I should or not. I have tried to flag it, but it says it has been reviewed and is fine.

It’s ok no problem man. Might wanna go to another site to ask about that. I think Scripting Helpers is good.

I actually tried them, but they said only Roblox lua. Maybe I used the wrong site.

It’s ok. Might wanna delete this post then.

I have tried. It will not let me, sorry.

Top right and you can delete it.

There is no way to definitively say that someone using a language other than Lua has nothing to do with Roblox development:

  1. Some people now use roblox-ts to code their games.
  2. The user could be writing code for an external server that communicates with their game via HttpService.

The user has no reason to delete their post.

My bad then, sorry about that.