forked from cyberchekuthan/Amalser_v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshow.js
172 lines (122 loc) · 6.16 KB
/
show.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
/* Copyright (C) 2021 Vai838.
Licensed under the GPL-3.0 License;
you may not use this file except in compliance with the License.
WhatsAsenaDuplicated
*/
const Asena = require('../events');
const {MessageType} = require('@adiwajshing/baileys');
const got = require('got');
const fs = require('fs');
const axios = require('axios');
const Language = require('../language');
const Lang = Language.getString('weather');
const { errorMessage, infoMessage } = require('../helpers');
Asena.addCommand({ pattern: 'joox ?(.*)', fromMe: false, dontAddCommandList: true}, async (message, match) => {
const userName = match[1]
if (!userName) return await message.sendMessage(errorMessage(Lang.NEED_WORDIGTV))
await message.sendMessage(infoMessage("Loading"))
await axios
.get(`https://gratisancok.herokuapp.com/api/joox/?kata=${userName}&apikey=ZailaniGans`)
.then(async (response) => {
const {
mp3_url,
judul,
artist,
album,
} = response.data.result.result
const profileBuffer = await axios.get(mp3_url, {responseType: 'arraybuffer'})
const msg = `${"Title"}*: ${judul}\n${"Artist"}*: ${artist}\n${"Album"}*: ${album}\n${mp3_url}`
await message.sendMessage(Buffer.from(profileBuffer.data), MessageType.document)
await message.sendMessage(message.jid,msg, MessageType.document,)
})
.catch(
async (err) => await message.sendMessage(errorMessage("Error.Please check the song name.")),
)
},
)
Asena.addCommand({ pattern: 'rest ?(.*)', fromMe: true, dontAddCommandList: true, desc: Lang.DESC }, (async (message, match) => {
if (match[0].includes('install')) return;
if (match[1] === '') return await message.client.sendMessage(message.jid, Lang.NEED_WORD, MessageType.text, { quoted: message.data });
if (!match[1].includes('www.instagram.com')) return await message.client.sendMessage(message.jid, Lang.NEED_WORD, MessageType.text, { quoted: message.data });
let urls = `https://api.xteam.xyz/dl/ig?url=${match[1]}&APIKEY=ab9942f95c09ca89`
let response
try { response = await got(urls) } catch { return await message.client.sendMessage(message.jid, Lang.FİX, MessageType.text, { quoted: message.data });
}
const json = JSON.parse(response.body);
if (json.status === false) return await message.client.sendMessage(message.jid, Lang.NOT_FOUND, MessageType.text, { quoted: message.data });
if (json.code === 403) return await message.client.sendMessage(message.jid, '```API Error!```', MessageType.text, { quoted: message.data });
await message.client.sendMessage(message.jid, Tlang.DOWN, MessageType.text, { quoted: message.data });
let url = json.result.data[0].data;
let name = json.result.data[0].type;
await axios({ method: "get", url, headers: { 'DNT': 1, 'Upgrade-Insecure-Request': 1 }, responseType: 'arraybuffer'}).then(async (res) => {
if (name === 'video') { return await message.sendMessage(Buffer(res.data), MessageType.video, { caption: '*' + Tlang.USERNAME + '* ' + json.result.username + '\n*' + Tlang.LİNK + '* ' + 'http://instagram.com/' + json.result.username + '\n*' + Tlang.CAPTİON + '* ' + json.result.caption }) } else { return await message.sendMessage(Buffer(res.data), MessageType.image, { caption: '*' + Tlang.USERNAME + '* ' + json.result.username + '\n*' + Tlang.LİNK + '* ' + 'http://instagram.com/' + json.result.username + '\n*' + Tlang.CAPTİON + '* ' + json.result.caption });
}
});
}));
Asena.addCommand({ pattern: 'twt ?(.*)', fromMe: false, dontAddCommandList: true, desc: "download from twitter links" }, async (message, match) => {
const userName = match[1]
if (!userName) return await message.sendMessage(errorMessage("Give proper link!"))
await message.sendMessage(infoMessage(Lang.LOADINGTV))
await axios
.get(`https://api-anoncybfakeplayer.herokuapp.com/twdown?url=${userName}`)
.then(async (response) => {
const {
format,
result,
} = response.data
const profileBuffer = await axios.get(result, {responseType: 'arraybuffer'})
const msg = `${format}`
if (msg === 'Image/jpg or png') { await message.sendMessage(Buffer.from(profileBuffer.data), MessageType.image, {
caption: msg,
})}
if (msg === 'video/mp4') { await message.sendMessage(Buffer.from(profileBuffer.data), MessageType.video, {
caption: msg,
})}
})
.catch(
async (err) => await message.sendMessage(errorMessage("Error" )),
)
},
)
Asena.addCommand({ pattern: 'show ?(.*)', fromMe: false , desc: "Get info related to tv series and shows"}, async (message, match) => {
const userName = match[1]
if (!userName) return await message.sendMessage(errorMessage("give me the show name"))
await message.sendMessage(infoMessage("Loading..."))
await axios
.get(`http://api.tvmaze.com/search/shows?q=${userName}`)
.then(async (response) => {
const {
name,
type,
language,
status,
officialSite,
summary,
} = response.data[0].show
const msg = `*${"Name"}*: ${name}\n*${"Type"}*: ${type}\n*${"Type"}*: ${status}\n*${"Summary"}*: ${summary}\n*${"Official Site"}*: ${officialSite}`
await message.client.sendMessage(message.jid, msg , MessageType.text);
})
.catch(
async (err) => await message.sendMessage(errorMessage("Not Found" )),
)
},
)
Asena.addCommand({ pattern: 'show ?(.*)', fromMe: false , dontAddCommandList: true}, async (message, match) => {
const userName = match[1]
await axios
.get(`http://api.tvmaze.com/search/shows?q=${userName}`)
.then(async (response) => {
const {
original,
} = response.data[0].show.image
const profileBuffer = await axios.get(original, {responseType: 'arraybuffer'})
const msg = ``
await message.sendMessage(Buffer.from(profileBuffer.data), MessageType.image, {
caption: msg,
})
})
.catch(
async (err) => await message.sendMessage(""),
)
},
)