forked from MrHecka/heckayo-bot-telegram
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsendprivate.js
31 lines (22 loc) · 804 Bytes
/
sendprivate.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
console.log('sendprivate.js AKTIF!')
const TeleBot = require('telebot')
const delay = require('delay')
let dev = '854756142'
const axios = require('axios')
const bot = new TeleBot({
token: process.env.TOKEN
})
module.exports = bot => {
bot.on(/^\/sendprivate ([\s\S]+)/, async (msg, args) => {
if (msg.from.id.toString().includes(dev)) {
let id = args.match[1].split(' ')[0]
let argz = args.match[1]
let pesan = argz.slice(id.length + 1)
await bot.sendMessage(id, pesan).catch(async(err) => {
return await bot.sendMessage(msg.from.id, `ERROR | ${err}`)
})
} else {
return bot.sendMessage(msg.from.id, `Maaf kamu bukan dev, aku tidak mengenal mu 🙁`)
}
})
}