File size: 1,868 Bytes
2821330
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
37
38
39
40
41
42
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", //JONELL CC
  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);
};