There are several things wrong
- You are declaring a function inside the if, that is a bit weird
- You need to escape a dot in regex,
To find 123 in .result 123
you could do
const message = { "content": ".result 123" } // test message for this script
const userInput = message.content.match(/.result (w+)/)
if (userInput) console.log(userInput[1]); // contains the command
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…