forked from yusufusta/WhatsAsena
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathneko.js
32 lines (25 loc) · 1.1 KB
/
neko.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
/*
Nekobin for WhatsAsena - W4RR10R
Licensed under the GPL-3.0 License;
you may not use this file except in compliance with the License.
WhatsAsena - Yusuf Usta
*/
const Asena = require('../events');
const {MessageType} = require('@adiwajshing/baileys');
const got = require('got');
const Language = require('../language');
const Lang = Language.getString('nekobin');
Asena.addCommand({pattern: 'neko', fromMe: true, desc: Lang.NEKO_DESC}, (async (message, match) => {
if (!message.reply_message) return await message.sendMessage(Lang.NEED_REPLY);
if (!message.reply_message.text) return await message.sendMessage(Lang.MUST_TEXT);
let base_URI = "https://nekobin.com/api/documents";
try {
const response = await got.post(base_URI, {json : {content : message.reply_message.text}});
json = JSON.parse(response.body);
neko_url = 'https://nekobin.com/' + json.result.key;
await message.reply(neko_url);
} catch (err) {
await message.reply(err.message, MessageType.text);
console.log(err.message);
}
}));