-
Notifications
You must be signed in to change notification settings - Fork 202
/
Copy pathttp.js
38 lines (35 loc) · 2.66 KB
/
ttp.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
28
29
30
31
32
33
34
35
36
37
38
const Aqua = require('../events');
const { MessageType, MessageOptions, Mimetype } = require('@adiwajshing/baileys');
const fs = require('fs');
const axios = require('axios');
const Config = require('../config');
const Language = require('../language');
const Lang = Language.getString('ttp');
if (Config.WORKTYPE == 'private') {
Aqua.addCommand({ pattern: 'ttp ?(.*)', fromMe: true, desc: Lang.TTP_DESC, deleteCommand: false }, (async (message, match) => {
if (match[1] === '') return await message.client.sendMessage(message.jid,Lang.NEED_WORD, MessageType.text);
var uri = encodeURI(match[1])
var ttinullimage = await axios.get('https://api.xteam.xyz/ttp?file&text=' + uri, { responseType: 'arraybuffer' })
await message.client.sendMessage(message.jid,Buffer.from(ttinullimage.data), MessageType.image, { mimetype: Mimetype.jpg, caption: Config.CAPTION, quoted: message.data })
}));
Aqua.addCommand({ pattern: 'attp ?(.*)', fromMe: true, desc: Lang.ATTP_DESC, deleteCommand: false }, (async (message, match) => {
if (match[1] === '') return await message.client.sendMessage(message.jid,Lang.NEED_WORD, MessageType.text);
var uri = encodeURI(match[1])
var ttinullimage = await axios.get('https://api.xteam.xyz/attp?file&text=' + uri, { responseType: 'arraybuffer' })
await message.client.sendMessage(message.jid,Buffer.from(ttinullimage.data), MessageType.sticker, { mimetype: Mimetype.webp, quoted: message.data })
}));
}
else if (Config.WORKTYPE == 'public') {
Aqua.addCommand({ pattern: 'ttp ?(.*)', fromMe: false, desc: Lang.TTP_DESC, deleteCommand: false }, (async (message, match) => {
if (match[1] === '') return await message.client.sendMessage(message.jid,Lang.NEED_WORD, MessageType.text);
var uri = encodeURI(match[1])
var ttinullimage = await axios.get('https://api.xteam.xyz/ttp?file&text=' + uri, { responseType: 'arraybuffer' })
await message.client.sendMessage(message.jid, Buffer.from(ttinullimage.data), MessageType.image, { mimetype: Mimetype.jpg, caption: Config.CAPTION, quoted: message.data})
}));
Aqua.addCommand({ pattern: 'attp ?(.*)', fromMe: false, desc: Lang.ATTP_DESC, deleteCommand: false }, (async (message, match) => {
if (match[1] === '') return await message.client.sendMessage(message.jid,Lang.NEED_WORD, MessageType.text);
var uri = encodeURI(match[1])
var ttinullimage = await axios.get('https://api.xteam.xyz/attp?file&text=' + uri, { responseType: 'arraybuffer' })
await message.client.sendMessage(message.jid,Buffer.from(ttinullimage.data), MessageType.sticker, { mimetype: Mimetype.webp, quoted: message.data })
}));
}