There's a few ways to do it. Simplest is to probably just split your string.
let vals = msg.text.split(' '); // yields an array of '/start', '76198769'
let temp = null;
if(vals[0] === '/start' && vals[1] === '76198769') {
temp = parseInt(vals[1]);
}
Or with Regex, you could do
let matches = /\/start\s(\d+)/g.exec(msg.text);
let temp = null;
if(matches.length) {
temp = parseInt(matches[1]);
}
Just for fun, I'd point out that what I'm recommending here could be extended as well. For example, if you have a list of commands you want to use, you could test for them and then route the command to some other code.
Let's say you have commands like 'start', 'stop', 'info'. If you create an object (perhaps through requires in Node) like this:
const commands = {
'start' : function(args) { /* handle start */},
'stop' : function(args) { /* handle stop */},
'info' : function(args) { /* handle info */}
};
You can construct your regex and fetch it like this:
const regex = /\/(start|stop|info)\s(\d+)/g;
let command = null;
let args = null;
let matches = regex.exec(msg.text);
if(matches.length) {
command = matches[1];
args = parseInt(matches[2]);
}
Then you can execute your command with commands[command](args);
If you really want, you can even construct your regex from a string by concatenating the keys of the commands object, but I'll leave that as an exercise to you. :)