← back to browse
goat command

autoreact

Auto react on/off with status

0
views
0
likes
0
installs

Aliases: ar

raw source
module.exports = {
  config: {
    name: "autoreact",
    aliases: ["ar"],
    version: "6.2.2",
    author: "๐Œ๐š๐‘๐ฎ๐…",
    role: 0,
    category: "system",
    description: "Auto react on/off with status"
  },

  onStart: async function ({ api, event, args }) {
    const { threadID, messageID } = event;
    global.__autoReactStatus??= {};
    if (global.__autoReactStatus[threadID] === undefined)
      global.__autoReactStatus[threadID] = false;

    const cmd = args[0]?.toLowerCase();

    if (cmd === "on") {
      global.__autoReactStatus[threadID] = true;
      return api.sendMessage("โœ… ๐€๐ฎ๐ญ๐จ๐‘๐ž๐š๐œ๐ญ ๐„๐ง๐š๐›๐ฅ๐ž๐", threadID, messageID);
    }
    else if (cmd === "off") {
      global.__autoReactStatus[threadID] = false;
      return api.sendMessage("โŒ ๐€๐ฎ๐ญ๐จ๐‘๐ž๐š๐œ๐ญ ๐ƒ๐ข๐ฌ๐š๐›๐ฅ๐ž๐", threadID, messageID);
    }
    else {
      const status = global.__autoReactStatus[threadID]? "โœ… ๐Ž๐" : "โŒ ๐Ž๐…๐…";
      return api.sendMessage(`๐Ÿ“Š ๐’๐ญ๐š๐ญ๐ฎ๐ฌ: ${status}`, threadID, messageID);
    }
  },

  onChat: async function ({ api, event }) {
    const { messageID, senderID, threadID } = event;
    if (!messageID) return;
    if (senderID === api.getCurrentUserID()) return;

    global.__autoReactStatus??= {};
    if (global.__autoReactStatus[threadID] === undefined)
      global.__autoReactStatus[threadID] = false;

    if (!global.__autoReactStatus[threadID]) return;

    const reacts = [
      "โค๏ธ","๐Ÿงก","๐Ÿ’›","๐Ÿ’š","๐Ÿ’™","๐Ÿ’œ","๐Ÿค","๐Ÿ–ค","๐ŸคŽ","๐Ÿฉท","๐Ÿฉต","๐Ÿฉถ","๐Ÿ’–","๐Ÿ’—","๐Ÿ’˜","๐Ÿ’","๐Ÿ’ž","๐Ÿ’•","๐Ÿ’“","๐Ÿ’Œ","๐Ÿ’Ÿ",
      "๐Ÿ’ซ","โœจ","๐ŸŒŸ","โญ","๐Ÿ’ฅ","โšก","๐Ÿ”ฅ","๐Ÿ’ฏ","๐ŸŽ‰","๐ŸŽŠ","๐ŸŽˆ","๐ŸŽ","๐Ÿ†","๐Ÿ‘‘","๐Ÿ’Ž","๐Ÿ’",
      "๐ŸŒธ","๐ŸŒบ","๐ŸŒป","๐ŸŒท","๐ŸŒน","๐ŸŒผ","๐Ÿ’","๐Ÿ€","๐ŸŒฟ","๐ŸŒพ","๐ŸŒฒ","๐ŸŒณ","๐ŸŒด","๐ŸŒˆ","๐ŸŒ™","๐ŸŒž",
      "๐Ÿซถ","๐Ÿซฐ","๐Ÿ‘Œ","๐Ÿ‘","๐Ÿ‘","๐Ÿ™Œ","๐Ÿค","โœŒ๏ธ","๐Ÿคž","๐Ÿค™","๐Ÿ’ช","๐Ÿ’…","๐Ÿ’‹","๐Ÿ‘ฉโ€โค๏ธโ€๐Ÿ‘จ",
      "๐Ÿ“","๐Ÿ’","๐ŸŽ","๐Ÿ‰","๐Ÿ‘","๐Ÿ","๐Ÿฅญ","๐Ÿฅ","๐Ÿ‡","๐ŸŠ","๐Ÿ‹","๐Ÿˆ","๐ŸŒ","๐Ÿ","๐Ÿ","๐Ÿฅฅ",
      "๐Ÿฉ","๐Ÿฐ","๐Ÿง","๐Ÿช","๐Ÿซ","๐Ÿญ","๐Ÿฏ","๐Ÿฌ","๐ŸŽ‚","๐Ÿง‹","โ˜•","๐Ÿฅ‚","๐Ÿฆ","๐Ÿง","๐Ÿก","๐Ÿฎ",
      "๐Ÿฆ‹","๐Ÿ•Š๏ธ","๐Ÿชฝ","๐Ÿผ","๐Ÿฐ","๐Ÿธ","๐Ÿฏ","๐Ÿจ","๐Ÿฑ","๐Ÿถ","๐Ÿฆ„","๐Ÿง","๐Ÿค","๐Ÿฃ","๐Ÿฅ","๐Ÿบ",
      "๐Ÿ“ธ","๐Ÿ’ก","โœ…","๐ŸŽ","๐ŸŽˆ","๐ŸŒŸ","๐Ÿ’ซ","โœจ","๐Ÿ’ฅ","โšก","๐Ÿ”ฅ","๐Ÿ’ฏ","๐Ÿ†","๐Ÿ‘‘","๐Ÿ’Ž","๐Ÿ’"
    ];

    const react = reacts[Math.floor(Math.random() * reacts.length)];
    api.setMessageReaction(react, messageID);
  }
};

View raw file