forked from zaliooa/whatsapp-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtiktok.js
111 lines (107 loc) · 3.75 KB
/
tiktok.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
const Asena = require("../Utilis/events")
const { MessageType } = require("@adiwajshing/baileys")
const { getJson, TiktokDownloader, getBuffer } = require("../Utilis/download")
const { UploadToImgur, parsedJid, getOneWallpaper } = require("../Utilis/Misc")
const Language = require("../language")
const Lang = Language.getString("tiktok")
const { forwardOrBroadCast } = require("../Utilis/groupmute")
Asena.addCommand(
{ pattern: "tiktok ?(.*)", fromMe: true, desc: Lang.TIKTOK_DESC },
async (message, match) => {
match = match || message.reply_message.text
if (match == "")
return await message.sendMessage(Lang.NEED_REPLY, {
quoted: message.data,
})
const link = await TiktokDownloader(match)
if (!link)
return await message.sendMessage(Lang.INVALID, {
quoted: message.data,
})
const { buffer } = await getBuffer(link)
return await message.sendMessage(
buffer,
{ quoted: message.quoted },
MessageType.video
)
}
)
Asena.addCommand(
{ pattern: "movie ?(.*)", fromMe: true, desc: Lang.MOVIE_DESC },
async (message, match) => {
if (match === "")
return await message.sendMessage(Lang.NEED_NAME, {
quoted: message.data,
})
let url = `http://www.omdbapi.com/?apikey=742b2d09&t=${match}&plot=full`
const json = await getJson(url)
if (json.Response != "True")
return await message.sendMessage(Lang.NOT_FOUND, {
quoted: message.data,
})
let msg = ""
msg += "```Title : " + json.Title + "\n\n"
msg += "Year : " + json.Year + "\n\n"
msg += "Rated : " + json.Rated + "\n\n"
msg += "Released : " + json.Released + "\n\n"
msg += "Runtime : " + json.Runtime + "\n\n"
msg += "Genre : " + json.Genre + "\n\n"
msg += "Director : " + json.Director + "\n\n"
msg += "Writer : " + json.Writer + "\n\n"
msg += "Actors : " + json.Actors + "\n\n"
msg += "Plot : " + json.Plot + "\n\n"
msg += "Language : " + json.Language + "\n\n"
msg += "Country : " + json.Country + "\n\n"
msg += "Awards : " + json.Awards + "\n\n"
msg += "BoxOffice : " + json.BoxOffice + "\n\n"
msg += "Production : " + json.Production + "\n\n"
msg += "imdbRating : " + json.imdbRating + "\n\n"
msg += "imdbVotes : " + json.imdbVotes + "```"
return await message.sendMessage(msg)
}
)
Asena.addCommand(
{ pattern: "forward ?(.*)", fromMe: true, desc: Lang.FORWARD_DESC },
async (message, match) => {
if (match == "") return await message.sendMessage(Lang.JID)
if (!message.reply_message) return await message.sendMessage(Lang.FORWARD)
for (let jid of parsedJid(match)) {
await forwardOrBroadCast(jid, message)
}
}
)
Asena.addCommand(
{
pattern: "wallpaper ?(.*)",
fromMe: true,
desc: Lang.WALLPAPER_DESC,
},
async (message, match) => {
if (match == "") return message.sendMessage(Lang.NEED_NAME)
const buffer = await getOneWallpaper(match, message)
if (!buffer) return await message.sendMessage(Lang.NOT_FOUND)
return await message.sendMessage(
buffer,
{ quoted: message.data },
MessageType.buttonsMessage
)
}
)
Asena.addCommand(
{ pattern: "url", fromMe: true, desc: Lang.URL_DESC },
async (message, match) => {
if (
!message.reply_message ||
(!message.reply_message.image && !message.reply_message.video)
)
return await message.sendMessage(Lang.URL_NEED_REPLY)
if (message.reply_message.video && message.reply_message.seconds > 60)
return await message.sendMessage("*Only accept below 1min*")
return await message.sendMessage(
await UploadToImgur(
await message.reply_message.downloadAndSaveMediaMessage("url")
),
{ quoted: message.data }
)
}
)