Added help commands.

This commit is contained in:
2022-10-22 01:23:11 +02:00
parent 73646482c9
commit cd133bb8bc
9 changed files with 63 additions and 16 deletions

View File

@@ -32,7 +32,7 @@ function launchDuck(context) {
function onCommand(args, context) {
const duck = ducks.get(context.room.id);
if (!duck && context.command === 'bang') {
if (!duck && ['bang', 'shoot'].includes(context.command)) {
const message = pickRandom([
`There is no duck, what are you shooting at, ${context.user.prefixedUsername}?!`,
`You're wasting bullets, ${context.user.prefixedUsername}, there is no duck!`,
@@ -58,7 +58,7 @@ function onCommand(args, context) {
const hit = Math.random() > config.duck.missRatio;
const time = ((new Date().getTime() - duck.getTime()) / 1000).toFixed(3);
if (context.command === 'bang') {
if (['bang', 'shoot'].includes(context.command)) {
if (hit) {
context.sendMessage(`You shot a duck in ${style.bold(`${time} seconds`)}, ${context.user.prefixedUsername}`, context.room.id);
launchDuck(context);
@@ -83,7 +83,7 @@ function onCommand(args, context) {
if (['bef', 'befriend'].includes(context.command)) {
if (hit) {
context.sendMessage(`You befriended a duck in ${style.bold(`${time} seconds`)}, ${context.user.prefixedUsername}`, context.room.id);
context.sendMessage(`You befriended a duck in ${style.bold(style.green(`${time} seconds`))}, ${context.user.prefixedUsername}`, context.room.id);
launchDuck(context);
context.setPoints(context.user, 1, { key: 'befriend' });
@@ -104,7 +104,8 @@ function onCommand(args, context) {
module.exports = {
name: 'Duck',
commands: ['bang', 'bef', 'befriend'],
commands: ['bang', 'shoot', 'bef', 'befriend'],
help: `There are ducks on the loose! When you see one, you can be nice and ${config.prefix}befriend them, or... ${config.prefix}bang`,
onStart: launchDuck,
onCommand,
};