> For the complete documentation index, see [llms.txt](https://sbscripts.gitbook.io/sb-scripts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sbscripts.gitbook.io/sb-scripts/sb-chat/configuration.md).

# Configuration

```lua
Config = {}

-- ============================================================
--  GENERAL
-- ============================================================
Config.Notify                = 'sbnotify'    -- 'sbnotify' | 'qb-notify' | 'okokNotify' | 'ox_lib'
Config.ServerName            = 'Your Server Name' -- Used for the server category in chat messages. Change this to your server name.

-- 'fa' -> FontAwesome  (https://fontawesome.com/icons)
-- 'bi' -> Bootstrap Icons (https://icons.getbootstrap.com)
Config.IconLib                = 'fa'

Config.AccentColor           = '#f97316'
Config.ChatMessageBackground = 'E20D111A'

-- Location of chat on screen: 'top-left' | 'top-right' | 'top-center'
Config.ChatPosition           = 'top-left'

-- ============================================================
--  STAFF PERMISSIONS
--  Affects who can use /dm, /mute, /unmute, and /clearchat commands.
-- ============================================================
Config.StaffPermissions = {
    'god',
    'admin',
    'mod',
}

-- ===========================================================
--  DIRECT MESSAGES
--  /dm ID <message>  (/dm 1 Hello!) Will also notify the player with a notification. 
-- ============================================================
Config.DM = {
    enabled = true,
}

Config.DateDisplay        = '%I:%M%p' -- Default time format: 12hr https://www.lua.org/pil/22.1.html
Config.MaxMessageLength   = 500 -- Max characters allowed in a single message. Messages longer than this will be truncated.
Config.ShowCommandSuggestions = true    -- Show command suggestions in chat for all commands. Set to false to hide suggestions.
Config.SelfHideCommand    = 'hidechat'

Config.Cooldowns = {    -- Cooldowns in seconds for each command. Set to 0 to disable cooldowns.
    ooc  = 5,
    ad   = 60,
    anon = 60,
}

-- ============================================================
--  PLAYER ID DISPLAY
-- ============================================================
Config.ShowPlayerId = true -- Set to true to show player IDs in chat messages. Staff always see player IDs regardless of this setting.

-- ============================================================
--  JOIN / LEAVE MESSAGES
-- ============================================================
Config.JoinLeave = {
    enabled      = true,
    joinMessage  = 'has joined the server.',
    leaveMessage = 'has left the server.',
}

-- ============================================================
--  CATEGORY STYLING
--  Supports both hex and rgba colors. Hex colors must be in the format '#RRGGBB' or '#RRGGBBAA'.
--  https://htmlcolorcodes.com/ https://www.color-hex.com/
--  You can also specify a background color for the category by adding background = 'FFFFFFFF' similar to ad category. Otherwise will default to Config.ChatMessageBackground
-- ============================================================
Config.Categories = {
    ooc          = { color = '#4d9fff', icon = { fa = 'fa-solid fa-comment',              bi = 'bi bi-chat-dots-fill'   }, label = 'OOC'          },
    announcement = { color = '#ff4d4d', icon = { fa = 'fa-solid fa-bullhorn',              bi = 'bi bi-megaphone-fill'   }, label = 'ANNOUNCEMENT' },
    important    = { color = '#ffcc00', icon = { fa = 'fa-solid fa-triangle-exclamation',  bi = 'bi bi-exclamation-triangle-fill' }, label = 'IMPORTANT' },
    ad           = { color = 'FFFF8800', background = 'FF8F4601', icon = { fa = 'fa-solid fa-rectangle-ad', bi = 'bi bi-badge-ad-fill' }, label = 'AD' },
    server       = { color = '#33cc99', icon = { fa = 'fa-solid fa-server',                bi = 'bi bi-server'           }, label = Config.ServerName },
    twitch       = { color = '#9146ff', icon = { fa = 'fa-brands fa-twitch',               bi = 'bi bi-twitch'           }, label = 'TWITCH'       },
    youtube      = { color = '#ff0000', icon = { fa = 'fa-brands fa-youtube',              bi = 'bi bi-youtube'          }, label = 'YOUTUBE'      },
    twitter      = { color = '#1da1f2', icon = { fa = 'fa-brands fa-twitter',              bi = 'bi bi-twitter-x'        }, label = 'TWITTER'      },
    instagram    = { color = '#e1306c', icon = { fa = 'fa-brands fa-instagram',            bi = 'bi bi-instagram'        }, label = 'INSTAGRAM'    },
    join         = { color = '#2ecc71', icon = { fa = 'fa-solid fa-right-to-bracket',      bi = 'bi bi-box-arrow-in-right' }, label = 'JOINED'    },
    leave        = { color = '#e74c3c', icon = { fa = 'fa-solid fa-right-from-bracket',    bi = 'bi bi-box-arrow-right'  }, label = 'LEFT'         },
    leo          = { color = '#3b82f6', icon = { fa = 'fa-solid fa-shield-halved',         bi = 'bi bi-shield-lock-fill' }, label = 'LEO',   restrictedLabel = 'LEO Only'   },
    ems          = { color = '#ef4444', icon = { fa = 'fa-solid fa-truck-medical',         bi = 'bi bi-heart-pulse-fill' }, label = 'EMS',   restrictedLabel = 'EMS Only'   },
    staff        = { color = '#a855f7', icon = { fa = 'fa-solid fa-user-shield',           bi = 'bi bi-person-badge-fill' }, label = 'STAFF', restrictedLabel = 'Staff Only' },
    dm           = { color = '#f97316', icon = { fa = 'fa-solid fa-envelope',              bi = 'bi bi-envelope-fill'    }, label = 'DM'           },
    system       = { color = 'FFFF0000', icon = { fa = 'fa-solid fa-gear',                bi = 'bi bi-gear-fill'        }, label = 'SYSTEM'       },
    blocked      = { color = '#dc2626', icon = { fa = 'fa-solid fa-ban',                   bi = 'bi bi-slash-circle-fill' }, label = 'BLOCKED'     },
    anon         = { color = '#64748b', icon = { fa = 'fa-solid fa-user-secret',           bi = 'bi bi-incognito'        }, label = 'ANONYMOUS'    },
}

-- ============================================================
--  JOB CHANNELS
-- ============================================================
Config.JobChannels = {
    leo = {
        command    = 'leo', -- Chat will show only to players with the jobs specified in the jobs table below.
        allCommand = 'leoall',  -- Chat will show to all players, but only players with the jobs specified in the jobs table below can send messages.
        jobs       = { 'police', 'sast' },
        category   = 'leo',
    },
    ems = {
        command    = 'ems',
        allCommand = 'emsall',
        jobs       = { 'ambulance', 'fire', 'firefighter' },
        category   = 'ems',
    },
    -- Add more job channels here if needed, following the same structure as above.
    -- Also make sure to add a matching category in Config.Categories for each new job channel.
}

-- ============================================================
--  AUTO MESSAGES
-- ============================================================
Config.AutoMessages = {
    enabled  = true,
    random   = true,    -- true = random order, false = sequential order
    interval = 600,      -- seconds
    category = 'server',
    messages = {
        'Remember to follow the rules! Type /rules to view them in full.',
        "Having an issue? Use /report <message> to notify staff.",
        'Stay up to date with events and updates on our Discord!',
        "We are looking for new staff members, applications are open on the forums.",
    },
}

-- ============================================================
--  PLAYER ADS
-- ============================================================
Config.Ad = {
    enabled     = true,
    command     = 'ad',
    price       = 500,
    account     = 'bank',   -- 'bank' | 'cash'
    permissions = {},    -- empty = everyone can use /ad
}

-- ============================================================
--  SOCIAL MEDIA COMMANDS
--  Used for players to share their social media links in chat. Each command has its own category and can have its own permissions.
-- ============================================================
Config.SocialCommands = {
    youtube = {
        command = 'youtube',
        category = 'youtube',
        allowedIdentifiers = {},    -- empty = everyone can use /youtube
    },
    twitter = {
        command = 'twitter',
        category = 'twitter',
        allowedIdentifiers = {},
    },
    twitch = {
        command = 'twitch',
        category = 'twitch',
        allowedIdentifiers = {},
    },
    instagram = {
        command = 'instagram',
        category = 'instagram',
        allowedIdentifiers = {},
    },
    -- Add more social media commands here if needed, following the same structure as above.
    -- Also make sure to add a matching category in Config.Categories for each new social media command.
}

-- ============================================================
--  BLOCKED WORDS
-- ============================================================
Config.BlockedWords = {
    enabled       = true,
    notifySender  = true,
    caseSensitive = false,
}

Config.MatchWholeWords = true -- true = only match whole words, false = match any part of a word (e.g. 'bad' will match 'bad', 'badly', 'baddie', etc.)

-- ============================================================
--  ANONYMOUS CHAT
-- ============================================================
Config.Anonymous = {
    command     = 'anon',
    category    = 'anon',
    permissions = {},   -- empty = everyone can use /anon
}

-- ============================================================
--  MUTE
--  /mute ID <minutes>  (/mute 1 10)  Mutes player with ID 1 for 10 minutes. If no minutes are specified, the mute is permanent.
-- ============================================================
Config.Mute = {
    command        = 'mute',
    unmuteCommand  = 'unmute',
    defaultMinutes = 0, -- 0 = permanent mute
}

-- ============================================================
--  Clear chat command
-- ============================================================
Config.ClearChat = {
    command = 'clearchat',
    message = 'Chat has been purged by a staff member.',    -- Message to display in chat when cleared.
}

-- ============================================================
--  WEBHOOKS
--  Each category can have its own webhook. You can create a webhook for each category
--  and set the webhook URL here. If you don't want to use webhooks for a category, just leave the webhook field empty.
-- ============================================================
Config.Webhooks = {
    blockedWords = {
        webhook    = '',
        username   = 'Blocked Words',
        color      = 14164764,
    },
    ooc = {
        webhook    = '',
        username   = 'OOC Log',
        color      = 5088027,
    },
    staff = {
        webhook    = '',
        username   = 'Staff',
        color      = 11206847,
    },
    anon = {
        webhook    = '',
        username   = 'Anonymous',
        color      = 6579300,
    },
    ad = {
        webhook    = '',
        username   = 'Ads',
        color      = 16744448,
    },
    leo = {
        webhook    = '',
        username   = 'LEO',
        color      = 3899882,
    },
    ems = {
        webhook    = '',
        username   = 'EMS',
        color      = 15672067,
    },
    twitter = {
        webhook    = '',
        username   = 'Twitter',
        color      = 1942002,
    },
    instagram = {
        webhook    = '',
        username   = 'Instagram',
        color      = 14764782,
    },
    youtube = {
        webhook    = '',
        username   = 'YouTube',
        color      = 16711680,
    },
    twitch = {
        webhook    = '',
        username   = 'Twitch',
        color      = 9502720,
    },
}
```
