Compare commits
No commits in common. "dc6df7c344b554dce8f981cf00faea505a863af9" and "dda9ba81ae43c2add664183eef7b1cafb99685c5" have entirely different histories.
dc6df7c344
...
dda9ba81ae
|
@ -21,7 +21,7 @@ module.exports = {
|
||||||
greeting: 'Hi, I am aisha, your game host!',
|
greeting: 'Hi, I am aisha, your game host!',
|
||||||
usernamePrefix: '@',
|
usernamePrefix: '@',
|
||||||
channels: ['GamesNight'],
|
channels: ['GamesNight'],
|
||||||
games: ['mash', 'trivia', 'letters', 'duck', '8ball', 'riddle', 'dice', 'rock-paper-scissors', 'ping', 'say', 'kill', 'uptime', 'help'],
|
games: ['mash', 'trivia', 'letters', 'duck', '8ball', 'dice', 'rock-paper-scissors', 'ping', 'say', 'kill', 'uptime', 'help'],
|
||||||
schatColors: {
|
schatColors: {
|
||||||
white: 'white',
|
white: 'white',
|
||||||
blue: 'var(--message-40)',
|
blue: 'var(--message-40)',
|
||||||
|
|
|
@ -9,10 +9,8 @@ const style = require('../utils/style');
|
||||||
|
|
||||||
const contemplations = [
|
const contemplations = [
|
||||||
'Hmmm...',
|
'Hmmm...',
|
||||||
'Let me see...',
|
|
||||||
'Let me give that some thought',
|
|
||||||
'🤔',
|
'🤔',
|
||||||
'💭',
|
'Let\'s see...',
|
||||||
];
|
];
|
||||||
|
|
||||||
const answersByType = {
|
const answersByType = {
|
||||||
|
@ -58,7 +56,7 @@ function purgeQuestions() {
|
||||||
async function onCommand(args, context) {
|
async function onCommand(args, context) {
|
||||||
const question = args.join(' ');
|
const question = args.join(' ');
|
||||||
|
|
||||||
if (!/[\w\p{P}]+\s+[\w\p{P}]+\?/u.test(question)) {
|
if (!/\w+\s+\w+\?/.test(question)) {
|
||||||
context.sendMessage('Please ask me a question, any question...', context.room.id);
|
context.sendMessage('Please ask me a question, any question...', context.room.id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -95,7 +93,7 @@ async function onCommand(args, context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onMessage(message, context) {
|
function onMessage(message, context) {
|
||||||
const regex = new RegExp(`^${config.usernamePrefix}${config.user.username}[\\s\\p{P}]*\\s+[\\w\\p{P}]+\\s+[\\w, \\p{P}]+.*\\?`, 'ui');
|
const regex = new RegExp(`^${config.usernamePrefix}${config.user.username}:?\\s+\\w+\\s+\\w+.*\\?`, 'i');
|
||||||
|
|
||||||
if (regex.test(message.body)) {
|
if (regex.test(message.body)) {
|
||||||
onCommand([message.body.replaceAll(`${config.usernamePrefix}${config.user.username}:?`, '').trim()], context, false);
|
onCommand([message.body.replaceAll(`${config.usernamePrefix}${config.user.username}:?`, '').trim()], context, false);
|
||||||
|
|
|
@ -122,7 +122,7 @@ function pickLetters(type, context) {
|
||||||
context.sendMessage(`${getBoard(context)} Would you like a consonant or a vowel?`, context.room.id);
|
context.sendMessage(`${getBoard(context)} Would you like a consonant or a vowel?`, context.room.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
function start(context, letters) {
|
function start(context) {
|
||||||
if (games.has(context.room.id)) {
|
if (games.has(context.room.id)) {
|
||||||
context.sendMessage(`${getBoard(context)} This is the current board. Use ${config.prefix}letters:stop to reset.`, context.room.id);
|
context.sendMessage(`${getBoard(context)} This is the current board. Use ${config.prefix}letters:stop to reset.`, context.room.id);
|
||||||
return;
|
return;
|
||||||
|
@ -136,11 +136,6 @@ function start(context, letters) {
|
||||||
ac: new AbortController(), // eslint-disable-line no-undef
|
ac: new AbortController(), // eslint-disable-line no-undef
|
||||||
});
|
});
|
||||||
|
|
||||||
if (letters) {
|
|
||||||
pickLetters(letters.toLowerCase(), context);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
context.sendMessage('Let\'s play the letters! Would you like a consonant or a vowel?', context.room.id);
|
context.sendMessage('Let\'s play the letters! Would you like a consonant or a vowel?', context.room.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,11 +145,6 @@ function onCommand(args, context) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (['start', 'go', 'auto', 'random'].includes(context.subcommand)) {
|
|
||||||
start(context, Array.from({ length: config.letters.length }, () => (Math.random() < 0.55 ? 'c' : 'v')).join('')); // a slight bias towards consonants seems to give better boards
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!context.subcommand) {
|
if (!context.subcommand) {
|
||||||
start(context);
|
start(context);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue