Skip to content

Commit

Permalink
feat: Added replyAudio
Browse files Browse the repository at this point in the history
  • Loading branch information
Zastinian committed Nov 30, 2024
1 parent 2be5567 commit 0e5f0ed
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,25 @@ try {
: Buffer.alloc(0);
return await hedystia.sendMessage(jid, { audio: buffer, ptt, ...options }, { quoted });
};
hedystia.replyAudio = async (path, m, opts = {}) => {
const p = /^https?/.test(path) ? { url: path } : path;
return await hedystia.sendMessage(
opts.chat || m.chat,
{
audio: p,
fileName: opts.filename || `${Date.now}.mp3`,
ptt: opts.ptt || false,
mimetype: opts.ptt ? "audio/ogg; codecs=opus" : "audio/mpeg",
contextInfo: {
mentionedJid: opts.mentions || [m.sender],
},
},
{
quoted: m || m,
ephemeralExpiration: m.ephemeral || null,
},
);
};
hedystia.sendTextWithMentions = async (jid, text, quoted, options = {}) =>
hedystia.sendMessage(
jid,
Expand Down

0 comments on commit 0e5f0ed

Please sign in to comment.