LogoAntiRaid

@antiraid-core/settings

API reference for @antiraid-core/settings

@antiraid-core/settings

Types

ColumnSuggestion

A suggestion for a column. Can either be a static set of suggestions or no suggestions at all.

Raw Type
--- A suggestion for a column. Can either be a static set of suggestions or no suggestions at all.
type ColumnSuggestion = {
	type: "None"
} | {
	type: "Static",

	suggestions: {string}
}

Union with variants:

Variant 1
PropTypeDescription
type
'None'
-
Variant 2
PropTypeDescription
type
'Static'
-
suggestions
-

ColumnType

The type-specific data about a column

Raw Type
--- The type-specific data about a column
type ColumnType = {
	type: "Scalar" | "Array",

	inner: InnerColumnType
}
PropTypeDescription
type
('Scalar' | 'Array')
-
inner
-

InnerColumnType

Raw Type
type InnerColumnType = {
	type: "String",

	--- @field number The minimum length of the string
	min_length: number?,

	--- @field number The maximum length of the string
	max_length: number?,

	--- @field {string} The allowed values for the string (will be rendered as either a select menu or otherwise)
	---
	--- If empty, all values are allowed.
	allowed_values: {string},

	--- @field {string}? The suggestions for the string. If not set, no suggestions will be shown.
	suggestions: {string}?,

	--- @field string The kind of string this is. This will be used to determine how the string is rendered client-side.
	--- e.g. textarea, channel, user, role, kittycat-permission, uuid, interval, timestamp etc.
	kind: string
} | {
	type: "Integer"
} | {
	type: "Float"
} | {
	type: "BitFlag",

	--- @field {string} The bitflag values as a hashmap
	values: {
		[string]: number
	}
} | {
	type: "Boolean"
} | {
	type: "Json",

	--- @field Style to use when rendering the JSON object
	style: string
}

Union with variants:

Variant 1
PropTypeDescription
type
'String'
-
min_length?
-
max_length?
-
allowed_values
If empty, all values are allowed.
suggestions?
-
kind
e.g. textarea, channel, user, role, kittycat-permission, uuid, interval, timestamp etc.
Variant 2
PropTypeDescription
type
'Integer'
-
Variant 3
PropTypeDescription
type
'Float'
-
Variant 4
PropTypeDescription
type
'BitFlag'
-
values
{[string]: number}
-
Variant 5
PropTypeDescription
type
'Boolean'
-
Variant 6
PropTypeDescription
type
'Json'
-
style
-

Column

A column in a setting

Raw Type
--- A column in a setting
type Column = {
	--- @field string The ID of the column
	id: string,

	--- @field string The friendly name of the column
	name: string,

	--- @field string The description of the column
	description: string,

	--- @field ColumnType The type of the column
	column_type: ColumnType,

	--- @field string Is this column a primary key? This can be used when rendering the column in the UI.
	primary_key: boolean,

	--- @field boolean Whether or not the column is nullable
	nullable: boolean,

	--- @field {string} The operations for which the field should be hidden (essentially, not shown in the UI)
	hidden: {string}?,

	--- @field {string} The operations for which the field should be read only in the UI
	readonly: {string}
}
PropTypeDescription
id
-
name
-
description
-
column_type
-
primary_key
-
nullable
-
hidden?
-
readonly
-

Setting

Raw Type
type Setting = {
	--- @field string The ID of the option
	id: string,

	--- @field string The name of the option
	name: string,

	--- @field string The description of the option
	description: string,

	--- @field string View template, used for setting the title of the embed and handling client side errors etc.
	view_template: string?,

	--- @field {Column} The columns for this option
	columns: {Column},

	--- @field string? Index by
	---
	--- If set, all options within the setting will be draggable with the provided index field (must be
	--- a integer being set to the position of the item in the list)
	index_by: string?,

	--- @field SettingOperations The supported operations for this option
	operations: {string},

	--- Icon to use for the setting
	icon: string?,

	--- Client side validation script
	validation_template: string?,

	--- Post-send script to run after the setting has been sent to the server
	postsend_template: string?,

	--- DEPRACRATED, but still used in production badgerfang (TO REMOVE)
	title_template: string?
}
PropTypeDescription
id
-
name
-
description
-
view_template?
-
columns
-
index_by?
If set, all options within the setting will be draggable with the provided index field (must bea integer being set to the position of the item in the list)
operations
-
icon?
Icon to use for the setting
validation_template?
Client side validation script
postsend_template?
Post-send script to run after the setting has been sent to the server
title_template?
DEPRACRATED, but still used in production badgerfang (TO REMOVE)

Last updated on