← back to browse
goat command

bancheck

Ignores banned users

0
views
0
likes
0
installs
raw source
const { config } = global.GoatBot;

module.exports = {
  config: {
    name: "bancheck",
    version: "1.0.0",
    author: "System",
    countDown: 0,
    role: 0,
    shortDescription: { en: "Ignores banned users" },
    category: "system",
    guide: { en: "internal" }
  },

  onStart: async function () {},

  onChat: async function ({ event, api }) {
    if (!event || !event.senderID) return;
    if (!config.bannedUsers || !Array.isArray(config.bannedUsers)) return;

    const sender = String(event.senderID);
    const botID = String(api.getCurrentUserID());
    if (sender === botID) return;

    const devUsers = (config.devUsers || []).map(String);
    if (devUsers.includes(sender)) return;

    if (config.bannedUsers.map(String).includes(sender)) {
      throw new Error("__BANNED_USER__");
    }
  }
};

View raw file