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

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

    mp.players.forEach((target: PlayerMp) => {
        if (permissionSystem.doesPlayerHavePermission(target, 'account.staff.chat')) {
            ChatSystem.Message(target, `${ChatColors.custom(ChatColors.allStaff, 'all staff chat')}*! STAFF ${from}: ${message}`, 'discord', 'staff');
        }
    });

    res.sendStatus(200);
}
