-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathshortlink.js
27 lines (26 loc) · 976 Bytes
/
shortlink.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
module.exports.config = {
name: "shortlink",
version: "2.0.0",
hasPermision: 0,
credit: "Quang Minh (Api tinyurl LawerBot)",
description: "rut gon url",
commandCategory: "info",
usages: "[url]",
cooldowns: 0,
};
module.exports.run = async function({ api, event, args, utils, Users,Threads }) {
try {
let axios = require('axios');
let { threadID, senderID, messageID } = event;
if (!args[0]) {api.sendMessage("Vui lòng nhập url cần rút gọn",threadID,messageID)}
else {
const res = await axios.get(encodeURI(`http://lawerpr0ject.herokuapp.com/other/tinyurl?url=${args[0]}`));
console.log(res.data);
let data = res.data;
return api.sendMessage(`Shorturl: ${res.data.result.link}`, event.threadID, event.messageID);
}
}
catch {
return api.sendMessage(`Đã xảy ra lỗi`, event.threadID)
}
}