Can we add an "forceaddkos" and "forceremovekos" command to this? It will add a user to track.
Keep in mind, we need to create a new file to track these accounts, so they are persistent.
const axios = require('axios');
const fs = require('fs');[]
const { Client, GatewayIntentBits } = require('discord.js');
const PING_INTERVAL = 60 * 60 * 1000
const TRACKED_USERS = [
    '1mac1cam1', 
    'xKellus', 
    'Lucky_25713', 
    'Avenger_25713', 
    'XLucky_25713X', 
    'xNotLucky', 
    'santinoesmagico', 
    'kayaltaccountEz', 
    'bonk426', 
    'kay_shadow0101',
    'Ghost_eLoex',
];
const PLACE_ID = '2202352383';

const client = new Client({
    intents: [
        GatewayIntentBits.Guilds,
        GatewayIntentBits.GuildMessages,
        GatewayIntentBits.MessageContent,
    ],
});

const userStatus = {};
let statusMessageId = null;

client.once('ready', () => {
    console.log('Bot is ready!');
    loadMessageId();
    trackUsers();
});

const loadMessageId = () => {
    try {
        const data = fs.readFileSync('message_id.json', 'utf8');
        const json = JSON.parse(data);
        statusMessageId = json.messageId;
    } catch (error) {
        console.error('Error loading message ID:', error);
    }
};

const saveMessageId = (messageId) => {
    try {
        const data = JSON.stringify({ messageId });
        fs.writeFileSync('message_id.json', data);
    } catch (error) {
        console.error('Error saving message ID:', error);
    }
};

const trackUsers = async () => {
    try {
        const allServers = await fetchAllPublicServers(PLACE_ID);
        const allPlayerTokens = allServers.flatMap(server => 
            server.playerTokens.map(token => ({ token, serverId: server.id }))
        );

        let statusChanged = false;
        let messageContent = "```diff\n";
        let usersToPing = [];

        for (let username of TRACKED_USERS) {
            const userId = await getUserId(username);
            if (!userId) {
                console.warn(`User ID not found for username: ${username}`);
                continue;
            }

            const isOnline = await checkOnlineStatus(userId);
            let isInPublicServer = false;
            let serverId = null;

            if (isOnline) {
                const thumbnailUrl = await getThumb(userId);
                if (thumbnailUrl) {
                    const thumbnailIdMatch = thumbnailUrl.match(/([A-F0-9]{32})/i);
                    if (thumbnailIdMatch) {
                        const thumbnailId = thumbnailIdMatch[0].toUpperCase();
                        const result = await findUserInPublicServers(allPlayerTokens, thumbnailId);
                        if (result.found) {
                            isInPublicServer = true;
                            serverId = result.serverId;
                        }
                    }
                }
            }

            const currentTime = Date.now();
            if (
                !userStatus[username] ||
                userStatus[username].isOnline !== isOnline ||
                userStatus[username].isInPublicServer !== isInPublicServer
            ) {
                statusChanged = true;
                
                if (isOnline && isInPublicServer) {
                    if (!userStatus[username] || !userStatus[username].lastPingTime || 
                        (currentTime - userStatus[username].lastPingTime >= PING_INTERVAL)) {
                        usersToPing.push(username);
                        userStatus[username] = { 
                            ...userStatus[username], 
                            lastPingTime: currentTime 
                        };
                    }
                }
            }

            userStatus[username] = { 
                ...userStatus[username], 
                isOnline, 
                isInPublicServer, 
                serverId 
            };

            if (isOnline && isInPublicServer) {
                messageContent += `+ ${username} (Online) - Server: roblox.com/games/${PLACE_ID}/SPTS-Classic#jobid=${serverId}\n\n`;
            } else {
                messageContent += `- ${username} (Offline)\n\n`;
            }
        }

        messageContent += "```";

        if (statusChanged) {
            const channel = await client.channels.fetch(DISCORD_CHANNEL_ID);
            if (!channel) {
                console.error(`Channel with ID ${DISCORD_CHANNEL_ID} not found.`);
                return;
            }

            if (statusMessageId) {
                try {
                    const oldMessage = await channel.messages.fetch(statusMessageId);
                    await oldMessage.edit(messageContent);
                } catch (error) {
                    console.error('Failed to edit existing message:', error);
                    statusMessageId = null;
                }
            }

            if (!statusMessageId) {
                const newMessage = await channel.send(messageContent);
                statusMessageId = newMessage.id;
                saveMessageId(statusMessageId);
            }

            // Ping for users who came online and meet the rate limit criteria
            if (usersToPing.length > 0) {
                const channel2 = await client.channels.fetch('1295508784592064583');

                const pingMessage = `@everyone - this kos came on: ${usersToPing.join(', ')}`;
                await channel2.send(pingMessage);
            }
        }
    } catch (error) {
        console.error('Error in trackUsers:', error);
    } finally {
        setTimeout(trackUsers, 60000);
    }
};


