Coder Social home page Coder Social logo

discord_command_logger's Introduction

discord_command_logger

Overview

This script is a logger for all commands executed from your server to your Discord :)

image

Creating Discord Webhook

How create Discord Webook here

Download & Installation

Download Using Git

cd resources
git clone https://github.com/lucianfialhobp/discord_command_logger.git discord_command_logger

Installation

  • Add this to your server.cfg:
ensure discord_command_logger
  • Set discord settings in config.lua
Config.discordWebHookUrl = 'YOUR_WEBHOOK_YOU_SET_HERE'
Config.discordWebHookImage = 'YOUR_WEBHOOK_IMAGE_YOU_SET_HERE'
  • Trigger commandLoggerDiscord:commandWasExecuted in resources/chat/cl_chat.lua:112 like this
RegisterNUICallback('chatResult', function(data, cb)
  chatInputActive = false
  SetNuiFocus(false)

  if not data.canceled then
    local id = PlayerId()

    --deprecated
    local r, g, b = 0, 0x99, 255

    if data.message:sub(1, 1) == '/' then
      ExecuteCommand(data.message:sub(2))
      -- Trigger Event 'commandLoggerDiscord:commandWasExecuted' below like this
      TriggerServerEvent('commandLoggerDiscord:commandWasExecuted', id, data)
    else
      TriggerServerEvent('_chat:messageEntered', GetPlayerName(id), { r, g, b }, data.message)
    end
  end

  cb('ok')
end)

discord_command_logger's People

Contributors

gckoo avatar lucianfialho avatar slypher avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

discord_command_logger's Issues

this can help with issues

I had some issues when i dowloaded this file first of all when i doed any command it comed x2 like if i doed /car adder i had 2 adder.
this is work

RegisterNUICallback('chatResult', function(data, cb)
chatInputActive = false
SetNuiFocus(false)

if not data.canceled then
local id = PlayerId()

--deprecated
local r, g, b = 0, 0x99, 255

if data.message:sub(1, 1) == '/' then
  ExecuteCommand(data.message:sub(255))
  -- Trigger Event 'commandLoggerDiscord:commandWasExecuted' below like this
  TriggerServerEvent('commandLoggerDiscord:commandWasExecuted', id, data)
else
  TriggerServerEvent('chat:messageEntered', GetPlayerName(id), { r, g, b }, data.message)
end

end

cb('ok')
end)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.