forked from tuhinpal/WhatsBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Client, Message } from "whatsapp-web.js"; | ||
|
||
//jshint esversion:8 | ||
const execute = async (_client: Client, msg: Message, args: string[]) => { | ||
if (msg.hasQuotedMsg) { | ||
args = (await msg.getQuotedMessage())?.body?.split(""); | ||
} | ||
if (!args.length) { | ||
return msg.reply("Please provide options!"); | ||
} | ||
msg.reply(args[Math.floor(Math.random() * args.length)]); | ||
}; | ||
|
||
export default { | ||
name: "Pick", //name of the module | ||
description: "Pick an option for you", // short description of what this command does | ||
command: "!pick", //command with prefix. Ex command: '!test' | ||
commandType: "plugin", // | ||
isDependent: false, //whether this command is related/dependent to some other command | ||
help: "Randomly pick an option.\n\n!flip [option1] [option2] [option3] etc.", // a string descring how to use this command Ex = help : 'To use this command type !test arguments' | ||
public: true, | ||
execute, | ||
}; |