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.
Cleanup, Module Bug Fixes, Changed file structure
- Loading branch information
Showing
37 changed files
with
1,940 additions
and
622 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,7 @@ session.json | |
.cache/ | ||
.env | ||
tempdata/*.json | ||
cache/* | ||
!cache/readme.txt | ||
public/* | ||
!public/readme.txt |
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
File renamed without changes.
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,21 +1,22 @@ | ||
//jshint esversion:8 | ||
const config = require('../config'); | ||
const pmpermit = require('../modules/pmpermit'); | ||
const config = require("../config"); | ||
const pmpermit = require("../helpers/pmpermit"); | ||
|
||
const execute = async (client,msg) => { | ||
if(config.pmpermit_enabled == "true" && !msg.to.includes("-")){ | ||
pmpermit.permitacton(msg.to.split("@")[0]); | ||
let chat = await msg.getChat(); | ||
await chat.unmute(true); | ||
msg.reply("Allowed for PM"); | ||
} | ||
const execute = async (client, msg) => { | ||
if (config.pmpermit_enabled == "true" && !msg.to.includes("-")) { | ||
await pmpermit.permit(msg.to.split("@")[0]); | ||
let chat = await msg.getChat(); | ||
await chat.unmute(true); | ||
msg.reply("Allowed for PM"); | ||
} | ||
}; | ||
|
||
module.exports = { | ||
name: 'Allow for PM', | ||
description: 'Allow personal messaging for a conatct', | ||
command: '!allow', | ||
commandType: 'admin', | ||
isDependent: false, | ||
help: `_You can allow him for pm by these commands_ 👇\n*!allow* - Allow an user for PM\n*!nopm* - Disallow an allowed user for PM`, // a string descring how to use this command Ex = help : 'To use this command type !test arguments' | ||
execute}; | ||
name: "Allow for PM", | ||
description: "Allow personal messaging for a conatct", | ||
command: "!allow", | ||
commandType: "admin", | ||
isDependent: false, | ||
help: `_You can allow him for pm by these commands_ 👇\n*!allow* - Allow an user for PM\n*!nopm* - Disallow an allowed user for PM`, // a string descring how to use this command Ex = help : 'To use this command type !test arguments' | ||
execute, | ||
}; |
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,14 +1,15 @@ | ||
//jshint esversion:8 | ||
const execute = async (client,msg) => { | ||
client.sendPresenceAvailable(); | ||
msg.reply("```" + "I will be online from now." + "```"); | ||
const execute = async (client, msg) => { | ||
client.sendPresenceAvailable(); | ||
msg.reply("```" + "I will be online from now." + "```"); | ||
}; | ||
|
||
module.exports = { | ||
name: 'Awake', | ||
description: 'marks user as online', | ||
command: '!awake', | ||
commandType: 'plugin', | ||
isDependent: false, | ||
help: undefined, | ||
execute}; | ||
name: "Awake", | ||
description: "Stay online always !", | ||
command: "!awake", | ||
commandType: "plugin", | ||
isDependent: false, | ||
help: undefined, | ||
execute, | ||
}; |
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,18 +1,16 @@ | ||
//jshint esversion:8 | ||
const execute = async (client,msg) => { | ||
if (!msg.to.includes("-")) { | ||
let chat = await msg.getChat(); | ||
let contact = await chat.getContact(); | ||
msg.reply("You have been Blocked"); | ||
contact.block(); | ||
} | ||
const execute = async (client, msg) => { | ||
if (!msg.to.includes("-")) { | ||
await (await msg.getContact()).block(); | ||
} | ||
}; | ||
|
||
module.exports = { | ||
name: 'Block', //name of the module | ||
description: 'Block current chat', // short description of what this command does | ||
command: '!block', //command with prefix. Ex command: '!test' | ||
commandType: 'admin', // | ||
isDependent: false, //whether this command is related/dependent to some other command | ||
help: 'Type !block in the chat to block the user', // a string descring how to use this command Ex = help : 'To use this command type !test arguments' | ||
execute}; | ||
name: "Block", //name of the module | ||
description: "Block current chat", // short description of what this command does | ||
command: "!block", //command with prefix. Ex command: '!test' | ||
commandType: "admin", // | ||
isDependent: false, //whether this command is related/dependent to some other command | ||
help: "Type !block in the chat to block the user", // a string descring how to use this command Ex = help : 'To use this command type !test arguments' | ||
execute, | ||
}; |
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,21 +1,22 @@ | ||
//jshint esversion:8 | ||
const config = require('../config'); | ||
const config = require("../config"); | ||
|
||
const execute = async (client,msg) => { | ||
if (!msg.to.includes("-")) { | ||
let chat = await msg.getChat(); | ||
let unmuteDate = new Date(); | ||
unmuteDate.setSeconds(Number(unmuteDate.getSeconds()) + Number(config.pmpermit_mutetime)); | ||
await chat.mute(unmuteDate); | ||
msg.reply(`You have been muted for ${config.pmpermit_mutetime / 60} Minutes`); | ||
} | ||
const execute = async (client, msg) => { | ||
if (!msg.to.includes("-")) { | ||
let chat = await msg.getChat(); | ||
let unmuteDate = new Date(); | ||
unmuteDate.setSeconds(Number(unmuteDate.getSeconds()) + 3600); | ||
await chat.mute(unmuteDate); | ||
msg.reply(`You have been muted for 1 hour`); | ||
} | ||
}; | ||
|
||
module.exports = { | ||
name: 'Mute', //name of the module | ||
description: 'mute the current chat', // short description of what this command does | ||
command: '!mute', //command with prefix. Ex command: '!test' | ||
commandType: 'admin', // | ||
isDependent: false, //whether this command is related/dependent to some other command | ||
help: `Type !mute in chat to mute the chat for ${config.pmpermit_mutetime / 60} Minutes. use !unmute to unmute the chat.`, // a string descring how to use this command Ex = help : 'To use this command type !test arguments' | ||
execute}; | ||
name: "Mute", //name of the module | ||
description: "mute the current chat", // short description of what this command does | ||
command: "!mute", //command with prefix. Ex command: '!test' | ||
commandType: "admin", // | ||
isDependent: false, //whether this command is related/dependent to some other command | ||
help: `Type !mute in chat to mute the chat for 1 hour. use !unmute to unmute the chat.`, // a string descring how to use this command Ex = help : 'To use this command type !test arguments' | ||
execute, | ||
}; |
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,20 +1,20 @@ | ||
//jshint esversion:8 | ||
const config = require('../config'); | ||
const pmpermit = require('../modules/pmpermit'); | ||
const config = require("../config"); | ||
const pmpermit = require("../helpers/pmpermit"); | ||
|
||
const execute = async (client,msg) => { | ||
if (config.pmpermit_enabled == "true" && !msg.to.includes("-")) { | ||
pmpermit.nopermitacton(msg.to.split("@")[0]); | ||
msg.reply("Not Allowed for PM"); | ||
} | ||
|
||
const execute = async (client, msg) => { | ||
if (config.pmpermit_enabled == "true" && !msg.to.includes("-")) { | ||
await pmpermit.nopermit(msg.to.split("@")[0]); | ||
msg.reply("Not Allowed for PM"); | ||
} | ||
}; | ||
|
||
module.exports = { | ||
name: 'Disallow PM', //name of the module | ||
description: 'Disallow an allowed user for Personal messaging', // short description of what this command does | ||
command: '!nopm', //command with prefix. Ex command: '!test' | ||
commandType: 'admin', // | ||
isDependent: false, //whether this command is related/dependent to some other command | ||
help: 'Type !nopm in the chat to execute.', // a string descring how to use this command Ex = help : 'To use this command type !test arguments' | ||
execute}; | ||
name: "Disallow PM", //name of the module | ||
description: "Disallow an allowed user for Personal messaging", // short description of what this command does | ||
command: "!nopm", //command with prefix. Ex command: '!test' | ||
commandType: "admin", // | ||
isDependent: false, //whether this command is related/dependent to some other command | ||
help: "Type !nopm in the chat to execute.", // a string descring how to use this command Ex = help : 'To use this command type !test arguments' | ||
execute, | ||
}; |
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,22 +1,26 @@ | ||
//jshint esversion:8 | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const {search} = require('../modules/song'); | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
const { search } = require("../helpers/song"); | ||
|
||
const execute = async (client,msg,args) => { | ||
msg.delete(true); | ||
let getdata = await search(args.join(' ')); | ||
let sendmessage = await client.sendMessage(msg.to, getdata.content); // have to grab the message ID | ||
if (getdata.status) { | ||
fs.writeFileSync(path.join(__dirname,`../tempdata/song~${sendmessage.id.id}.json`), JSON.stringify(getdata.songarray)); | ||
} | ||
const execute = async (client, msg, args) => { | ||
msg.delete(true); | ||
let getdata = await search(args.join(" ")); | ||
let sendmessage = await client.sendMessage(msg.to, getdata.content); // have to grab the message ID | ||
if (getdata.status) { | ||
fs.writeFileSync( | ||
path.join(__dirname, `../cache/song~${sendmessage.id.id}.json`), | ||
JSON.stringify(getdata.songarray) | ||
); | ||
} | ||
}; | ||
|
||
module.exports = { | ||
name: 'Search Song', | ||
description: 'Search songs on jiosaavn', | ||
command: '!song', | ||
commandType: 'plugin', | ||
isDependent: false, | ||
help: `*Song*\n\nSearch a song and download it. \n\n*!song [search-query]*\nEx: !song makhna\n\nThen replay the message with *!dldsong [id]*\nEx. !dldsong 1\n\n⚡ Powered by musicder.net`, | ||
execute}; | ||
name: "Search Song", | ||
description: "Search songs on jiosaavn", | ||
command: "!song", | ||
commandType: "plugin", | ||
isDependent: false, | ||
help: `*Song*\n\nSearch a song and download it. \n\n*!song [search-query]*\nEx: !song makhna\n\nThen replay the message with *!dldsong [id]*\nEx. !dldsong 1\n\n⚡ Powered by musicder.net`, | ||
execute, | ||
}; |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.