LogoAntiRaid

@antiraid-ext/utils/stingmanager

API reference for @antiraid-ext/utils/stingmanager

@antiraid-ext/utils/stingmanager

Types

Sting

Raw Type
type Sting = {
	stingId: string,

	userId: discord.Snowflake,

	modId: discord.Snowflake?,

	stings: number,

	reason: string,

	created_at: datetime.DateTime,

	expires_at: datetime.DateTime?
}
PropTypeDescription
stingId
-
userId
-
modId?
-
stings
-
reason
-
created_at
-
expires_at?
-

CreateSting

Raw Type
type CreateSting = {
	userId: discord.Snowflake,

	modId: discord.Snowflake?,

	stings: number?,

	reason: string,

	expires_at: datetime.DateTime?
}
PropTypeDescription
userId
-
modId?
-
stings?
-
reason
-
expires_at?
-

StingManager

[[ Manages the moderation 'stings' (think bee stings!) of a user. ]]

Raw Type
--[[
    Manages the moderation 'stings' (think bee stings!) of a user.
]]
type StingManager = {
	--- Gets all the stings a user has accrued
	getStingsOnUser: (userId: discord.Snowflake) -> {Sting},

	--- Gets a single sting by its ID
	getSting: (userId: discord.Snowflake, stingId: string) -> Sting?,

	--- Creates a new sting for a user returning a Sting
	createUserSting: (sting: CreateSting) -> Sting,

	--- Sets the expiration of a sting. Repeated calls override previous expiration
	setStingExpiration: (userId: discord.Snowflake, stingId: string, reason: string, expiresAt: datetime.DateTime) -> (),

	--- Deletes the expiration of a sting
	deleteStingExpiration: (userId: discord.Snowflake, stingId: string) -> (),

	--- Deletes a sting. Note that this does not delete the expiration task (use fullyDeleteSting if you want to do that)
	deleteSting: (userId: discord.Snowflake, stingId: string, mod: string?, auditReason: string) -> (),

	--- Returns the cached list of stings for a user. If the cache is expired, it will fetch the stings from the kv store
	getCachedUserStings: (userId: string) -> {Sting},

	--- Manually update the cached list of stings for a user
	--- This is useful for when you know the stings have changed and you want to update the cache
	updateCachedUserStings: (userId: string, stings: {Sting}) -> nil,

	--- Clears the cached list of stings for a user
	clearCachedUserStings: (userId: string) -> nil,

	--- Compactly stringifies a sting
	stingCompactString: (sting: Sting) -> string
}
PropTypeDescription
getStingsOnUser
(userId: discord.Snowflake) -> {Sting}
Gets all the stings a user has accrued
getSting
(userId: discord.Snowflake, stingId: string) -> Sting?
Gets a single sting by its ID
createUserSting
(sting: CreateSting) -> Sting
Creates a new sting for a user returning a Sting
setStingExpiration
(userId: discord.Snowflake, stingId: string, reason: string, expiresAt: datetime.DateTime) -> ()
Sets the expiration of a sting. Repeated calls override previous expiration
deleteStingExpiration
(userId: discord.Snowflake, stingId: string) -> ()
Deletes the expiration of a sting
deleteSting
(userId: discord.Snowflake, stingId: string, mod: string?, auditReason: string) -> ()
Deletes a sting. Note that this does not delete the expiration task (use fullyDeleteSting if you want to do that)
getCachedUserStings
(userId: string) -> {Sting}
Returns the cached list of stings for a user. If the cache is expired, it will fetch the stings from the kv store
updateCachedUserStings
(userId: string, stings: {Sting}) -> nil
Manually update the cached list of stings for a userThis is useful for when you know the stings have changed and you want to update the cache
clearCachedUserStings
(userId: string) -> nil
Clears the cached list of stings for a user
stingCompactString
(sting: Sting) -> string
Compactly stringifies a sting

Functions

StingManager

2 minutes

Function Signature
-- 2 minutes
function StingManager(ctx: Primitives.TemplateContext) -> StingManager end

Arguments

ctx

Primitives.TemplateContext

Returns

ret1

StingManager

Last updated on