Jump to content
RAGE Multiplayer Community

[TUTORIAL] Sending Server logs to Discords


Recommended Posts

it's always useful to keep an eye on the activity of the server like players joining/leaving the server while you're chatting on discord. This can be achieved by using our lovely Webhook friends. This tutorial aims to give you knowledge about how to use those web-hooks to keep in contact with some server logs.

Creating a Webhook

It's really easy, create a channel go to channel settings -> webhooks -> Create a webhook

I'll call mine Spicy.



Copy the webhook URL and wait for further instructions.

Using the Webhook

Now we'll create a small server-side function that'll help us use the webhook.

const webhook = 'Insert webhook URL';
const serverLogo = 'Shiny logo URL'
const got = require('got'); // Fast beast request package

mp.discord = {}; // Global discord object bound to mp
mp.discord.colors = { // Nice colors to change the embed's color
    RED: 13632027,
    GREEN: 4289797,
    BLUE: 4886754,
    ORANGE: 16098851,
    BLACK: 1,
    WHITE: 16777215,
    GREY: 10197915,
    YELLOW: 16312092,
    BROWN: 9131818,
    CYAN: 5301186
* @function Our nice function send some logs
* @params:
* title: string (Title of the embed)
* msg: string (description of the log)
* fields: array of objects optional {name: string, value: string, inline: boolean}
* color: int optional (Default: GREY color) use mp.discord.colors.color for more colors
mp.discord.sendMessage = (title, msg, fields = [], color = mp.discord.colors.GREY) => {
    const embed = {
        "embeds": [{
            "author": {
                "name": mp.config.name, // Server's name
                "icon_url": serverLogo // Server's logo
            "title": title,
            "description": msg,
            "thumbnail": {
                "url": serverLogo
            "fields": fields,
            "color": color
    got.post(webhook, { // Method to post the log into discord webhook
        body: JSON.stringify(embed),
        headers: {
            'content-type': "application/json"

PS: Don't forget to do npm install got --save  before using this package.

Now here's a small example of how to use it:

// Triggers once player joins the server...

mp.events.add('playerJoin', (player) => {
	mp.discord.sendMessage(`Player joined the server [${mp.players.toArray().length}/${mp.config.maxplayers}]`, player.name, [], mp.discord.colors.GREEN);

// Another one with fields

mp.events.add('playerJoin', (player) => {
  let fields = [{
    name: `Player's IP`,
    value: player.ip,
    inline: false
  mp.discord.sendMessage(`Player joined the server [${mp.players.toArray().length}/${mp.config.maxplayers}]`, player.name, fields, mp.discord.colors.GREEN);




Now you have your own discord logger, use it wisely. Enjoy spamming discord....



  • Like 3
Link to comment
Share on other sites

  • 11 months later...
  • 5 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...