commit 117940887cf2c5d4134aa1849f37c329f9bb5967
parent c24c33d908e4322c9e9e781088463ba63d1f5149
Author: Demonstrandum <moi@knutsen.co>
Date: Fri, 20 Mar 2020 01:12:07 +0000
Added some defaults.
Diffstat:
5 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/HELP.md b/HELP.md
@@ -80,7 +80,7 @@
- `!say [phrase]` — Repeats what you told it to say.
- `!milkies` — In case you're feeling thirsty...
- `!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.
+- `!cowthink <options> [phrase]` — Make a cow think 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/choose.ts b/lib/commands/choose.ts
@@ -1,5 +1,7 @@
export default home_scope => {
const { message, args } = home_scope;
- const a = args.join(' ').split(/\s*(?:,|or)\s*/);
+ const a = args.length
+ ? args.join(' ').split(/\s*(?:,|or)\s*/)
+ : ['I need a list.'];
message.answer(a[Math.floor(Math.random() * a.length)]);
};
diff --git a/lib/commands/cowsay.ts b/lib/commands/cowsay.ts
@@ -1,6 +1,9 @@
import { execFileSync as exec_file_sync } from 'child_process';
+
export default home_scope => {
- const { message, args } = home_scope;
+ let { message, args } = home_scope;
+ if (args.length === 0)
+ args = ['-d', 'Prope finem.'];
// This is safe because no shell is spawned:
message.answer(exec_file_sync('./node_modules/.bin/cowsay', args, {
encoding: 'utf8',
diff --git a/lib/commands/cowthink.ts b/lib/commands/cowthink.ts
@@ -1,6 +1,9 @@
import { execFileSync as exec_file_sync } from 'child_process';
+
export default home_scope => {
- const { message, args } = home_scope;
+ let { message, args } = home_scope;
+ if (args.length === 0)
+ args = ['-f', 'milk', 'Cogito, ergo sum.'];
// This is safe because no shell is spawned:
message.answer(exec_file_sync('./node_modules/.bin/cowthink', args, {
encoding: 'utf8',
diff --git a/lib/commands/figlet.ts b/lib/commands/figlet.ts
@@ -1,6 +1,8 @@
import { execFileSync as exec_file_sync } from 'child_process';
export default home_scope => {
- const { message, args } = home_scope;
+ let { message, args } = home_scope;
+ if (args.length === 0)
+ args = ['-f', 'Train', 'Simp'];
// This is safe because no shell is spawned:
message.answer(exec_file_sync('./node_modules/.bin/figlet', args, {
encoding: 'utf8',