Skip to content

Commit

Permalink
[ Jessi-md 4.8.0 ⏱️ ]
Browse files Browse the repository at this point in the history
  • Loading branch information
whiteshadowofficial authored Oct 27, 2023
1 parent 47609b2 commit 245a6dd
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions plugins/shorturl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import fetch from 'node-fetch';

let handler = async (m, { conn, args, text }) => {
if (!text) throw '*Please provide a URL or link to shorten.*';

let shortUrl1 = await (await fetch(`https://tinyurl.com/api-create.php?url=${args[0]}`)).text();

if (!shortUrl1) throw `*Error: Could not generate a short URL.*`;

let done = `*SHORT URL CREATED!!*\n\n*Original Link:*\n${text}\n*Shortened URL:*\n${shortUrl1}`.trim();

m.reply(done);
};

handler.help = ['tinyurl', 'shorten'].map(v => v + ' <link>');
handler.tags = ['tools'];
handler.command = /^(tinyurl|short|acortar|corto)$/i;
handler.fail = null;

export default handler;

0 comments on commit 245a6dd

Please sign in to comment.