forked from Prince-Mendiratta/BotsApp
-
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.
Signed-off-by: Prince Mendiratta <prince.mendi@gmail.com>
- Loading branch information
1 parent
4bc315c
commit 0bad2b9
Showing
6 changed files
with
74 additions
and
10 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
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,41 @@ | ||
const { MessageType } = require("@adiwajshing/baileys"); | ||
const Strings = require("../lib/db"); | ||
const format = require('python-format-js'); | ||
const config = require('../config') | ||
const HELP = Strings.help | ||
|
||
module.exports = { | ||
name: "help", | ||
description: HELP.DESCRIPTION, | ||
extendedDescription: HELP.EXTENDED_DESCRIPTION, | ||
async handle(client, chat, BotsApp, args, commandHandler){ | ||
var prefixes = /\/\^\[(.*)+\]\/\g/g.exec(config.PREFIX)[1]; | ||
console.log("arguments -> "); | ||
if(!args[0]){ | ||
console.log("Inside loop.") | ||
var helpMessage = HELP.HEAD; | ||
commandHandler.forEach(element => { | ||
helpMessage += HELP.TEMPLATE.format(prefixes[0] + element.name, element.description); | ||
}); | ||
client.sendMessage(BotsApp.chatId, helpMessage, MessageType.text); | ||
return; | ||
} | ||
var helpMessage = HELP.COMMAND_INTERFACE; | ||
var command = commandHandler.get(args[0]); | ||
if(command){ | ||
var triggers = " | " | ||
prefixes.split("").forEach(prefix => { | ||
triggers += prefix + command.name + " | " | ||
}); | ||
helpMessage += HELP.COMMAND_INTERFACE_TEMPLATE.format(triggers, command.extendedDescription); | ||
const buttonMessage = { | ||
contentText: helpMessage, | ||
buttons: [{buttonId: 'id1', buttonText: {displayText: '.alive'}, type: 1}], | ||
headerType: 1 | ||
} | ||
client.sendMessage(BotsApp.chatId, buttonMessage, MessageType.buttonsMessage); | ||
return; | ||
} | ||
client.sendMessage(BotsApp.chatId, HELP.COMMAND_INTERFACE + "*Invalid Command. Check the correct name from* ```.help``` *command list.* ", MessageType.text); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,12 +1,13 @@ | ||
const { MessageType } = require("@adiwajshing/baileys") | ||
const Strings = require("../lib/db") | ||
const ID = Strings.add | ||
const format = require('python-format-js'); | ||
const alive = Strings.alive | ||
|
||
module.exports = { | ||
name: "alive", | ||
description: ID.DESCRIPTION, | ||
extendedDescription: ID.EXTENDED_DESCRIPTION, | ||
description: alive.DESCRIPTION, | ||
extendedDescription: alive.EXTENDED_DESCRIPTION, | ||
async handle(client, chat, BotsApp, args){ | ||
client.sendMessage(BotsApp.from, ID.EXTENDED_DESCRIPTION, MessageType.text); | ||
client.sendMessage(BotsApp.chatId, alive.ALIVE_MSG.format("Prince"), MessageType.text); | ||
} | ||
} |
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