Skip to content

Instantly share code, notes, and snippets.

@A-d-i-t-h-y-a-n
Last active September 22, 2023 10:54
Show Gist options
  • Save A-d-i-t-h-y-a-n/85a04cc67066af648debe1af546f5699 to your computer and use it in GitHub Desktop.
Save A-d-i-t-h-y-a-n/85a04cc67066af648debe1af546f5699 to your computer and use it in GitHub Desktop.
// temporary mention audio for hermit-md
// Code Idea Credit for @souravk11
// audio list credit for my friends
const {AUDIO_DATA,SUDO} = require('../config');
const {Function,getBuffer,toAudio,addAudioMetaData} = require('../lib/')
var audios = [ 'https://i.imgur.com/SBWolI2.mp4', 'https://i.imgur.com/lXE9t3L.mp4', 'https://i.imgur.com/ZyPPNWj.mp4', 'https://i.imgur.com/CHiH1Ok.mp4', 'https://i.imgur.com/vVUN1xe.mp4', 'https://i.imgur.com/prpHpHq.mp4', 'https://i.imgur.com/5pk2ruS.mp4', 'https://i.imgur.com/So9r6vw.mp4', 'https://i.imgur.com/RRUrN5y.mp4', 'https://i.imgur.com/t5eUhiE.mp4', 'https://i.imgur.com/XwbhbCH.mp4', 'https://i.imgur.com/hyFvt4W.mp4', 'https://i.imgur.com/c4oj86o.mp4', 'https://i.imgur.com/QMUvh09.mp4', 'https://i.imgur.com/Nx8dBjn.mp4', 'https://i.imgur.com/9QNKWMn.mp4', 'https://i.imgur.com/Rlv7O5h.mp4', 'https://i.imgur.com/Bni0cdc.mp4', 'https://i.imgur.com/2zNy69a.mp4', 'https://i.imgur.com/HHWRLEa.mp4', 'https://i.imgur.com/fK0DOJ9.mp4', 'https://i.imgur.com/zMkGLbZ.mp4', 'https://i.imgur.com/NeXRU7X.mp4', 'https://i.imgur.com/k5qtbzS.mp4', 'https://i.imgur.com/Akrcr9E.mp4', 'https://i.imgur.com/6ZfpymF.mp4', 'https://i.imgur.com/9BUXHmG.mp4', 'https://i.imgur.com/Xuf9UGx.mp4', 'https://i.imgur.com/mn87C4j.mp4', 'https://i.imgur.com/SqvKkfN.mp4', 'https://i.imgur.com/QlGimEG.mp4', 'https://i.imgur.com/QlGimEG.mp4', 'https://i.imgur.com/IPYQrD6.mp4', 'https://i.imgur.com/901twqT.mp4', 'https://i.imgur.com/d81mV8w.mp4', 'https://i.imgur.com/e4VHiYA.mp4', 'https://i.imgur.com/7spG05d.mp4', 'https://i.imgur.com/HmmDtii.mp4', 'https://i.imgur.com/PimvgR0.mp4', 'https://i.imgur.com/vypRYOT.mp4', 'https://i.imgur.com/0CnmJ5j.mp4', 'https://i.imgur.com/hVOMauX.mp4', 'https://i.imgur.com/q4XpvfS.mp4', 'https://i.imgur.com/VIgl1PH.mp4', 'https://i.imgur.com/s6DBUmb.mp4', 'https://i.imgur.com/jnu5ePG.mp4', 'https://i.imgur.com/A7pE40z.mp4', 'https://i.imgur.com/ZCUJYpj.mp4', 'https://i.imgur.com/pIojlNH.mp4', 'https://i.imgur.com/m4uSg0C.mp4', 'https://i.imgur.com/Y6O8bY0.mp4', 'https://i.imgur.com/j46pnex.mp4', 'https://i.imgur.com/lfjvAKn.mp4', 'https://i.imgur.com/p2Rzjnt.mp4', 'https://i.imgur.com/CHQqsuo.mp4', 'https://i.imgur.com/3EKNJK7.mp4', 'https://i.imgur.com/VeCyS1b.mp4', 'https://i.imgur.com/Z2WWoiq.mp4', 'https://i.imgur.com/ElpaPmr.mp4', 'https://i.imgur.com/4p21jVL.mp4', 'https://i.imgur.com/Z25JW0g.mp4', 'https://i.imgur.com/gkb9ooR.mp4', 'https://i.imgur.com/bzLrzrO.mp4', 'https://i.imgur.com/cOgGcak.mp4', 'https://i.imgur.com/PRJ3mSm.mp4', 'https://i.imgur.com/V6dnSAe.mp4', 'https://i.imgur.com/ILxdUaC.mp4', 'https://i.imgur.com/Lsz1Du7.mp4', 'https://i.imgur.com/RyvseEa.mp4', 'https://i.imgur.com/P3WY8nw.mp4']
Function({pattern: 'mention ?(.*)', fromMe: true,dontAddCommandList: true}, async (m, text) => {return m.reply('_Mention Audio Is Active_');});
Function({on: 'text' , fromMe: false}, async (m, match, client) => {
try {var men = m.mentionedJid[0].split('@')[0]} catch {return;}
if (m.mentionedJid && m.mentionedJid[0] && SUDO.includes(men)) {
const audio = audios[Math.floor(Math.random()*audios.length)]
const Audio = await getBuffer(audio)
let image = await getBuffer(AUDIO_DATA.split(';')[2])
let image_1 = await getBuffer('https://i.imgur.com/fj2WE83.jpeg')
let tumb = image || image_1
try { var res = await addAudioMetaData(await toAudio(Audio, 'mp4'), tumb, AUDIO_DATA.split(';')[0] || ' ', AUDIO_DATA.split(';')[1] || ' ', 'Hermit Official') } catch(e) { return await m.reply('Error on parsing audio \n\n' + audio + 'Remove this Url From Audio List'); }
return m.client.sendMessage(m.jid, { audio: Buffer.from(res.arrayBuffer), mimetype: 'audio/mpeg', ptt: true }, { quoted: m.data })}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment