-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathbotchat.js
36 lines (35 loc) · 1.22 KB
/
botchat.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
let moment = require('moment-timezone')
let fs = require('fs')
let handler = async (m, { conn, command, text }) => {
let emot = conn.pickRandom(["👋"])
let img = await (await fetch('https://telegra.ph/file/623b6c1ebe07ca5181965.jpg')).buffer()
let user = global.db.data.users[m.sender]
conn.sendMessage(m.chat, {
react: {
text: emot,
key: m.key
}
})
conn.sendButton(m.chat, `Halo juga kak @${m.sender.split`@`[0]} Ada Yang ${await conn.getName(conn.user.jid)} Bisa Bantu?`, wm, 'Menu', '#Menu', { key: { fromMe: false, remoteJid: 'status@broadcast', participant: '[email protected]' }, message: { orderMessage: { message: `${ucapan()} ${conn.getName(m.sender)}`, itemCount: 999, thumbnail: img
}}})
}
handler.customPrefix = /^(Hallo|halo|Halo|hallo|hi|helo|hai|hi|Hai|Helo|Hello)$/i
handler.command = new RegExp
module.exports = handler
function ucapan() {
const time = moment.tz('Asia/Jakarta').format('HH')
res = "Selamat dinihari 🎑"
if (time >= 4) {
res = "Good Morning 🌅"
}
if (time > 10) {
res = "Good Afternoon 🏞️"
}
if (time >= 15) {
res = "Good Afternoon 🌇"
}
if (time >= 18) {
res = "Good Evening 🌃"
}
return res
}