← back to browse
goat command

autoseen

Auto Seen

0
views
0
likes
0
installs
raw source
const fs = require("fs-extra");
const path = __dirname + "/cache/autoseen.json";

// Default ON
if (!fs.existsSync(path)) {
  fs.writeFileSync(path, JSON.stringify({ status: true }, null, 2));
}

module.exports = {
  config: {
    name: "autoseen",
    version: "3.1.0",
    author: "๐Œ๐š๐‘๐ฎ๐…",
    role: 0,
    countDown: 0,
    category: "system",
    shortDescription: "Auto Seen",
    longDescription: "Auto seen on/off korbe"
  },

  onStart: async function ({ api, event, args }) {
    const { threadID, messageID } = event;
    const data = JSON.parse(fs.readFileSync(path));

    if (args[0] === "on") {
      data.status = true;
      fs.writeFileSync(path, JSON.stringify(data, null, 2));
      return api.sendMessage("โœ… ๐€๐ฎ๐ญ๐จ๐’๐ž๐ž๐ง : ๐Ž๐", threadID, messageID);
    }
    else if (args[0] === "off") {
      data.status = false;
      fs.writeFileSync(path, JSON.stringify(data, null, 2));
      return api.sendMessage("โŒ ๐€๐ฎ๐ญ๐จ๐’๐ž๐ง : ๐Ž๐…๐…", threadID, messageID);
    }
    else {
      return api.sendMessage("โš ๏ธ ๐”๐ฌ๐ž : autoseen on / off", threadID, messageID);
    }
  },

  onChat: async function ({ api, event }) {
    try {
      const data = JSON.parse(fs.readFileSync(path));
      if (data.status === true) {
        api.markAsReadAll();
      }
    } catch (e) {}
  },
};

View raw file