Discord sender

Send discord message via webhook

rcore has even discord implementation, so you can simply send discord notification via webhook to any of your room.

Sending notification as rcore

rcore has sconfig that mean Server Config so it is visible only for server in this config you can find DiscordWebhook field, if you want to send message into this webhook only you can use method

your_serverside.lua
rcore = exports.rcore
rcore:sendDiscordMessage(title, message, color, footer)

Sending custom notification

other way if you want to send discord to any webhook for example in your own script you can use very similar native to it.

your_serverside.lua
rcore = exports.rcore
rcore:sendCustomDiscordMessage(webhook, title, message, color, footer)

Example of sending join notification

your_serverside.lua
rcore = exports.rcore

AddEventHandler('esx:playerLoaded', function(source)
    local xPlayer = ESX.GetPlayerFromId(source)
    if xPlayer then
        local webhook = ''
        local title = 'Player joined!'
        local message = string.format('Player %s has joined!', xPlayer.getName())
        local rcoreConfig = rcore:getConfig()
        local footer = 'cool script'
        
        rcore:sendCustomDiscordMessage(webhook, title, message, rcoreConfig.DiscordColors.Green, footer)
    end
    
end)

Colors

rcore has already table in config with colors, for more search for discord documentation

rcore/config.lua
Config.DiscordColors = {
    ['Green'] = 56108,
    ['Grey'] = 8421504,
    ['Red'] = 16711680,
    ['Orange'] = 16744192,
    ['Blue'] = 2061822,
    ['Purple'] = 11750815
}

Last updated

Was this helpful?