Compare commits
No commits in common. "1843a5b5b33ed017506040274854f3459adc995a" and "7640fae9d8ddf6dbc113c267ccd4dcfb7df05ea9" have entirely different histories.
1843a5b5b3
...
7640fae9d8
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "schat2-clive",
|
"name": "schat2-clive",
|
||||||
"version": "1.5.12",
|
"version": "1.5.11",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "schat2-clive",
|
"name": "schat2-clive",
|
||||||
"version": "1.5.12",
|
"version": "1.5.11",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bhttp": "^1.2.8",
|
"bhttp": "^1.2.8",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "schat2-clive",
|
"name": "schat2-clive",
|
||||||
"version": "1.5.12",
|
"version": "1.5.11",
|
||||||
"description": "Game host for SChat 2-powered chat sites",
|
"description": "Game host for SChat 2-powered chat sites",
|
||||||
"main": "src/app.js",
|
"main": "src/app.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -135,8 +135,7 @@ function onLeave(data, bot) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onMessage(message, bot, games) {
|
function onMessage(message, bot, games) {
|
||||||
const body = message.originalBody || message.body;
|
const [, command, subcommand] = message.body?.match(new RegExp(`^${config.prefix}(\\w+)(?:\\:(\\w+))?`)) || [];
|
||||||
const [, command, subcommand] = body?.match(new RegExp(`^${config.prefix}(\\w+)(?:\\:(\\w+))?`)) || [];
|
|
||||||
const user = bot.users[message.userId] || message.user;
|
const user = bot.users[message.userId] || message.user;
|
||||||
const room = bot.rooms[message.roomId];
|
const room = bot.rooms[message.roomId];
|
||||||
|
|
||||||
|
@ -151,7 +150,7 @@ function onMessage(message, bot, games) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command) {
|
if (command) {
|
||||||
const args = body.split(/\s+/).slice(1);
|
const args = message.body.split(/\s+/).slice(1);
|
||||||
const game = games[command];
|
const game = games[command];
|
||||||
|
|
||||||
if (game && game.onCommand) {
|
if (game && game.onCommand) {
|
||||||
|
|
|
@ -172,7 +172,7 @@ async function onMessage(message, context) {
|
||||||
|
|
||||||
const { answer } = game.questions[game.round];
|
const { answer } = game.questions[game.round];
|
||||||
|
|
||||||
if (new RegExp(answer, 'i').test(decode(message.originalBody || message.body))) { // resolve HTML entities in case original body is not available, such as & to &
|
if (new RegExp(answer, 'i').test(decode(message.body))) { // resolve HTML entities, such as & to &
|
||||||
game.answers.push({
|
game.answers.push({
|
||||||
user: context.user,
|
user: context.user,
|
||||||
answer: message.body,
|
answer: message.body,
|
||||||
|
|
Loading…
Reference in New Issue