Add messaging service publish method
All checks were successful
Test, Build, Deploy / Test, Build, and Deploy (push) Successful in 59s
Test, Build, Deploy / Create Sentry Release (push) Successful in 5s

This commit is contained in:
2026-04-13 03:04:02 -04:00
parent 2d9f03c394
commit f5e3e3cca6

View File

@@ -1,6 +1,9 @@
const DATASTORE_URL =
"https://apis.roblox.com/cloud/v2/universes/274816972/data-stores/BanData/entries/CloudBanList";
const MESSAGING_SERVICE_URL =
"https://apis.roblox.com/cloud/v2/universes/274816972:publishMessage";
const SAVE_DATA_URL =
"https://apis.roblox.com/cloud/v2/universes/274816972/data-stores/RealData/entries";
@@ -31,6 +34,28 @@ export async function getBanList(context: RequestContext) {
};
}
export async function publishMessage(
context: RequestContext,
topic: string,
message: string,
) {
const response = await fetch(MESSAGING_SERVICE_URL, {
body: JSON.stringify({
message,
topic,
}),
headers: {
"Content-Type": "application/json",
"x-api-key": context.env.ROBLOX_OPENCLOUD_KEY,
},
method: "POST",
});
if (!response.ok) {
throw new Error("Failed to publish message\n" + (await response.text()));
}
}
export async function getSaveData(
context: RequestContext,
user: number,