import express from 'express';
import { ChatSystem } from '../../../../features/chat';
import { ChatColors } from '../../../../const/chat-colors';
import { staffSystem } from '../../../../features/staff';

export async function TesterChat(req: express.Request, res: express.Response) {
    const message = req.body.message;
    const from = req.body.from;

    mp.players.forEach((player) => {
        if (staffSystem.isPlayerSupport(player) || (staffSystem.isAdmin(player) && staffSystem.isOnPlayerSupportDuty(player))) {
            ChatSystem.Message(player, `${ChatColors.custom(ChatColors.testerChat, 'tester chat')}**! ${from}: ${message}`, 'discord', 'staff');
        }
    });

    res.sendStatus(200);
}
