Compare commits

..

No commits in common. "8f16112b2ed885d6f346fadd59a419d84edbb34e" and "3ed015b5841b7febe1dfc8af24c415e906274240" have entirely different histories.

3 changed files with 2 additions and 36 deletions

View File

@ -1,32 +0,0 @@
function expand(words, text) {
const letters = text.trim().toLowerCase().split("");
return letters.map((letter) => {
const wordsWithLetter = words.filter(i => i.match(RegExp(`^${letter}`, "i")));
const word = wordsWithLetter[Math.floor(Math.random() * wordsWithLetter.length)];
return word;
}).reduce((acc, cur) => acc + " " + cur);
}
module.exports = (words = []) => (ctx) => {
const message = ctx.message.text.replace(/^[^ ]+/, "");
if (message) {
return expand(words, message);
} else {
if (ctx.message.reply_to_message)
return expand(words, ctx.message.reply_to_message.text);
else
return "Need text to expand. Send /expand text or reply to a "
+ "message with /expand";
}
};

View File

@ -7,9 +7,9 @@ const absurdify = require("./absurdify");
const feedback = require("./feedback");
const media_wiki = require("./media_wiki");
const info = require("./info");
const expand = require("./expand");
module.exports = (bot, [ questions, kys, insults, commands_list, words ], feedback_id, axios) => {
module.exports = (bot, [ questions, kys, insults, commands_list, words ],
feedback_id, axios) => {
bot.command("question", (ctx) => ctx.reply(random(questions)()));
bot.command("word", (ctx) => ctx.reply(random(words)()));
@ -60,7 +60,6 @@ module.exports = (bot, [ questions, kys, insults, commands_list, words ], feedba
"https://wiki.archlinux.org/api.php")(ctx).then(x => ctx.reply(x,
{parse_mode: "HTML"})));
bot.command("info", (ctx) => ctx.reply(info()(ctx), {parse_mode: "Markdown"}));
bot.command("expand", (ctx) => ctx.reply(expand(words)(ctx)));
bot.command("start", (ctx) => ctx.reply("Hi, I am Quadnite. If you are "
+ "chatting with me in private, you are most likely doing it wrong. "
+ "Add me to a group for fun. To give feedback, use /feedback"));

View File

@ -21,4 +21,3 @@ should - Should <your question>
help - Need help? Go here
feedback - Send feedback, suggestion for kys, insult text
rate - Rate me on TGDR
expand - Expands a given abbreviation