Accepting punctuation as part of a 8ball question.
This commit is contained in:
parent
dda9ba81ae
commit
335bd55a91
|
@ -56,7 +56,7 @@ function purgeQuestions() {
|
|||
async function onCommand(args, context) {
|
||||
const question = args.join(' ');
|
||||
|
||||
if (!/\w+\s+\w+\?/.test(question)) {
|
||||
if (!/[\w\p{P}]+\s+[\w\p{P}]+\?/.test(question)) {
|
||||
context.sendMessage('Please ask me a question, any question...', context.room.id);
|
||||
return;
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ async function onCommand(args, context) {
|
|||
}
|
||||
|
||||
function onMessage(message, context) {
|
||||
const regex = new RegExp(`^${config.usernamePrefix}${config.user.username}:?\\s+\\w+\\s+\\w+.*\\?`, 'i');
|
||||
const regex = new RegExp(`^${config.usernamePrefix}${config.user.username}:?\\s+[\\w\\p{P}]+\\s+[\\w, \\p{P}]+.*\\?`, 'i');
|
||||
|
||||
if (regex.test(message.body)) {
|
||||
onCommand([message.body.replaceAll(`${config.usernamePrefix}${config.user.username}:?`, '').trim()], context, false);
|
||||
|
|
Loading…
Reference in New Issue