Player Moderation API (Draft WIP) - lolmaxz/vrc-ts GitHub Wiki

Player Moderation API Documentation

The Player Moderation API allows you to manage player moderations within VRChat. This includes searching for player moderations you've made, moderating users (e.g., muting, blocking), unmoderating users, clearing all player moderations, retrieving specific player moderations, and deleting player moderations.

Player moderations are actions taken by users against other users to control their interaction in the game, such as muting or blocking. They are different from staff moderations, which are actions taken by VRChat staff.


Index

  1. searchPlayerModerations - Search player moderations you've made.
  2. moderateUser - Moderate a user (e.g., mute, block).
  3. clearAllPlayerModerations - Clear all player moderations you've made.
  4. getPlayerModeration - Retrieve a specific player moderation.
  5. deletePlayerModeration - Delete a specific player moderation.
  6. unmoderateUser - Remove a moderation from a user.

Endpoints

1. searchPlayerModerations

Search player moderations you've made.

Purpose

Retrieve a list of all player moderations made by you. This endpoint does not support pagination and will return all results. You can use query parameters to filter the results.

Method Signature

searchPlayerModerations(options?: {
  type?: 'mute' | 'unmute' | 'block' | 'unblock' | 'interactOn' | 'interactOff';
  targetUserId?: string;
}): Promise<PlayerModeration[]>

Parameters

  • options (object, optional):

    • type (string, optional):
      Filter moderations by type. Valid values are:

      • 'mute'
      • 'unmute'
      • 'block'
      • 'unblock'
      • 'interactOn'
      • 'interactOff'
    • targetUserId (string, optional):
      Filter moderations by the target user ID.

Returns

  • Promise<PlayerModeration[]>: A promise that resolves to an array of player moderation objects.

Example Usage

// Example: Retrieve all player moderations you've made
const moderations = await vrchatApi.playerModerationApi.searchPlayerModerations();
console.log(moderations);

// Example: Retrieve all 'block' type moderations
const blockModerations = await vrchatApi.playerModerationApi.searchPlayerModerations({
  type: 'block',
});
console.log(blockModerations);

// Example: Retrieve moderations against a specific user
const userModerations = await vrchatApi.playerModerationApi.searchPlayerModerations({
  targetUserId: 'usr_abcdef12-3456-7890-abcd-ef1234567890',
});
console.log(userModerations);

2. moderateUser

Moderate a user (e.g., mute, block).

Purpose

Apply a moderation action to a user. This can be used to mute, block, or perform other moderation actions against a user.

Method Signature

moderateUser(options: {
  moderated: string;
  type: 'mute' | 'block' | 'hideAvatar' | 'interactOff';
}): Promise<PlayerModeration>

Parameters

  • options (object, required):

    • moderated (string, required):
      The user ID of the user to moderate.

    • type (string, required):
      The type of moderation action to apply. Valid values are:

      • 'mute'
      • 'block'
      • 'hideAvatar'
      • 'interactOff'

Returns

  • Promise<PlayerModeration>: A promise that resolves to the player moderation object representing the action taken.

Example Usage

// Example: Mute a user
const muteModeration = await vrchatApi.playerModerationApi.moderateUser({
  moderated: 'usr_abcdef12-3456-7890-abcd-ef1234567890',
  type: 'mute',
});
console.log(muteModeration);

// Example: Block a user
const blockModeration = await vrchatApi.playerModerationApi.moderateUser({
  moderated: 'usr_abcdef12-3456-7890-abcd-ef1234567890',
  type: 'block',
});
console.log(blockModeration);

3. clearAllPlayerModerations

Clear all player moderations you've made.

Purpose

⚠️ Warning: This action will delete every single player moderation you've ever made. Use with caution.

Method Signature

clearAllPlayerModerations(): Promise<RequestSuccess>

Parameters

  • No parameters

Returns

  • Promise<RequestSuccess>: A promise that resolves to an object indicating the operation was successful.

Example Usage

// Example: Clear all player moderations
const response = await vrchatApi.playerModerationApi.clearAllPlayerModerations();
console.log(response); // { success: true }

