mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
feat: server-side lobby message moderation metadata API (#5191)
This commit is contained in:
@@ -625,6 +625,9 @@ export function createBotHelpers<TProps extends TransformersDesiredProperties, T
|
||||
unlinkChannelToLobby: async (lobbyId, bearerToken) => {
|
||||
return bot.transformers.lobby(bot, snakelize(await bot.rest.unlinkChannelToLobby(lobbyId, bearerToken)));
|
||||
},
|
||||
updateLobbyMessageModerationMetadata: async (lobbyId, messageId, options) => {
|
||||
return await bot.rest.updateLobbyMessageModerationMetadata(lobbyId, messageId, options);
|
||||
},
|
||||
getTargetUsers: async (inviteCode) => {
|
||||
return await bot.rest.getTargetUsers(inviteCode);
|
||||
},
|
||||
@@ -1164,6 +1167,7 @@ export type BotHelpers<TProps extends TransformersDesiredProperties, TBehavior e
|
||||
addMemberToLobby: (lobbyId: BigString, userId: BigString, options: AddLobbyMember) => Promise<SetupDesiredProps<LobbyMember, TProps, TBehavior>>;
|
||||
linkChannelToLobby: (lobbyId: BigString, bearerToken: string, options: LinkChannelToLobby) => Promise<SetupDesiredProps<Lobby, TProps, TBehavior>>;
|
||||
unlinkChannelToLobby: (lobbyId: BigString, bearerToken: string) => Promise<SetupDesiredProps<Lobby, TProps, TBehavior>>;
|
||||
updateLobbyMessageModerationMetadata: (lobbyId: BigString, messageId: BigString, options: Record<string, string>) => Promise<void>;
|
||||
getTargetUsers: (inviteCode: string) => Promise<string>;
|
||||
updateTargetUsers: (inviteCode: string, targetUsersFile: Blob) => Promise<void>;
|
||||
getTargetUsersJobStatus: (inviteCode: string) => Promise<Camelize<DiscordTargetUsersJobStatus>>;
|
||||
|
||||
@@ -1927,6 +1927,12 @@ export function createRestManager(options: CreateRestManagerOptions): RestManage
|
||||
});
|
||||
},
|
||||
|
||||
async updateLobbyMessageModerationMetadata(lobbyId, messageId, options) {
|
||||
await rest.put(rest.routes.lobby.moderationMetadata(lobbyId, messageId), {
|
||||
body: options,
|
||||
});
|
||||
},
|
||||
|
||||
preferSnakeCase(enabled: boolean) {
|
||||
const camelizer = enabled ? (x: any) => x : camelize;
|
||||
|
||||
|
||||
@@ -694,6 +694,10 @@ export function createRoutes(disableURIEncode: boolean = false): RestRoutes {
|
||||
link: (lobbyId) => {
|
||||
return `/lobbies/${encode(lobbyId)}/channel-linking`;
|
||||
},
|
||||
|
||||
moderationMetadata: (lobbyId, messageId) => {
|
||||
return `/lobbies/${encode(lobbyId)}/messages/${encode(messageId)}/moderation-metadata`;
|
||||
},
|
||||
},
|
||||
|
||||
applicationEmoji(applicationId, emojiId) {
|
||||
|
||||
@@ -3287,6 +3287,21 @@ export interface RestManager {
|
||||
* Uses bearer token for authorization and the user must be a lobby member with the CanLinkLobby lobby member flag.
|
||||
*/
|
||||
unlinkChannelToLobby: (lobbyId: BigString, bearerToken: string) => Promise<Camelize<DiscordLobby>>;
|
||||
/**
|
||||
* Sets the moderation metadata for a lobby message. The metadata is app-scoped and delivered to active game clients via the Social SDK as a realtime message update.
|
||||
*
|
||||
* @param lobbyId - The ID of the lobby to set the moderation metadata
|
||||
* @param messageId - The ID of the message to set the moderation metadata
|
||||
* @param options - The moderation metadata to set
|
||||
*
|
||||
* @remarks
|
||||
* Uses `Bot` token for authorization.
|
||||
*
|
||||
* For the options: Free-form key–value pairs describing the moderation decision. Up to 5 keys; key length <= 1024 characters; value length <= 2000 characters
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/game-sdk/social-sdk/chat-moderation#server-side-chat-moderation} for the full moderation flow.
|
||||
*/
|
||||
updateLobbyMessageModerationMetadata: (lobbyId: BigString, messageId: BigString, options: Record<string, string>) => Promise<void>;
|
||||
}
|
||||
|
||||
export type RequestMethods = 'GET' | 'POST' | 'DELETE' | 'PATCH' | 'PUT';
|
||||
|
||||
@@ -316,6 +316,8 @@ export interface RestRoutes {
|
||||
leave: (lobbyId: BigString) => string;
|
||||
/** Route to link a lobby */
|
||||
link: (lobbyId: BigString) => string;
|
||||
/** Route to set the lobby moderation metadata */
|
||||
moderationMetadata: (lobbyId: BigString, messageId: BigString) => string;
|
||||
};
|
||||
/** Route to list / create an application emoji */
|
||||
applicationEmojis: (applicationId: BigString) => string;
|
||||
|
||||
Reference in New Issue
Block a user