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

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

    mp.players.forEach((player) => {
        if (staffSystem.isAdmin(player)) {
            ChatSystem.Message(player, `${ChatColors.custom(ChatColors.yellow, 'admin chat')}*!Admin ${from}: ${message}`, 'discord', 'staff');
        }
    });

    res.sendStatus(200);
}