4. getPlayerModeration

Retrieve a specific player moderation.

Purpose

Retrieve details of a specific player moderation by its moderation ID. This returns the same information as searchPlayerModerations, but for a single moderation.

Method Signature

getPlayerModeration(options: {
  playerModerationId: string;
}): Promise<PlayerModeration>

Parameters

  • options (object, required):

    • playerModerationId (string, required):
      The ID of the player moderation to retrieve.

Returns

  • Promise<PlayerModeration>: A promise that resolves to the player moderation object.

Example Usage

// Example: Get details of a specific player moderation
const moderation = await vrchatApi.playerModerationApi.getPlayerModeration({
  playerModerationId: 'pmod_abcdef12-3456-7890-abcd-ef1234567890',
});
console.log(moderation);

5. deletePlayerModeration

Delete a specific player moderation.

Purpose

Delete a specific player moderation based on its ID. This can be used to remove a moderation action you've previously applied. You can delete the same player moderation multiple times successfully.

Method Signature

deletePlayerModeration(options: {
  playerModerationId: string;
}): Promise<RequestSuccess>

Parameters

  • options (object, required):

    • playerModerationId (string, required):
      The ID of the player moderation to delete.

Returns

  • Promise<RequestSuccess>: A promise that resolves to an object indicating the operation was successful.

Example Usage

// Example: Delete a specific player moderation
const response = await vrchatApi.playerModerationApi.deletePlayerModeration({
  playerModerationId: 'pmod_abcdef12-3456-7890-abcd-ef1234567890',
});
console.log(response); // { success: true }

6. unmoderateUser

Remove a moderation from a user.

Purpose

Remove a moderation action previously applied to a user. For example, if you have muted a user and now want to unmute them.

Method Signature

unmoderateUser(options: {
  moderated: string;
  type: 'unmute' | 'unblock' | 'showAvatar' | 'interactOn';
}): Promise<RequestSuccess>

Parameters

  • options (object, required):

    • moderated (string, required):
      The user ID of the user to unmoderate.

    • type (string, required):
      The type of moderation action to remove. Valid values are:

      • 'unmute'
      • 'unblock'
      • 'showAvatar'
      • 'interactOn'

Returns

  • Promise<RequestSuccess>: A promise that resolves to an object indicating the operation was successful.

Example Usage

// Example: Unmute a user
const response = await vrchatApi.playerModerationApi.unmoderateUser({
  moderated: 'usr_abcdef12-3456-7890-abcd-ef1234567890',
  type: 'unmute',
});
console.log(response); // { success: true }

// Example: Unblock a user
const unblockResponse = await vrchatApi.playerModerationApi.unmoderateUser({
  moderated: 'usr_abcdef12-3456-7890-abcd-ef1234567890',
  type: 'unblock',
});
console.log(unblockResponse);

Additional Types and Enums

PlayerModerationType Enum

enum PlayerModerationType {
  Mute = 'mute',
  Unmute = 'unmute',
  Block = 'block',
  Unblock = 'unblock',
  HideAvatar = 'hideAvatar',
  ShowAvatar = 'showAvatar',
  InteractOff = 'interactOff',
  InteractOn = 'interactOn',
}

PlayerModeration Object Structure

type PlayerModeration = {
  id: string; // PlayerModerationObjectIdType
  type: PlayerModerationType;
  sourceUserId: string; // Your user ID
  sourceDisplayName: string; // Your display name
  targetUserId: string; // The user ID of the moderated user
  targetDisplayName: string; // The display name of the moderated user
  created: string; // Timestamp when the moderation was created
};

RequestSuccess Type

type RequestSuccess = {
  success: boolean;
};

Endpoints:

  1. searchPlayerModerations - Search player moderations you've made.
  2. moderateUser - Moderate a user (e.g., mute, block).
  3. clearAllPlayerModerations - Clear all player moderations you've made.
  4. getPlayerModeration - Retrieve a specific player moderation.
  5. deletePlayerModeration - Delete a specific player moderation.
  6. unmoderateUser - Remove a moderation from a user.

⚠️ **GitHub.com Fallback** ⚠️