BanAPI Documentation
This documentation is relatively the same for v2.0.0 of the SentinelAPI, however to index/call a method properly in the BanAPI you must call it as SentinelAPI.BanAPI:method(...), an example would be: SentinelAPI.BanAPI:BanAsync(...)
This document provides an in-depth overview of the SentinelAPI module, which serves as the backbone for managing bans, unbans, and other moderation-related features in Sentinel. The API interacts with Roblox services and Sentinel Open Cloud API endpoints to enforce moderation effectively.
Module Overview
Dependencies:
Config: Configuration settings for Sentinel.Types: Type definitions used across Sentinel.Enum: Enum definitions for ban types and lengths.RichBan: Helper functions for advanced ban features.
SentinelAPI Methods
1. BanAsync
Bans a player from the experience.
Signature:
function BanAsync(Player: Player, BanConfig: types.BanConfig): booleanParameters:
Player: ThePlayerinstance to ban.BanConfig: A table with configuration details (seeBanConfigtype).
Returns:
boolean - Whether the ban was successful.
Example:
SentinelAPI:BanAsync(player, {
Moderator = 12345,
BanType = "Global",
BanLengthType = "Permanent",
PublicReason = "Violation of rules",
PrivateReason = "Severe offense",
BanUniversal = true,
})2. OfflineBanAsync
Bans a user by their UserId, even if they are offline.
Signature:
function OfflineBanAsync(UserId: number, BanConfig: types.BanConfig): booleanParameters:
UserId: The Roblox UserId to ban.BanConfig: A table with ban details (seeBanConfigtype).
Returns:
boolean - Whether the ban was successful.
3. BatchBanAsync
Bans multiple players at once.
Signature:
function BatchBanAsync(PlayerList: {Player}, BanConfig: types.BanConfig): (boolean, number, number)Parameters:
PlayerList: A list ofPlayerinstances to ban.BanConfig: Ban configuration details.
Returns:
boolean: Whether all bans were successful.number: Count of successful bans.number: Count of failed bans.
4. BatchOfflineBanAsync
Bans multiple users by their UserIds.
Signature:
function BatchOfflineBanAsync(UserIds: {number}, BanConfig: types.BanConfig): (boolean, number, number)Parameters:
UserIds: List of UserIds to ban.BanConfig: Ban configuration details.
Returns:
boolean: Whether all bans were successful.number: Count of successful bans.number: Count of failed bans.
5. UnbanAsync
Unbans a user by their UserId.
Signature:
function UnbanAsync(UserId: number, Reason: string): booleanParameters:
UserId: The UserId to unban.Reason: Reason for the unban.
Returns:
boolean - Whether the unban was successful.
6. IsPlayerBanned
Checks if a player is banned.
Signature:
function IsPlayerBanned(Player: Player): booleanParameters:
Player: ThePlayerinstance to check.
Returns:
boolean - Whether the player is banned.
7. IsUserIdBanned
Checks if a UserId is banned.
Signature:
function IsUserIdBanned(UserId: number): booleanParameters:
UserId: The UserId to check.
Returns:
boolean - Whether the UserId is banned.
8. GetPendingBans
Retrieves the list of pending bans.
Signature:
function GetPendingBans(): types.BanList?Returns:
types.BanList?: A list of pending bans ornilif an error occurs.
9. GetPendingUnbans
Retrieves the list of pending unbans.
Signature:
function GetPendingUnbans(): types.BanList?Returns:
types.BanList?: A list of pending unbans ornilif an error occurs.
10. ProccessPendingBans
Processes all pending bans and applies them.
Signature:
function ProccessPendingBans(): void11. ProccessPendingUnbans
Processes all pending unbans and applies them.
Signature:
function ProccessPendingUnbans(): void12. ReplicateUpdatedBan
Updates and replicates a ban.
Signature:
function ReplicateUpdatedBan(UserId: number, BanConfig: types.BanConfig): booleanParameters:
UserId: The UserId to update the ban for.BanConfig: Updated ban configuration.
Returns:
boolean - Whether the update was successful.
Error Handling
Errors during API calls (e.g., HTTP requests) are logged with warn statements when Config.DEBUG_INFO_ENABLED is true. Developers should monitor the output for warnings if operations fail.
Example Workflow
Ban a player temporarily:
SentinelAPI:BanAsync(player, { Moderator = 12345, BanType = "Experience", BanLengthType = "Temporary", BanLength = "1d", PublicReason = "Spamming", PrivateReason = "Chat abuse", BanUniversal = false, })Unban a player:
SentinelAPI:UnbanAsync(12345678, "Appeal accepted.")Process all pending bans:
SentinelAPI:ProccessPendingBans()
Last updated
Was this helpful?