-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* improved * improved * fix * let's hope it works * Update img-wallpaper.js * Update package.json
- Loading branch information
Showing
6 changed files
with
120 additions
and
85 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
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,11 +1,31 @@ | ||
import fetch from 'node-fetch'; | ||
|
||
let handler = async (m, { conn, text, usedPrefix, command }) => { | ||
if (!text) throw `*This command generates image from texts*\n\n*ββ π΄xample usage*\n*β ${usedPrefix + command} Netaji subhas bose*\n*β ${usedPrefix + command} hatsune miku best*` | ||
try { | ||
m.reply('*Processing image *') | ||
let tiores = await conn.getFile(`https://api.lolhuman.xyz/api/dall-e?apikey=${lolkeysapi}&text=${text}`) | ||
await conn.sendFile(m.chat, tiores.data, null, null, m) | ||
} catch { | ||
throw `*INTERNAL ERROR*` | ||
}} | ||
handler.command = ['ai2', 'dalle', 'gen', 'gimg', 'openai2'] | ||
export default handler | ||
if (!text) throw `*This command generates image from texts*\n\n*π΄xample usage*\n*β ${usedPrefix + command} Beautiful animegirl*\n*β ${usedPrefix + command} elon musk in pink output*`; | ||
|
||
try { | ||
m.reply('*Please wait, generating images...*'); | ||
|
||
const response = await fetch(`https://gurugpt4-85987f3ed9b3.herokuapp.com/api/imgai?prompt=${encodeURIComponent(text)}&count=2`); | ||
const data = await response.json(); | ||
|
||
|
||
if (data.images && Array.isArray(data.images)) { | ||
|
||
for (const image of data.images) { | ||
const imageResponse = await fetch(image.url); | ||
const imageBuffer = await imageResponse.buffer(); | ||
|
||
|
||
await conn.sendFile(m.chat, imageBuffer, null, null, m); | ||
} | ||
} else { | ||
throw '*Image generation failed*'; | ||
} | ||
} catch { | ||
throw '*Oops! Something went wrong while generating images. Please try again later.*'; | ||
} | ||
}; | ||
|
||
handler.command = ['ai2', 'dalle', 'gen', 'gimg', 'openai2']; | ||
export default handler; |
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,39 +1,31 @@ | ||
import { tiktokdl } from '@bochilteam/scraper'; | ||
|
||
import fg from 'api-dylux' | ||
import { tiktokdl, tiktokdlv2, tiktokdlv3 } from '@bochilteam/scraper' | ||
let handler = async (m, { conn, text, args, usedPrefix, command }) => { | ||
if (!args[0]) throw `β³οΈ Enter a TikTok link\n\nπ Example: ${usedPrefix + command} https://vm.tiktok.com/ZMYG92bUh/`; | ||
if (!args[0].match(/tiktok/gi)) throw `β Verify that the link is from TikTok`; | ||
|
||
let handler = async (m, { conn, text, args, usedPrefix, command}) => { | ||
if (!args[0]) throw `β³οΈ Enter a Tiktok link\n\n π Example : ${usedPrefix + command} https://vm.tiktok.com/ZMNqyusVD/?k=1` | ||
if (!args[0].match(/tiktok/gi)) throw `β verify that the link is from tiktok` | ||
m.react(rwait) | ||
try { | ||
const { author: { nickname }, video, description } = await tiktokdl(args[0]); | ||
const url = video.no_watermark || video.no_watermark2 || video.no_watermark_raw; | ||
if (!url) throw 'β Error downloading the video'; | ||
|
||
try { | ||
let p = await fg.tiktok(args[0]) | ||
let te = ` | ||
|
||
conn.sendFile(m.chat, url, 'tiktok.mp4', ` | ||
βββ· TIKTOK | ||
β’ *Username:* ${p.unique_id} | ||
β’ *Description:* ${p.title} | ||
β’ *Duration:* ${p.duration} | ||
ββββββββββββ` | ||
conn.sendFile(m.chat, p.play, 'tiktok.mp4', te, m) | ||
m.react(done) | ||
} catch { | ||
const { author: { nickname }, video, description } = await tiktokdl(args[0]) | ||
.catch(async _ => await tiktokdlv2(args[0])) | ||
.catch(async _ => await tiktokdlv3(args[0])) | ||
const url = video.no_watermark2 || video.no_watermark || 'https://tikcdn.net' + video.no_watermark_raw || video.no_watermark_hd | ||
if (!url) throw 'β Error downloading the video' | ||
conn.sendFile(m.chat, url, 'fb.mp4', ` | ||
βββ· *TIKTOK DL* | ||
β’ *Username:* ${nickname} ${description ? `\nβ’ *Description:* ${description}` : ''} | ||
ββββββββββββ`, m) | ||
m.react(done) | ||
} | ||
|
||
} | ||
handler.help = ['tiktok'] | ||
handler.tags = ['dl'] | ||
handler.command = /^(tiktok|ttdl|tiktokdl|tiktoknowm)$/i | ||
handler.diamond = true | ||
|
||
export default handler | ||
β’ *Nickname:* ${nickname} ${description ? `\nβ’ *Description:* ${description}` : ''} | ||
ββββββββββββ`, m); | ||
} catch (error) { | ||
// Log the error | ||
console.error('Error downloading TikTok video:', args[0], error); | ||
|
||
m.reply(`β Error downloading the video`); | ||
} | ||
}; | ||
|
||
handler.help = ['tiktok']; | ||
handler.tags = ['dl']; | ||
handler.command = /^(tiktok|ttdl|tiktokdl|tiktoknowm)$/i; | ||
|
||
|
||
export default handler; |
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,24 +1,36 @@ | ||
import { youtubedl, youtubedlv2, youtubedlv3 } from '@bochilteam/scraper' | ||
import fetch from 'node-fetch' | ||
let handler = async (m, { conn, args }) => { | ||
if (!args[0]) throw '*[βπππ πβ] SEARCH YOUTUBE / YOUTUBE π»πΈπ½πΊ*' | ||
await m.reply(`*_β³processing α΄α΄α΄ Ιͺα΄...β³_*\n\n*β command #playdoc α΄ #play.2 α΄ #ytmp4doc β*`) | ||
try { | ||
let q = '128kbps' | ||
let v = args[0] | ||
const yt = await youtubedl(v).catch(async _ => await youtubedlv2(v)).catch(async _ => await youtubedlv3(v)) | ||
const dl_url = await yt.audio[q].download() | ||
const ttl = await yt.title | ||
const size = await yt.audio[q].fileSizeH | ||
await conn.sendFile(m.chat, dl_url, ttl + '.mp3', null, m, false, { mimetype: 'audio/mp4' }) | ||
} catch { | ||
try { | ||
let lolhuman = await fetch(`https://api.lolhuman.xyz/api/ytaudio2?apikey=${lolkeysapi}&url=${args[0]}`) | ||
let lolh = await lolhuman.json() | ||
let n = lolh.result.title || 'error' | ||
await conn.sendMessage(m.chat, { audio: { url: lolh.result.link }, fileName: `${n}.mp3`, mimetype: 'audio/mp4' }, { quoted: m }) | ||
} catch { | ||
await conn.reply(m.chat, '*[β]AUDIO ERROR*', m)} | ||
}} | ||
handler.command = /^fgmp3|dlmp3|getaud|yt(a|mp3)$/i | ||
import { youtubedl, youtubedlv2 } from '@bochilteam/scraper'; | ||
|
||
let handler = async (m, { conn, text, args, isPrems, isOwner, usedPrefix, command }) => { | ||
if (!args || !args[0]) throw `β³οΈ Example :\n${usedPrefix + command} https://youtu.be/YzkTFFwxtXI`; | ||
if (!args[0].match(/youtu/gi)) throw `β Verify that it is a YouTube link.`; | ||
|
||
m.react(rwait); | ||
|
||
try { | ||
let q = '128kbps'; | ||
let v = args[0]; | ||
const yt = await youtubedl(v).catch(async () => await youtubedlv2(v)); | ||
const dl_url = await yt.audio[q].download(); | ||
const title = await yt.title; | ||
|
||
conn.sendFile( | ||
m.chat, | ||
dl_url, | ||
title + '.mp3', | ||
null, | ||
m, | ||
false, | ||
{ mimetype: 'audio/mpeg' } | ||
); | ||
|
||
m.react(xmoji); | ||
} catch { | ||
await m.reply(`β Error: Could not download the audio.`) | ||
} | ||
}; | ||
|
||
handler.help = ['ytmp3 <url>'] | ||
handler.tags = ['dl'] | ||
handler.command = ['ytmp3', 'yta'] | ||
|
||
export default handler |
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,11 +1,25 @@ | ||
import { wallpaper, wallpaperv2 } from '@bochilteam/scraper' | ||
import { wallpaper } from '@bochilteam/scraper'; | ||
import fetch from 'node-fetch'; | ||
|
||
let handler = async (m, { conn, text, usedPrefix, command }) => { | ||
if (!text) throw `*EXAMPLE USAGE ${usedPrefix + command} Minecraft*` | ||
const res = await (/2/.test(command) ? wallpaperv2 : wallpaper)(text) | ||
const img = res[Math.floor(Math.random() * res.length)] | ||
conn.sendFile(m.chat, img, 'error.jpg', `*ππ΄πππ»π ${text}*`, m) | ||
} | ||
handler.help = ['', '2'].map(v => 'wallpaper' + v + ' <query>') | ||
handler.tags = ['downloader'] | ||
handler.command = /^(wallpaper2?)$/i | ||
if (!text) throw `*EXAMPLE USAGE ${usedPrefix + command} Minecraft*`; | ||
|
||
|
||
const res = await wallpaper(text); | ||
const url = res[Math.floor(Math.random() * res.length)]; | ||
|
||
// Use fetch to fetch the image using the URL | ||
const response = await fetch(url); | ||
|
||
// Use 'arrayBuffer()' instead of 'buffer()' | ||
const buffer = await response.arrayBuffer(); | ||
|
||
|
||
conn.sendFile(m.chat, buffer, 'wallpaper.jpg', `*${text}*`, m); | ||
}; | ||
|
||
handler.help = [''].map(v => 'wallpaper' + v + ' <query>'); | ||
handler.tags = ['downloader']; | ||
handler.command = /^(wallpaper)$/i; | ||
|
||
export default handler |