mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-25 06:42:51 +02:00
force two vowels in anagrams
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
const Command = require('../../structures/Command');
|
const Command = require('../../structures/Command');
|
||||||
const { stripIndents } = require('common-tags');
|
const { stripIndents } = require('common-tags');
|
||||||
const request = require('node-superfetch');
|
const request = require('node-superfetch');
|
||||||
const { reactIfAble, fetchHSUserDisplay } = require('../../util/Util');
|
const { shuffle, reactIfAble, fetchHSUserDisplay } = require('../../util/Util');
|
||||||
const scores = require('../../assets/json/anagramica');
|
const scores = require('../../assets/json/anagramica');
|
||||||
const pool = 'abcdefghijklmnopqrstuvwxyz'.split('');
|
const pool = 'abcdefghijklmnopqrstuvwxyz'.split('');
|
||||||
|
const vowels = ['a', 'e', 'i', 'o', 'u', 'y'];
|
||||||
const { SUCCESS_EMOJI_ID, FAILURE_EMOJI_ID } = process.env;
|
const { SUCCESS_EMOJI_ID, FAILURE_EMOJI_ID } = process.env;
|
||||||
|
|
||||||
module.exports = class AnagramicaCommand extends Command {
|
module.exports = class AnagramicaCommand extends Command {
|
||||||
@@ -100,9 +101,11 @@ module.exports = class AnagramicaCommand extends Command {
|
|||||||
|
|
||||||
async fetchList() {
|
async fetchList() {
|
||||||
const letters = [];
|
const letters = [];
|
||||||
for (let i = 0; i < 10; i++) letters.push(pool[Math.floor(Math.random() * pool.length)]);
|
letters.push(vowels[Math.floor(Math.random() * vowels.length)]);
|
||||||
|
letters.push(vowels[Math.floor(Math.random() * vowels.length)]);
|
||||||
|
for (let i = 0; i < 8; i++) letters.push(pool[Math.floor(Math.random() * pool.length)]);
|
||||||
const { body } = await request.get(`http://www.anagramica.com/all/${letters.join('')}`);
|
const { body } = await request.get(`http://www.anagramica.com/all/${letters.join('')}`);
|
||||||
return { valid: body.all, letters };
|
return { valid: body.all, letters: shuffle(letters) };
|
||||||
}
|
}
|
||||||
|
|
||||||
getScore(letters, word) {
|
getScore(letters, word) {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "126.5.0",
|
"version": "126.5.1",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user