|
|
const chalk = require('chalk'); |
|
|
const gradient = require('gradient-string'); |
|
|
const moment = require("moment-timezone"); |
|
|
|
|
|
module.exports.config = { |
|
|
name: "console", |
|
|
version: "1.0.0", |
|
|
hasPermssion: 2, |
|
|
credits: "Jonell Magallanes", |
|
|
description: "Log all messages from different threads or group chats.", |
|
|
usePrefix: false, |
|
|
commandCategory: "Monitor", |
|
|
usages: "", |
|
|
cooldowns: 0 |
|
|
}; |
|
|
|
|
|
module.exports.handleEvent = async function ({ api, event, Threads }) { |
|
|
let { threadID, senderID, body } = event; |
|
|
var time = moment.tz("Asia/Manila").format("LLLL"); |
|
|
|
|
|
const thread = await Threads.getInfo(threadID); |
|
|
const threadName = thread.threadName || "Unknown Group"; |
|
|
|
|
|
if (senderID === api.getCurrentUserID()) return |
|
|
|
|
|
if (thread.console === false) return; |
|
|
|
|
|
const gradientText = (text) => gradient('cyan', 'pink')(text); |
|
|
const boldText = (text) => chalk.bold(text); |
|
|
|
|
|
console.log(gradientText("ββββββββββ[ DATABASE THREADS BOT LOGS ]ββββββββββ")); |
|
|
console.log(gradientText("ββββββββββββββββββββββββββββββββββββββββββ")); |
|
|
console.log(`${boldText(gradientText(`β£β€ Group: ${threadName}`))}`); |
|
|
console.log(`${boldText(gradientText(`β£β€ Group ID: ${threadID}`))}`); |
|
|
console.log(`${boldText(gradientText(`β£β€ User ID: ${senderID}`))}`); |
|
|
console.log(`${boldText(gradientText(`β£β€ Content: ${body || "N/A"}`))}`); |
|
|
console.log(`${boldText(gradientText(`β£β€ Time: ${time}`))}`); |
|
|
console.log(gradientText("ββββββββββββββββββββββββββββββββββββββββββ")); |
|
|
}; |
|
|
|
|
|
module.exports.run = async function ({ api, args, Users, event }) { api.sendMessage("This command is been functionality on console logs", event.threadID); |
|
|
}; |