Giter Club home page Giter Club logo

discord-screenshot's Introduction

discord-screenshot

License Chat

You can also read this in Portuguese.

discord-screenshot is a resource for FiveM that captures the screen of a player and uploads it to a discord webhook.

Showcase

Installation

  1. Make sure your artifacts (windows or linux) are up to date.
  2. Extract the latest zip file at releases (discord-screenshot-x-x-x.zip) in your resources folder.
  3. Add ensure screenshot-basic and ensure discord-screenshot in your server.cfg.
  4. Adjust the configuration of the resource in the settings.json.

Configuration

  • webhookUrl - The url of your discord's webhook.
  • framework - The framework you are using (vrp or none).
  • commandName - The command name.
  • commandPermission - The permission to use the command.
  • hiddenIdentifiers - A list of the identifiers that won't be shown in the embed (e.g. ip).
  • screenshotOptions
    • encoding - The file format (png, jpg or webp)
    • quality - The image quality from 0.0 to 1.0.

Default usage

Note: If you pass -1 as target, the screen of all the players will be captured.

Standalone

/screenshot <player or identifier>

Can be used via the server console or by anyone with the ace permission request.screenshot.

vRP

/screenshot <user_id>

Can be used via the server console or by anyone with the permission request.screenshot.

Exports

Server

requestClientScreenshotUploadToDiscord

Captures the screen of the player and sends it to the configured discord's webhook.

Parameters:

  • player: string | number
  • webhookMessageData?: WebhookMessageData
  • timeoutMs?: number
  • callback?: (error?: string) => void

Example:

exports["discord-screenshot"]:requestClientScreenshotUploadToDiscord(
    GetPlayers()[1],
    {
        username = "A cat",
        avatar_url = "https://cdn2.thecatapi.com/images/IboDUkK8K.jpg",
        content = "Meow!",
        embeds = {
            {
                color = 16771584,
                author = {
                    name = "Wow!",
                    icon_url = "https://cdn.discordapp.com/embed/avatars/0.png"
                },
                title = "I can send anything."
            }
        }
    },
    30000,
    function(error)
        if error then
            return print("^1ERROR: " .. error)
        end
        print("Sent screenshot successfully")
    end
)

requestCustomClientScreenshotUploadToDiscord

Captures the screen of the player and sends it to the specified discord's webhook.

Parameters:

  • player: string | number
  • webhookUrl: string
  • options?: object
    • encoding: 'png' | 'jpg' | 'webp'
    • quality: number
  • webhookMessageData?: WebhookMessageData
  • timeoutMs?: number
  • callback?: (error?: string) => void

Example:

exports["discord-screenshot"]:requestCustomClientScreenshotUploadToDiscord(
    GetPlayers()[1],
    "https://ptb.discord.com/api/webhooks/767824413780607097/WLjd77Y0CUvqXmhLCYzqkiZ-BrTpcGfNiZ7hXcJRgQxrU0YR8sy566MgMHgqRx8IZ9iu",
    {
        encoding = "png",
        quality = 1
    },
    {
        username = "A cat",
        avatar_url = "https://cdn2.thecatapi.com/images/IboDUkK8K.jpg",
        content = "Meow!",
        embeds = {
            {
                color = 16771584,
                author = {
                    name = "Wow!",
                    icon_url = "https://cdn.discordapp.com/embed/avatars/0.png"
                },
                title = "I can send anything."
            }
        }
    },
    30000,
    function(error)
        if error then
            return print("^1ERROR: " .. error)
        end
        print("Sent screenshot successfully")
    end
)

Dependencies

discord-screenshot's People

Contributors

jaimeadf avatar redrumrp avatar

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.