forked from c-o-d-e-xx/WhatsBixby
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconverter.js
203 lines (185 loc) · 6.07 KB
/
converter.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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
const config = require("../config");
const { Module, isPublic, getJson, sleep, tiny, webp2mp4, toAudio } = require("../lib/");
const { Image } = require("node-webpmux");
Module(
{
pattern: "sticker",
fromMe: isPublic,
desc: "converts Photo or video to stickers",
type: "converter",
},
async (message, match, m) => {
if (!(message.reply_message.video || message.reply_message.image))
return await message.reply("_Reply to photo or video_");
let buff = await m.quoted.download();
message.sendMessage(
buff,
{ packname: message.pushName, quoted: message },
"sticker"
);
}
);
Module({
pattern: 'rvtxt ?(.*)',
fromMe: isPublic,
desc: 'reverse the given text',
type: 'converter'},
async (m, match) => {
match = match || m.reply_message.text
if (!match) return await m.reply("Give me a text to reverse")
await m.reply(match.split("").reverse().join(""))
});
Module(
{
pattern: 'aqt ?(.*)',
fromMe: true,
desc: 'Random anime quote',
type: 'info',
},
async (m, match, client) => {
const { anime, character, quote } = await getJson('https://animechan.vercel.app/api/random')
await m.reply( ` ☄️ *ANIME* : _${anime}_\n 🌻 *CHARACTER* : _${character}_\n🖇️ *quote* : ${quote}` )
}
)
Module({pattern: 'base64|b64 ?(.*)', fromMe: isPublic, desc: 'base64 encoder', type: 'encode'}, async (m, match, client) => {
match = match || m.reply_message.text
if(!m.reply_message.text) return await m.reply("Give me text to encode")
await m.reply(btoa(match));
});
Module({pattern: 'dbase64|db64 ?(.*)', fromMe: isPublic, desc: 'base64 decoder', type: 'encode'}, async (m, match, client) => {
match = match || m.reply_message.text
if(!m.reply_message.text) return await m.reply("Give me text to encode")
await m.reply(atob(match));
});
Module({pattern: 'hex ?(.*)', fromMe: isPublic, desc: 'hex encoder', type: 'encode'}, async (m, match, client) => {
match = match || m.reply_message.text
if(!m.reply_message.text) return await m.reply("Give me text to encode")
await m.reply(Buffer.from(match, 'utf8').toString('hex'));
});
Module({pattern: 'dhex ?(.*)', fromMe: isPublic, desc: 'hex decoder', type: 'encode'}, async (m, match, client) => {
match = match || m.reply_message.text
if(!m.reply_message.text) return await m.reply("Give me text to encode")
await m.reply(Buffer.from(match, 'hex').toString());
});
Module(
{
pattern: "tgs",
fromMe: isPublic,
desc: "Download Sticker From Telegram",
type: "downloader",
},
async (message, match) => {
if (!match)
return message.reply(
"_Enter a tg sticker url_\nEg: https://t.me/addstickers/Oldboyfinal\nKeep in mind that there is a chance of ban if used frequently"
);
let packid = match.split("/addstickers/")[1];
let { result } = await getJson(
`https://api.telegram.org/bot891038791:AAHWB1dQd-vi0IbH2NjKYUk-hqQ8rQuzPD4/getStickerSet?name=${encodeURIComponent(
packid
)}`
);
if (result.is_animated)
return message.reply("_Animated stickers are not supported_");
message.reply(
`*Total stickers :* ${result.stickers.length}\n*Estimated complete in:* ${
result.stickers.length * 1.5
} seconds`.trim()
);
for (let sticker of result.stickers) {
let file_path = await getJson(
`https://api.telegram.org/bot891038791:AAHWB1dQd-vi0IbH2NjKYUk-hqQ8rQuzPD4/getFile?file_id=${sticker.file_id}`
);
await message.sendMessage(
`https://api.telegram.org/file/bot891038791:AAHWB1dQd-vi0IbH2NjKYUk-hqQ8rQuzPD4/${file_path.result.file_path}`,
{ packname: message.pushName, quoted: message },
"sticker"
);
sleep(1500);
}
}
);
Module(
{
pattern: "take",
fromMe: isPublic,
desc: "change sticker & audio name",
type: "converter",
},
async (message, match, m) => {
if (!message.reply_message && !message.reply_message.sticker)
return await message.reply("_Reply to sticker_");
let buff = await m.quoted.download();
let [packname] = match.split(",");
await message.sendMessage(
buff,
{
packname: packname, quoted: message
},
"sticker"
);
}
);
Module(
{
pattern: "getexif",
fromMe: true,
desc: "get sticker information",
type: "info",
},
async (message, match, m) => {
if (!message.reply_message || !message.reply_message.sticker)
return await message.reply("_Reply to sticker_");
let img = new Image();
await img.load(await m.quoted.download());
const exif = JSON.parse(img.exif.slice(22).toString());
await message.reply(exif);
}
);
Module(
{
pattern: "mp3",
fromMe: isPublic,
desc: "converts video/audio/voice to mp3",
type: "converter",
},
async (message, match, m) => {
if (!message.reply_message || (!message.reply_message.video && !message.reply_message.audio)) return await message.reply('Reply at audio/voice/video')
let buff = await m.quoted.download();
buff = await toAudio(buff, "mp3");
return await message.sendMessage(buff, { mimetype: "audio/mpeg", quoted: message }, "audio");
}
);
Module(
{
pattern: "photo",
fromMe: isPublic,
desc: "Changes sticker to Photo",
type: "converter",
},
async (message, match, m) => {
if (!message.reply_message)
return await message.reply("_Reply to a sticker_");
if (message.reply_message.mtype !== "stickerMessage")
return await message.reply("_Not a sticker_");
let buff = await m.quoted.download();
return await message.sendMessage(buff, {quoted: message}, "image");
}
);
Module(
{
pattern: "mp4",
fromMe: isPublic,
desc: "Changes sticker to Video",
type: "converter",
},
async (message, match, m) => {
if (!message.reply_message)
return await message.reply("_Reply to a sticker_");
if (message.reply_message.mtype !== "stickerMessage")
return await message.reply("_Not a sticker_");
let buff = await m.quoted.download();
let buffer = await webp2mp4(buff);
return await message.sendMessage(buffer, { quoted: message }, "video");
}
);