0ae.dev

Прокси для Discord-вебхуковDiscord webhook proxy

hooks.0ae.dev

Discord не принимает вебхуки с серверов Roblox. Этот прокси пересылает их за вас, соблюдает лимиты Discord и держит очередь, чтобы много серверов не положили ваш вебхук. Discord rejects webhooks sent from Roblox servers. This proxy forwards them for you, respects Discord’s limits and queues messages so many game servers don’t get your webhook banned.

проверяю статус…checking status…

Миграция за одну заменуMigrate with one replace

Возьмите ваш обычный вебхук и замените в нём только хост. Путь, токен и параметры остаются как есть.Take your normal webhook URL and change the host only. Path, token and query stay the same.

https://discord.com/api/webhooks/123/abc
https://hooks.0ae.dev/api/webhooks/123/abc
local HttpService = game:GetService("HttpService")
local URL = "https://hooks.0ae.dev/api/webhooks/ID/TOKEN"

local function send(payload)
	local ok, err = pcall(function()
		return HttpService:PostAsync(
			URL,
			HttpService:JSONEncode(payload),
			Enum.HttpContentType.ApplicationJson
		)
	end)
	if not ok then warn("webhook:", err) end -- 429 = queue full
end

send({ content = "Server started", username = "Game logs" })

Правка и удаление сообщенийEditing and deleting messages

Нужен RequestAsync: PostAsync умеет только POST. Добавьте ?wait=true, чтобы получить id сообщения.Use RequestAsync: PostAsync can only POST. Add ?wait=true to get the message id.

local json = { ["Content-Type"] = "application/json" }
local res = HttpService:RequestAsync({
	Url = URL .. "?wait=true", Method = "POST", Headers = json,
	Body = HttpService:JSONEncode({ content = "v1" }),
})
local id = HttpService:JSONDecode(res.Body).id

HttpService:RequestAsync({
	Url = URL .. "/messages/" .. id, Method = "PATCH", Headers = json,
	Body = HttpService:JSONEncode({ content = "v2" }),
})
HttpService:RequestAsync({ Url = URL .. "/messages/" .. id, Method = "DELETE" })

Как это работаетHow it works

Лимит Roblox: 500 HTTP-запросов в минуту с сервера, а Discord отдаёт вебхуку около 5 сообщений за 2 секунды. Собирайте события в один embed, а не шлите по одному.Roblox allows 500 HTTP requests per minute per server and Discord gives a webhook about 5 messages per 2 seconds. Batch events into one embed instead of sending them one by one.

Свой алиас: токен не попадает в игруYour own alias: keep the token out of the game

Алиас хранит ваш вебхук на сервере и отдаёт адрес /h/<id>. Можно задать секретный заголовок X-Hook-Secret, формат сообщения и смотреть журнал доставок. Если адрес утёк, удалите алиас: сам вебхук в Discord останется нетронутым.An alias stores your webhook server-side and gives you a /h/<id> URL. You can set a secret X-Hook-Secret header, a message format and see a delivery log. If the URL leaks, delete the alias; the Discord webhook itself stays untouched.

Roblox шлёт простой JSON, сервис собирает embed:Roblox sends simple JSON, the service builds the embed:

HttpService:RequestAsync({
	Url = "https://hooks.0ae.dev/h/YOUR_ALIAS_ID", Method = "POST",
	Headers = { ["Content-Type"] = "application/json", ["X-Hook-Secret"] = "YOUR_SECRET" },
	Body = HttpService:JSONEncode({
		title = "Player joined", text = player.Name, color = "#57F287",
		fields = { { name = "Place", value = tostring(game.PlaceId), inline = true } },
	}),
})

Секрет в скрипте виден всем, у кого есть доступ к месту; он защищает только от посторонних. Пинги (@everyone) в режимах simple и template отключены.A secret in a script is visible to anyone with access to the place; it only stops outsiders. Mentions (@everyone) are disabled in simple and template modes.

Управление алиасомManage an alias

СправкаReference

EndpointЧто делаетWhat it does
POST /api/webhooks/:id/:tokenОтправить сообщение (?wait, ?thread_id)Send a message (?wait, ?thread_id)
PATCH, DELETE …/messages/:idИзменить, удалить; GET читает сообщениеEdit, delete; GET reads a message
POST /h/:aliasОтправить через алиасSend through an alias
/api/aliasPOST создать; /:id GET, PATCH, DELETE, /:id/log GET; Authorization: Bearer <токен>POST create; /:id GET, PATCH, DELETE, /:id/log GET; Authorization: Bearer <token>
GET /statusСостояние сервисаService health