Giter VIP home page Giter VIP logo
		(!message.reply_message.audio && !message.reply_message.video)
	)
		return await message.send('*Reply to audio or video*')
	const p = await message.reply_message.downloadAndSaveMediaMessage('find')
	const data = await audioCut(p, 0, 15)
	const current_data = new Date()
	const timestamp = current_data.getTime() / 1000
	const stringToSign = buildStringToSign(
		'POST',
		options.endpoint,
		options.access_key,
		options.data_type,
		options.signature_version,
		timestamp
	)

	const signature = sign(stringToSign, options.access_secret)

	const form = new FormData()
	form.append('sample', data)
	form.append('sample_bytes', data.length)
	form.append('access_key', options.access_key)
	form.append('data_type', options.data_type)
	form.append('signature_version', options.signature_version)
	form.append('signature', signature)
	form.append('timestamp', timestamp)

	const res = await fetch('http://' + options.host + options.endpoint, {
		method: 'POST',
		body: form,
	})
	const { status, metadata } = await res.json()
	if (status.msg != 'Success')
		return await message.send(status.msg, { quoted: message.data })
	const { album, release_date, artists, title } = metadata.music[0]
	await message.send(
		`*Title :* ${title}

Album : ${album.name || ''} Artists : ${ artists !== undefined ? artists.map((v) => v.name).join(', ') : '' } Release Date : ${release_date}`, { quoted: message.quoted } ) }

midhunxlokixser's Projects

hermit-md icon hermit-md

Hermit-md - Simple whatsapp Multi Device bot based on @adiwajshing/baileys

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.