ax.chat¶
Source: gamemode/framework/libraries/sh_chat.lua
Chat system for registering chat types with commands, permissions, and custom formatting.
Documented functions: 12
Functions¶
ax.chat:Add(key, def)ax.chat:ApplyShortcuts(text)ax.chat:BuildFontName(baseFont, styles)ax.chat:CapitalizeSentences(text)ax.chat:DetectCapitalization(text)ax.chat:FixPronounI(text)ax.chat:Format(message, options)ax.chat:FormatWithMarkdown(message, baseFont)ax.chat:NormalizeSpacing(text)ax.chat:Parse(message)ax.chat:ParseMarkdown(text, baseFont, styles)ax.chat:Send(speaker, chatType, text, data, receivers)
ax.chat:Add(key, def)¶
Register a chat type definition.
Adds a chat mode to the registry and, on the client, automatically registers
matching slash commands that route through the chat system.
Default CanHear and CanSay callbacks are generated when omitted.
Realm: shared
Parameters
| Name | Type | Description |
|---|---|---|
key |
string |
Unique chat type identifier (for example "ic" or "y") |
def |
table |
Chat definition (name, prefix, hearDistance, formatting callbacks, etc.) |
Usage
ax.chat:ApplyShortcuts(text)¶
Apply chat shortcuts to text
Realm: shared
Parameters
| Name | Type | Description |
|---|---|---|
text |
string |
The text to process |
Returns
string: The text with shortcuts replaced
ax.chat:BuildFontName(baseFont, styles)¶
Build font name from active styles
Realm: shared
Parameters
| Name | Type | Description |
|---|---|---|
baseFont |
string |
The base font name |
styles |
table |
Table of active styles (bold, italic) |
Returns
string: The complete font name
ax.chat:CapitalizeSentences(text)¶
Capitalize the first letter of sentences
Realm: shared
Parameters
| Name | Type | Description |
|---|---|---|
text |
string |
The text to capitalize |
Returns
string: The capitalized text
ax.chat:DetectCapitalization(text)¶
Detect capitalization style of text
Realm: shared
Parameters
| Name | Type | Description |
|---|---|---|
text |
string |
The text to analyze |
Returns
string: "upper", "lower", or "mixed"
ax.chat:FixPronounI(text)¶
Fix pronoun "I" capitalization
Realm: shared
Parameters
| Name | Type | Description |
|---|---|---|
text |
string |
The text to fix |
Returns
string: The fixed text
ax.chat:Format(message, options)¶
Format a chat message with text processing and optional markdown
Realm: shared
Parameters
| Name | Type | Description |
|---|---|---|
message |
string |
The message to format |
options |
table |
Options table (baseFont, markdown) |
Returns
string: The formatted message
Usage
ax.chat:FormatWithMarkdown(message, baseFont)¶
Format a message with markdown support enabled.
Convenience wrapper around ax.chat:Format that forces markdown parsing.
Realm: shared
Parameters
| Name | Type | Description |
|---|---|---|
message |
string |
The message to format |
Returns
string: The formatted message with markdown tags applied
Usage
ax.chat:NormalizeSpacing(text)¶
Normalize spacing in text
Realm: shared
Parameters
| Name | Type | Description |
|---|---|---|
text |
string |
The text to normalize |
Returns
string: The normalized text
ax.chat:Parse(message)¶
Identifies which chat mode should be used based on text input Credits to helix for the logic
Realm: shared
Parameters
| Name | Type | Description |
|---|---|---|
message |
string |
The input message |
Returns
string: chatType The identified chat typestring: message The processed after the chat type prefix is removed
Usage
ax.chat:ParseMarkdown(text, baseFont, styles)¶
Parse Discord-style markdown into font tags Supports: italic, bold, bold+italic
Realm: shared
Parameters
| Name | Type | Description |
|---|---|---|
text |
string |
The text to parse |
baseFont |
string |
The base font name (default: "ax.small") |
styles |
table |
Active styles being applied |
Returns
string: The formatted text with font tags
ax.chat:Send(speaker, chatType, text, data, receivers)¶
Send a chat message to eligible receivers.
Validates the chat class, runs CanSay/CanHear, applies hooks, and
networks the final payload to recipients.
Realm: server
Parameters
| Name | Type | Description |
|---|---|---|
speaker |
Player\|Entity |
Message sender |
chatType |
string |
Registered chat type key |
text |
string |
Raw message text |
Returns
string|nil: text Final processed text when sent successfully
Usage