Curated Geo country file, improved hint letter spacing.
This commit is contained in:
@@ -19,20 +19,12 @@ const questions = [
|
||||
|
||||
function hint(game, context) {
|
||||
if (game.name.length >= 5) {
|
||||
context.sendMessage(`${style.bold(game.name
|
||||
.split('')
|
||||
.map((letter, index) => (index === 0 || index === game.name.length - 1 ? letter : '_'))
|
||||
.join(' ')
|
||||
.toUpperCase())}, the country code is ${style.bold(game.alpha2)}`, context.room.id);
|
||||
context.sendMessage(`${style.bold(`${game.name.slice(0, 1)} ${game.name.slice(1, -1).replace(/\s/g, ' ').replace(/[^\s]/g, '_ ')}${game.name.slice(-1)}`.toUpperCase())}, the country code s ${style.bold(game.alpha2)}`, context.room.id); // eslint-disable-line no-irregular-whitespace
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
context.sendMessage(`${style.bold(game.name
|
||||
.split('')
|
||||
.map((letter, index) => (index === 0 ? letter : '_'))
|
||||
.join(' ')
|
||||
.toUpperCase())}, the country code is ${style.bold(game.alpha2)}`, context.room.id);
|
||||
context.sendMessage(`${style.bold(`${game.name.slice(0, 1)} ${game.name.slice(1).replace(/\s/g, ' ').replace(/[^\s]/g, '_ ').trim()}`.toUpperCase())}, the country code is ${style.bold(game.alpha2)}`, context.room.id); // eslint-disable-line no-irregular-whitespace
|
||||
}
|
||||
|
||||
function play(context) {
|
||||
@@ -42,7 +34,7 @@ function play(context) {
|
||||
games.set(context.room.id, {
|
||||
...country,
|
||||
url,
|
||||
regexp: new RegExp(country.name, 'i'),
|
||||
regexp: new RegExp(country.fullName ? `(${country.name})|(${country.fullName})` : country.name, 'i'),
|
||||
});
|
||||
|
||||
context.sendMessage(`${url} ${pickRandom(questions)}`, context.room.id);
|
||||
@@ -59,7 +51,7 @@ async function onCommand(args, context) {
|
||||
const game = games.get(context.room.id);
|
||||
|
||||
games.delete(context.room.id);
|
||||
context.sendMessage(`Geo was skipped by ${context.user.prefixedUsername}. The country was ${style.bold(game.name)}.`, context.room.id);
|
||||
context.sendMessage(`Geo was skipped by ${context.user.prefixedUsername}. The country was ${style.bold(game.fullName ? `${game.fullName} (${game.name})` : game.name)}.`, context.room.id);
|
||||
|
||||
await timers.setTimeout(2000);
|
||||
}
|
||||
@@ -87,7 +79,7 @@ async function onMessage(message, context) {
|
||||
}
|
||||
|
||||
if (game.regexp.test(message.body)) {
|
||||
context.sendMessage(`${style.answer(game.name)} is the right answer! ${style.username(context.user.prefixedUsername)} gets a point.`, context.room.id);
|
||||
context.sendMessage(`${style.answer(game.fullName || game.name)} is the right answer! ${style.username(context.user.prefixedUsername)} gets a point.`, context.room.id);
|
||||
context.setPoints(context.user);
|
||||
|
||||
games.delete(context.room.id);
|
||||
|
||||
Reference in New Issue
Block a user