Skip to content

Commit

Permalink
Fixed Audio issue vasani-arpit#307
Browse files Browse the repository at this point in the history
  • Loading branch information
Kashvigandhi committed Oct 26, 2023
1 parent 0caa952 commit d8a873d
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 4 deletions.
8 changes: 7 additions & 1 deletion bot.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@
"quoteMessageInReply": false
},
"bot": [{
"contains":["audio"],
"exact": [],
"response": "Sending audio",
"file": ["file_example_MP3_700KB.mp3","file_example_MP3_1MG.mp3"]
},
{
"contains": [],
"exact": ["hi"],
"response": "{hello|howdy}",
"response": ["hello","howdy"],
"webhook":""
},
{
Expand Down
Binary file added file_example_MP3_1MG.mp3
Binary file not shown.
Binary file added file_example_MP3_700KB.mp3
Binary file not shown.
33 changes: 33 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"cli-progress": "^2.1.1",
"mel-spintax": "^1.0.4",
"mime": "^2.4.4",
"mime-types": "^2.1.35",
"node-fetch": "^2.6.1",
"ora": "^3.0.0",
"puppeteer-core": "^13.6.0",
Expand Down
11 changes: 8 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,15 +237,19 @@ async function sendReply({ msg, client, data, noMatch }) {
return;
}


let response = await getResponse(msg, data.response);
console.log(`Replying with ${response}`);


let response = await getResponse(msg, data.response);
console.log(`Replying with ${response}`);


if (data.afterSeconds) {
await utils.delay(data.afterSeconds * 1000);
}


if (data.file) {

var captionStatus = data.responseAsCaption;

// We consider undefined responseAsCaption as a false
Expand Down Expand Up @@ -275,6 +279,7 @@ async function sendReply({ msg, client, data, noMatch }) {
}
}
function sendFile(file) {

if (captionStatus == true) {
utils
.getFileData(file)
Expand Down

0 comments on commit d8a873d

Please sign in to comment.