Simp-O-Matic

Dumb Discord bot in TS.
git clone git://git.knutsen.co/Simp-O-Matic
Log | Files | Refs | README | LICENSE

commit 9599afd0368811a186b63b991d135ee20ebff5d5
parent a5cbe4410f54b2ab2191bc01c76c6c501cb10c62
Author: Demonstrandum <moi@knutsen.co>
Date:   Thu, 19 Mar 2020 16:35:12 +0000

One command per entry in HELP.md.

Diffstat:
MHELP.md | 3++-
Mlib/commands/boomer.ts | 2++
Mlib/commands/clap.ts | 5++---
Mlib/commands/kiss.ts | 2+-
Mlib/commands/youtube.ts | 4+++-
Alib/rule.ts | 0
6 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/HELP.md b/HELP.md @@ -79,7 +79,8 @@ - `!weather <location>` — gives you the weather in a certain location, if location is left blank, it will either give you the weather in the default location, or in the area you `set` previously. - `!say [phrase]` — Repeats what you told it to say. - `!milkies` — In case you're feeling thirsty... -- `!{cowsay,cowthink} <options> [phrase]` — Make a cow say something, using Unix-like command-line arguments. +- `!cowsay <options> [phrase]` — Make a cow say something, using Unix-like command-line arguments. +- `!cowthink <options> [phrase]` — Make a cow say something, using Unix-like command-line arguments. - `!figlet <options> [phrase]` — Print text in ASCII format, using Unix-like command-line arguments. - `!roll <upper-bound>` — Roll a dice, default upper bound is 6. - `!8ball` — Ask a question, receive a response. diff --git a/lib/commands/boomer.ts b/lib/commands/boomer.ts @@ -1,3 +1,5 @@ +// From here: https://github.com/Demonstrandum/boomer/blob/master/boomerfy.js + declare global { interface Array<T> { demented_join(sep: string, sep_alt: string, prob: number): string; diff --git a/lib/commands/clap.ts b/lib/commands/clap.ts @@ -1,4 +1,4 @@ export default home_scope => { const { message, args } = home_scope; - message.channel.send(args.join('👏')); -}- \ No newline at end of file + message.channel.send(args.join(' 👏 ') + '👏'); +}; diff --git a/lib/commands/kiss.ts b/lib/commands/kiss.ts @@ -11,7 +11,7 @@ export default home_scope => { const author = message.author.username; const to = message.mentions.users.first().username; - + const images = [ "https://i.imgur.com/a5rkTna.gif", "https://i.imgur.com/AnYC2Xi.gif", diff --git a/lib/commands/youtube.ts b/lib/commands/youtube.ts @@ -1,7 +1,9 @@ import yt_search from '../api/yt_scrape'; export default home_scope => { const { message, args } = home_scope; - const query = args.join(' '); + const query = args.join(' ').trim(); + if (query.length === 0 || args.length === 0) + return message.answer('Well, what should I search for?'); yt_search({ query }) .then(message.reply.bind(message)) .catch(message.answer.bind(message)); diff --git a/lib/rule.ts b/lib/rule.ts