Вопрос Не отправляется запрос на вебхук в дискорде

  • 23
  • 1
Контакты для связи отсутствуют.
Добрый вечер! Решил значит написать скрипт, который бы выводил в дискорд то что пишут игроки. По какой-то причине ничего не работает.

гнилые яйки))0))):
hook.Add( "PlayerSay", "Discord", function( ply, text )
    http.Post( "[URL]https://discord.com/api/webhooks/1094370576036003861/gvlNeHxRNpeBYnA0TbbZ_y8aI52R3lUiDn6co_Zfb_eAoeqN6Zo4TBerxzLJwgouospf[/URL]", { content = text, username = ply:Nick() }, print("Work"), print("Error") )
end )
1681150788995.png
 
  • 59
  • 1
  • 15
Установи на сервер Release Version 1.8.1 · timschumi/gmod-chttp

И пользуйся на здоровье

gg:
    local http
    if pcall(require, 'chttp') and _G.CHTTP ~= nil then
        http = _G.CHTTP
    else
        return
    end
    local req = {
        method = 'POST',
        type = "application/json",
        url = 'Your API',
        body = util.TableToJSON(msg), -- Таблица в формате [URL="https://discord.com/developers/docs/reference#message-formatting"]Discord Developer Portal — API Docs for Bots and Developers[/URL]
        timeout = 30,
        headers = {
            ['User-Agent'] = 'Somename',
        },
        success = function()
        end,
        failed = function(r)
        end,
    }
    http(req)
 
Последнее редактирование:
  • 59
  • 1
  • 15
Установи на сервер Release Version 1.8.1 · timschumi/gmod-chttp

И пользуйся на здоровье

gg:
    local http
    if pcall(require, 'chttp') and _G.CHTTP ~= nil then
        http = _G.CHTTP
    else
        return
    end
    local req = {
        method = 'POST',
        type = "application/json",
        url = 'Your API',
        body = util.TableToJSON(msg), -- Таблица в формате [URL="https://discord.com/developers/docs/reference#message-formatting"]Discord Developer Portal — API Docs for Bots and Developers[/URL]
        timeout = 30,
        headers = {
            ['User-Agent'] = 'Somename',
        },
        success = function()
        end,
        failed = function(r)
        end,
    }
    http(req)
Небольшое пояснение json в table lua

JSON
gg:
{
    "content": "Hello, World!",
    "embeds": [{
        "title": "Hello, Embed!",
        "description": "This is an embedded message.",
        "thumbnail": {
        "url": "attachment://myfilename.png"
        },
        "image": {
        "url": "attachment://mygif.gif"
        }
    }],
    "message_reference": {
        "message_id": "233648473390448641"
    },
    "attachments": [{
        "id": 0,
        "description": "Image of a cute little cat",
        "filename": "myfilename.png"
    }, {
        "id": 1,
        "description": "Rickroll gif",
        "filename": "mygif.gif"
    }]
}

LUA
gg:
local msg = {

    content = "Hello, World!",

    embeds = {

        {

            title = "Hello, Embed!",

            description = "This is an embedded message.",

            thumbnail = {

                url = "attachment://myfilename.png"

            },

            image = {

                url = "attachment://mygif.gif"

            }

        }

    },

    message_reference = {

        message_id = "233648473390448641"

    },

    attachments = {

        {

            id = 0,

            description = "Image of a cute little cat",

            filename = "myfilename.png"

        },

        {

            id = 1,

            description = "Rickroll gif",

            filename = "mygif.png"

        }

    }

}
 
Активность
Пока что здесь никого нет
Сверху Снизу