diff --git a/code/modules/tgui_input/say_modal/modal.dm b/code/modules/tgui_input/say_modal/modal.dm index 30f5805f46..17f229da49 100644 --- a/code/modules/tgui_input/say_modal/modal.dm +++ b/code/modules/tgui_input/say_modal/modal.dm @@ -130,4 +130,8 @@ if(type == "entry" || type == "force") handle_entry(type, payload) return TRUE + if(type == "lenwarn") + var/mlen = payload["length"] + var/maxlen = payload["maxlength"] + to_chat(client, span_warning(span_bold("Warning") + ": Message with [mlen] exceeded the maximum length of [maxlen].")) return FALSE diff --git a/tgui/packages/tgui-say/TguiSay.tsx b/tgui/packages/tgui-say/TguiSay.tsx index f7a4548761..c2b5cea690 100644 --- a/tgui/packages/tgui-say/TguiSay.tsx +++ b/tgui/packages/tgui-say/TguiSay.tsx @@ -51,7 +51,7 @@ export function TguiSay() { keyof typeof RADIO_PREFIXES | null >(null); const [size, setSize] = useState(WindowSize.Small); - const [maxLength, setMaxLength] = useState(1024); + const [maxLength, setMaxLength] = useState(4096); const [minimumHeight, setMinimumHeight] = useState(WindowSize.Small); const [minimumWidth, setMinimumWidth] = useState(WindowSize.Width); const [lightMode, setLightMode] = useState(false); @@ -117,14 +117,21 @@ export function TguiSay() { const iterator = channelIterator.current; const prefix = currentPrefix ?? ''; - if (value?.length && value.length < maxLength) { - chatHistory.current.add(value); - Byond.sendMessage('entry', { - channel: iterator.current(), - entry: iterator.isSay() ? prefix + value : value, - }); + if (value?.length) { + if (value.length < maxLength) { + chatHistory.current.add(value); + Byond.sendMessage('entry', { + channel: iterator.current(), + entry: iterator.isSay() ? prefix + value : value, + }); + } else { + Byond.sendMessage('lenwarn', { + length: value.length, + maxlength: maxLength, + }); + return; + } } - handleClose(); }