forked from AyGemuy/Taylor-V2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot-firstchat.js
More file actions
16 lines (16 loc) · 843 Bytes
/
Copy pathbot-firstchat.js
File metadata and controls
16 lines (16 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import moment from "moment-timezone";
export async function before(m) {
if (!(m.chat?.endsWith("broadcast") || m.fromMe || m.isGroup)) {
try {
let user = db.data.users[m.sender];
if (new Date() - user.pc < 216e5) return;
const time = moment.tz("Asia/Jakarta").format("HH"),
greeting = time < 4 ? "Selamat dinihari 🌆" : time < 10 ? "Selamat pagi 🌄" : time < 15 ? "Selamat siang ☀️" : time < 18 ? "Selamat sore 🌇" : "Selamat malam 🌙";
let txt = `👋 Hai, ${greeting}\n\n${user.banned ? "📮Maaf, kamu dibanned & Tidak bisa menggunakan bot ini lagi" : `💬 Ada yg bisa ${this.user.name} bantu?\nSilahkan ketik *.menu* untuk melihat daftar menu pada bot.`}`.trim();
await this.reply(m.chat, txt, null);
user.pc = Date.now();
} catch (e) {
console.error(e);
}
}
}