const getUserId = async (username) => {
    try {
        const response = await axios.post(
            'https://users.roblox.com/v1/usernames/users',
            {
                usernames: [username],
                excludeBannedUsers: false,
            },
            {
                headers: {
                    'Content-Type': 'application/json',
                },
            }
        );

        if (response.data && response.data.data && response.data.data.length > 0) {
            return response.data.data[0].id.toString();
        } else {
            console.warn(`No data returned for username: ${username}`);
            return null;
        }
    } catch (error) {
        console.error(`Error fetching user ID for ${username}:`, error);
        return null;
    }
};

const getThumb = async (userId) => {
    try {
        const response = await axios.get(
            `https://thumbnails.roblox.com/v1/users/avatar-headshot?userIds=${userId}&size=150x150&format=Png&isCircular=false`
        );
        if (response.data && response.data.data && response.data.data[0].imageUrl) {
            return response.data.data[0].imageUrl;
        } else {
            console.warn(`No thumbnail URL found for user ID: ${userId}`);
            return null;
        }
    } catch (error) {
        console.error(`Error fetching thumbnail for user ID ${userId}:`, error);
        return null;
    }
};

const checkOnlineStatus = async (userId) => {
    try {
        const response = await axios.post(
            'https://presence.roblox.com/v1/presence/users',
            {
                userIds: [parseInt(userId)],
            },
            {
                headers: {
                    'Content-Type': 'application/json',
                },
            }
        );

        const userPresence = response.data.userPresences[0];
        return userPresence && userPresence.userPresenceType === 2;
    } catch (error) {
        console.error(`Error checking online status for user ID ${userId}:`, error);
        return false;
    }
};

const fetchAllPublicServers = async (placeId) => {
    let cursor = null;
    let allServers = [];

    try {
        while (true) {
            const response = await getPublicServers(placeId, cursor);
            if (!response || !response.data) {
                break;
            }

            allServers.push(...response.data);

            if (!response.nextPageCursor) {
                break;
            }

            cursor = response.nextPageCursor;
        }
    } catch (error) {
        console.error('Error fetching public servers:', error);
    }

    return allServers;
};

const getPublicServers = async (placeId, cursor) => {
    try {
        let url = `https://games.roblox.com/v1/games/${placeId}/servers/Public?limit=100`;
        if (cursor) {
            url += `&cursor=${cursor}`;
        }

        const response = await axios.get(url);
        return response.data;
    } catch (error) {
        console.error(`Error fetching public servers for place ID ${placeId}:`, error);
        return null;
    }
};

const findUserInPublicServers = async (allPlayerTokens, thumbnailId) => {
    try {
        const chunkSize = 100;
        for (let i = 0; i < allPlayerTokens.length; i += chunkSize) {
            const chunk = allPlayerTokens.slice(i, i + chunkSize);

            const body = chunk.map((item) => ({
                requestId: `${item.token}:${item.serverId}`,
                type: 'AvatarHeadShot',
                targetId: 0,
                token: item.token,
                format: 'png',
                size: '150x150',
            }));

            const response = await axios.post('https://thumbnails.roblox.com/v1/batch', body, {
                headers: {
                    'Content-Type': 'application/json',
                    Accept: 'application/json',
                },
            });

            if (response.data && response.data.data) {
                for (let thumbnail of response.data.data) {
                    if (thumbnail && thumbnail.imageUrl) {
                        const imageIdMatch = thumbnail.imageUrl.match(/([A-F0-9]{32})/i);
                        if (
                            imageIdMatch &&
                            imageIdMatch[0].toUpperCase() === thumbnailId.toUpperCase()
                        ) {
                            const [token, serverId] = thumbnail.requestId.split(':');

                            return { found: true, serverId };
                        }
                    }
                }
            }
        }
    } catch (error) {
        console.error('Error in findUserInPublicServers:', error);
    }

    return { found: false };
};

client.login(DISCORD_TOKEN);