Player Moderation API (Draft WIP) - lolmaxz/vrc-ts GitHub Wiki
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.
-
searchPlayerModerations
- Search player moderations you've made. -
moderateUser
- Moderate a user (e.g., mute, block). -
clearAllPlayerModerations
- Clear all player moderations you've made. -
getPlayerModeration
- Retrieve a specific player moderation. -
deletePlayerModeration
- Delete a specific player moderation. -
unmoderateUser
- Remove a moderation from a user.
Search player moderations you've made.
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.
searchPlayerModerations(options?: {
type?: 'mute' | 'unmute' | 'block' | 'unblock' | 'interactOn' | 'interactOff';
targetUserId?: string;
}): Promise<PlayerModeration[]>
-
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.
-
-
Promise<PlayerModeration[]>
: A promise that resolves to an array of player moderation objects.
// 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);
Moderate a user (e.g., mute, block).
Apply a moderation action to a user. This can be used to mute, block, or perform other moderation actions against a user.
moderateUser(options: {
moderated: string;
type: 'mute' | 'block' | 'hideAvatar' | 'interactOff';
}): Promise<PlayerModeration>
-
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'
-
-
Promise<PlayerModeration>
: A promise that resolves to the player moderation object representing the action taken.
// 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);
Clear all player moderations you've made.
clearAllPlayerModerations(): Promise<RequestSuccess>
- No parameters
-
Promise<RequestSuccess>
: A promise that resolves to an object indicating the operation was successful.
// Example: Clear all player moderations
const response = await vrchatApi.playerModerationApi.clearAllPlayerModerations();
console.log(response); // { success: true }
Retrieve a specific player moderation.
Retrieve details of a specific player moderation by its moderation ID. This returns the same information as searchPlayerModerations
, but for a single moderation.
getPlayerModeration(options: {
playerModerationId: string;
}): Promise<PlayerModeration>
-
options
(object, required):-
playerModerationId
(string, required):
The ID of the player moderation to retrieve.
-
-
Promise<PlayerModeration>
: A promise that resolves to the player moderation object.
// Example: Get details of a specific player moderation
const moderation = await vrchatApi.playerModerationApi.getPlayerModeration({
playerModerationId: 'pmod_abcdef12-3456-7890-abcd-ef1234567890',
});
console.log(moderation);
Delete a specific player moderation.
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.
deletePlayerModeration(options: {
playerModerationId: string;
}): Promise<RequestSuccess>
-
options
(object, required):-
playerModerationId
(string, required):
The ID of the player moderation to delete.
-
-
Promise<RequestSuccess>
: A promise that resolves to an object indicating the operation was successful.
// Example: Delete a specific player moderation
const response = await vrchatApi.playerModerationApi.deletePlayerModeration({
playerModerationId: 'pmod_abcdef12-3456-7890-abcd-ef1234567890',
});
console.log(response); // { success: true }
Remove a moderation from a user.
Remove a moderation action previously applied to a user. For example, if you have muted a user and now want to unmute them.
unmoderateUser(options: {
moderated: string;
type: 'unmute' | 'unblock' | 'showAvatar' | 'interactOn';
}): Promise<RequestSuccess>
-
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'
-
-
Promise<RequestSuccess>
: A promise that resolves to an object indicating the operation was successful.
// 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);
enum PlayerModerationType {
Mute = 'mute',
Unmute = 'unmute',
Block = 'block',
Unblock = 'unblock',
HideAvatar = 'hideAvatar',
ShowAvatar = 'showAvatar',
InteractOff = 'interactOff',
InteractOn = 'interactOn',
}
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
};
type RequestSuccess = {
success: boolean;
};
-
searchPlayerModerations
- Search player moderations you've made. -
moderateUser
- Moderate a user (e.g., mute, block). -
clearAllPlayerModerations
- Clear all player moderations you've made. -
getPlayerModeration
- Retrieve a specific player moderation. -
deletePlayerModeration
- Delete a specific player moderation. -
unmoderateUser
- Remove a moderation from a user.