SentinelAPI Documentation

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): boolean

Parameters:

  • Player: The Player instance to ban.

  • BanConfig: A table with configuration details (see BanConfig type).

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): boolean

Parameters:

  • UserId: The Roblox UserId to ban.

  • BanConfig: A table with ban details (see BanConfig type).

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 of Player instances 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): boolean

Parameters:

  • 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): boolean

Parameters:

  • Player: The Player instance to check.

Returns: boolean - Whether the player is banned.


7. IsUserIdBanned

Checks if a UserId is banned.

Signature:

function IsUserIdBanned(UserId: number): boolean

Parameters:

  • 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 or nil if an error occurs.


9. GetPendingUnbans

Retrieves the list of pending unbans.

Signature:

function GetPendingUnbans(): types.BanList?

Returns:

  • types.BanList?: A list of pending unbans or nil if an error occurs.


10. ProccessPendingBans

Processes all pending bans and applies them.

Signature:

function ProccessPendingBans(): void

11. ProccessPendingUnbans

Processes all pending unbans and applies them.

Signature:

function ProccessPendingUnbans(): void

12. ReplicateUpdatedBan

Updates and replicates a ban.

Signature:

function ReplicateUpdatedBan(UserId: number, BanConfig: types.BanConfig): boolean

Parameters:

  • 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

  1. Ban a player temporarily:

    SentinelAPI:BanAsync(player, {
        Moderator = 12345,
        BanType = "Experience",
        BanLengthType = "Temporary",
        BanLength = "1d",
        PublicReason = "Spamming",
        PrivateReason = "Chat abuse",
        BanUniversal = false,
    })
  2. Unban a player:

    SentinelAPI:UnbanAsync(12345678, "Appeal accepted.")
  3. Process all pending bans:

    SentinelAPI:ProccessPendingBans()

Last updated