LogoAntiRaid

@antiraid-core/plugins/discord

API reference for @antiraid-core/plugins/discord

@antiraid-core/plugins/discord

Types

GetAuditLogOptions

Options for getting audit logs in Discord

Raw Type
--- Options for getting audit logs in Discord
type GetAuditLogOptions = {
	--- The action type to filter by
	action_type: discord.AuditLogEventType?,

	--- The user ID to filter by
	user_id: discord.Snowflake?,

	--- The audit log entry ID to filter
	before: discord.Snowflake?,

	--- The number of entries to return
	limit: number?
}
PropTypeDescription
action_type?
The action type to filter by
user_id?
The user ID to filter by
before?
The audit log entry ID to filter
limit?
The number of entries to return

GetAutoModerationRuleOptions

Options for getting an auto moderation rule in Discord

Raw Type
--- Options for getting an auto moderation rule in Discord
type GetAutoModerationRuleOptions = {
	--- The rule ID
	rule_id: discord.Snowflake
}
PropTypeDescription
rule_id
The rule ID

CreateAutoModerationRuleOptions

Options for creating an auto moderation rule in Discord

Raw Type
--- Options for creating an auto moderation rule in Discord
type CreateAutoModerationRuleOptions = {
	--- The reason for creating the rule
	reason: string,

	--- The data to create the rule with
	data: discordRest.CreateAutoModerationRuleRequest
}
PropTypeDescription
reason
The reason for creating the rule
data
The data to create the rule with

EditAutoModerationRuleOptions

Options for editing an auto moderation rule in Discord

Raw Type
--- Options for editing an auto moderation rule in Discord
type EditAutoModerationRuleOptions = {
	--- The rule ID
	rule_id: discord.Snowflake,

	--- The reason for editing the rule
	reason: string,

	--- The data to edit the rule with
	data: discordRest.ModifyAutoModerationRuleRequest
}
PropTypeDescription
rule_id
The rule ID
reason
The reason for editing the rule
data
The data to edit the rule with

DeleteAutoModerationRuleOptions

Options for deleting an auto moderation rule in Discord

Raw Type
--- Options for deleting an auto moderation rule in Discord
type DeleteAutoModerationRuleOptions = {
	--- The rule ID
	rule_id: discord.Snowflake,

	--- The reason for deleting the rule
	reason: string
}
PropTypeDescription
rule_id
The rule ID
reason
The reason for deleting the rule

EditChannelOptions

Options for editing a channel in Discord

Raw Type
--- Options for editing a channel in Discord
type EditChannelOptions = {
	--- The channel ID
	channel_id: discord.Snowflake,

	--- The reason for the edit
	reason: string,

	--- The data to edit the channel with
	data: discordRest.ModifyChannelRequest
}
PropTypeDescription
channel_id
The channel ID
reason
The reason for the edit
data
The data to edit the channel with

DeleteChannelOptions

Options for deleting a channel in Discord

Raw Type
--- Options for deleting a channel in Discord
type DeleteChannelOptions = {
	--- The channel ID
	channel_id: discord.Snowflake,

	--- The reason for the deletion
	reason: string
}
PropTypeDescription
channel_id
The channel ID
reason
The reason for the deletion

EditChannelPermissionsOptions

Options for editting channel permissions

Raw Type
--- Options for editting channel permissions
type EditChannelPermissionsOptions = {
	--- The channel ID
	channel_id: discord.Snowflake,

	--- The target ID to edit permissions of
	target_id: discord.Snowflake,

	--- The allow permissions
	allow: typesext.MultiOption<string>,

	--- The deny permissions
	deny: typesext.MultiOption<string>,

	--- The type of the target
	kind: discord.OverwriteObjectType,

	--- The reason for the edit
	reason: string
}
PropTypeDescription
channel_id
The channel ID
target_id
The target ID to edit permissions of
allow
The allow permissions
deny
The deny permissions
kind
The type of the target
reason
The reason for the edit

CreateChannelOptions

Options for editing a channel in Discord

Raw Type
--- Options for editing a channel in Discord
type CreateChannelOptions = {
	--- The reason for the create
	reason: string,

	--- The data to edit the channel with
	data: discordRest.CreateGuildChannelRequest
}
PropTypeDescription
reason
The reason for the create
data
The data to edit the channel with

AddGuildMemberRoleOptions

Options for adding a role to a member

Raw Type
--- Options for adding a role to a member
type AddGuildMemberRoleOptions = {
	--- The member ID
	user_id: discord.Snowflake,

	--- The role ID
	role_id: discord.Snowflake,

	--- The reason for adding the role
	reason: string
}
PropTypeDescription
user_id
The member ID
role_id
The role ID
reason
The reason for adding the role

RemoveGuildMemberRoleOptions

Options for removing a role from a member

Raw Type
--- Options for removing a role from a member
type RemoveGuildMemberRoleOptions = {
	--- The member ID
	user_id: discord.Snowflake,

	--- The role ID
	role_id: discord.Snowflake,

	--- The reason for adding the role
	reason: string
}
PropTypeDescription
user_id
The member ID
role_id
The role ID
reason
The reason for adding the role

RemoveGuildMemberOptions

Options for removing a member from a guild

Raw Type
--- Options for removing a member from a guild
type RemoveGuildMemberOptions = {
	--- The member ID
	user_id: discord.Snowflake,

	--- The reason for removing the member
	reason: string
}
PropTypeDescription
user_id
The member ID
reason
The reason for removing the member

GetGuildBansOptions

Options for getting guild bans

Note: If both `before` and `after` are provided, `before` will take precedence.

Raw Type
--- Options for getting guild bans
---
--- Note: If both \`before\` and \`after\` are provided, \`before\` will take precedence.
type GetGuildBansOptions = {
	--- The limit of bans to get (max 100)
	limit: number?,

	--- Before a certain user ID
	before: discord.Snowflake?,

	--- After a certain user ID
	after: discord.Snowflake?
}
PropTypeDescription
limit?
The limit of bans to get (max 100)
before?
Before a certain user ID
after?
After a certain user ID

CreateMessageOptions

Options for sending a message to a channel in Discord

Raw Type
--- Options for sending a message to a channel in Discord
type CreateMessageOptions = {
	--- The channel ID
	channel_id: discord.Snowflake,

	--- The data to send the message with
	data: discordRest.CreateMessageRequest
}
PropTypeDescription
channel_id
The channel ID
data
The data to send the message with

ReactionType

Raw Type
type ReactionType = {
	type: "Unicode",

	data: string
} | {
	type: "Custom",

	animated: boolean,

	id: discord.Snowflake,

	name: string?
}

Union with variants:

Variant 1
PropTypeDescription
type
'Unicode'
-
data
-
Variant 2
PropTypeDescription
type
'Custom'
-
animated
-
id
-
name?
-

CreateReactionOptions

Options for creating a reaction in Discord

Raw Type
--- Options for creating a reaction in Discord
type CreateReactionOptions = {
	--- The channel ID
	channel_id: discord.Snowflake,

	--- The message ID
	message_id: discord.Snowflake,

	--- The reaction to add
	reaction: ReactionType
}
PropTypeDescription
channel_id
The channel ID
message_id
The message ID
reaction
The reaction to add

DeleteOwnReactionOptions

Options for deleting the reaction AntiRaid has made on Discord

Raw Type
--- Options for deleting the reaction AntiRaid has made on Discord
type DeleteOwnReactionOptions = {
	--- The channel ID
	channel_id: discord.Snowflake,

	--- The message ID
	message_id: discord.Snowflake,

	--- The reaction to add
	reaction: ReactionType
}
PropTypeDescription
channel_id
The channel ID
message_id
The message ID
reaction
The reaction to add

DeleteUserReactionOptions

Options for deleting the reaction of a user on Discord

Raw Type
--- Options for deleting the reaction of a user on Discord
type DeleteUserReactionOptions = {
	--- The channel ID
	channel_id: discord.Snowflake,

	--- The message ID
	message_id: discord.Snowflake,

	--- The user ID
	user_id: discord.Snowflake,

	--- The reaction to add
	reaction: ReactionType
}
PropTypeDescription
channel_id
The channel ID
message_id
The message ID
user_id
The user ID
reaction
The reaction to add

ReactionTypeEnum

Normal = normal reaction, burst is a super reaction

Raw Type
--- Normal = normal reaction, burst is a super reaction
type ReactionTypeEnum = "Normal" | "Burst"

Union with variants:

Variant 1
"Normal"
Variant 2
"Burst"

GetReactionsOptions

Options for getting reactions on a message

Raw Type
--- Options for getting reactions on a message
type GetReactionsOptions = {
	channel_id: discord.Snowflake,

	message_id: discord.Snowflake,

	reaction: ReactionType,

	type: ReactionTypeEnum?,

	-- Normal or burst/super reaction
	after: discord.Snowflake?,

	-- After which ID to use
	limit: number?
}
PropTypeDescription
channel_id
-
message_id
-
reaction
-
type?
-
after?
-
limit?
-

DeleteAllReactionsForEmojiOptions

Options for deleting all reactions on a message

Raw Type
--- Options for deleting all reactions on a message
type DeleteAllReactionsForEmojiOptions = {
	channel_id: discord.Snowflake,

	message_id: discord.Snowflake,

	reaction: ReactionType
}
PropTypeDescription
channel_id
-
message_id
-
reaction
-

EditMessageOptions

Raw Type
type EditMessageOptions = {
	channel_id: discord.Snowflake,

	message_id: discord.Snowflake,

	data: discordRest.EditMessageRequest
}
PropTypeDescription
channel_id
-
message_id
-
data
-

CreateCommandOptions

Options for creating a command in Discord

Raw Type
--- Options for creating a command in Discord
type CreateCommandOptions = {
	--- The data to create the command with
	data: discordRest.CreateGuildApplicationCommandRequest
}
PropTypeDescription
data
The data to create the command with

CreateCommandsOptions

Options for creating multiple command in Discord

Raw Type
--- Options for creating multiple command in Discord
type CreateCommandsOptions = {
	--- The data to create the command with
	data: {discordRest.CreateGuildApplicationCommandRequest}
}
PropTypeDescription
data
The data to create the command with

CreateInteractionResponseOptions

Options for creating an interaction response in Discord

Raw Type
--- Options for creating an interaction response in Discord
type CreateInteractionResponseOptions = {
	--- The interaction ID
	interaction_id: discord.Snowflake,

	--- The interaction token
	interaction_token: string,

	--- The data to create the interaction response with
	data: discordRest.CreateInteractionRequest
}
PropTypeDescription
interaction_id
The interaction ID
interaction_token
The interaction token
data
The data to create the interaction response with

EditInteractionResponseOptions

Options for editting an interaction response in Discord

Raw Type
--- Options for editting an interaction response in Discord
type EditInteractionResponseOptions = {
	--- The interaction token
	interaction_token: string,

	--- The data to edit the interaction response with
	data: discordRest.EditWebhookMessageRequest
}
PropTypeDescription
interaction_token
The interaction token
data
The data to edit the interaction response with

GetFollowupMessageOptions

Options for getting a followup message in Discord

Raw Type
--- Options for getting a followup message in Discord
type GetFollowupMessageOptions = {
	--- The interaction token
	interaction_token: string,

	--- The message ID
	message_id: discord.Snowflake
}
PropTypeDescription
interaction_token
The interaction token
message_id
The message ID

CreateFollowupMessageOptions

Options for creating a followup message in Discord

Raw Type
--- Options for creating a followup message in Discord
type CreateFollowupMessageOptions = {
	--- The interaction token
	interaction_token: string,

	--- The data to create the followup message with
	data: discordRest.CreateFollowupMessageRequest
}
PropTypeDescription
interaction_token
The interaction token
data
The data to create the followup message with

EditFollowupMessageOptions

Options for editting a followup message in Discord

Raw Type
--- Options for editting a followup message in Discord
type EditFollowupMessageOptions = {
	--- The interaction token
	interaction_token: string,

	--- The message ID
	message_id: discord.Snowflake,

	--- The data to edit the followup message with
	data: discordRest.EditWebhookMessageRequest
}
PropTypeDescription
interaction_token
The interaction token
message_id
The message ID
data
The data to edit the followup message with

DeleteFollowupMessageOptions

Options for deleting a followup message in Discord

Raw Type
--- Options for deleting a followup message in Discord
type DeleteFollowupMessageOptions = {
	--- The interaction token
	interaction_token: string,

	--- The message ID
	message_id: discord.Snowflake
}
PropTypeDescription
interaction_token
The interaction token
message_id
The message ID

MessagePagination

A message pagination object

Raw Type
--- A message pagination object
type MessagePagination = {
	type: "After" | "Around" | "Before",

	id: discord.Snowflake
}
PropTypeDescription
type
('After' | 'Around' | 'Before')
-
id
-

GetMessagesOptions

Options for getting messages in Discord

Raw Type
--- Options for getting messages in Discord
type GetMessagesOptions = {
	--- The channel ID
	channel_id: discord.Snowflake,

	--- The target message
	target: MessagePagination?,

	--- The limit of messages to get
	limit: number?
}
PropTypeDescription
channel_id
The channel ID
target?
The target message
limit?
The limit of messages to get

GetMessageOptions

Options for getting a message in Discord

Raw Type
--- Options for getting a message in Discord
type GetMessageOptions = {
	--- The channel ID
	channel_id: discord.Snowflake,

	--- The message ID
	message_id: discord.Snowflake
}
PropTypeDescription
channel_id
The channel ID
message_id
The message ID

CreateGuildBanOptions

Options for creating a guild ban in Discord

Raw Type
--- Options for creating a guild ban in Discord
type CreateGuildBanOptions = {
	--- The user ID to ban
	user_id: discord.Snowflake,

	--- The reason for the ban
	reason: string,

	--- The number of seconds to delete messages from
	delete_message_seconds: number?
}
PropTypeDescription
user_id
The user ID to ban
reason
The reason for the ban
delete_message_seconds?
The number of seconds to delete messages from

RemoveGuildBanOptions

Options for removing a guild ban in Discord

Raw Type
--- Options for removing a guild ban in Discord
type RemoveGuildBanOptions = {
	--- The user ID to unban
	user_id: discord.Snowflake,

	--- The reason for the unban
	reason: string
}
PropTypeDescription
user_id
The user ID to unban
reason
The reason for the unban

GetGuildMembersOptions

Options for getting guild members

Raw Type
--- Options for getting guild members
type GetGuildMembersOptions = {
	--- The limit of members to get
	limit: number?,

	--- The user ID to get members after
	after: discord.Snowflake?
}
PropTypeDescription
limit?
The limit of members to get
after?
The user ID to get members after

SearchGuildMembersOptions

Options for searching guild members

Raw Type
--- Options for searching guild members
type SearchGuildMembersOptions = {
	--- The query to search for
	query: string,

	--- The limit of members to get
	limit: number?
}
PropTypeDescription
query
The query to search for
limit?
The limit of members to get

ModifyGuildMemberOptions

Options for modifying a guild member

Raw Type
--- Options for modifying a guild member
type ModifyGuildMemberOptions = {
	--- The user ID to modify
	user_id: discord.Snowflake,

	--- The reason for the modification
	reason: string,

	--- The data to modify the member with
	data: discordRest.ModifyGuildMemberRequest
}
PropTypeDescription
user_id
The user ID to modify
reason
The reason for the modification
data
The data to modify the member with

ModifyGuildOptions

Options for modifying a guild

Raw Type
--- Options for modifying a guild
type ModifyGuildOptions = {
	data: discordRest.ModifyGuildRequest,

	reason: string
}
PropTypeDescription
data
-
reason
-

AntiRaidCheckPermissionsOptions

Options for checking if a user has the needed Discord permissions to perform an action

Raw Type
--- Options for checking if a user has the needed Discord permissions to perform an action
type AntiRaidCheckPermissionsOptions = {
	--- The user ID to check permissions for
	user_id: discord.Snowflake,

	--- The needed permissions
	needed_permissions: string
}
PropTypeDescription
user_id
The user ID to check permissions for
needed_permissions
The needed permissions

AntiRaidCheckPermissionsAndHierarchyOptions

Options for checking if a user has the needed Discord permissions to perform an action

and is above the target user in terms of hierarchy

Raw Type
--- Options for checking if a user has the needed Discord permissions to perform an action 
--- and is above the target user in terms of hierarchy
type AntiRaidCheckPermissionsAndHierarchyOptions = {
	--- The user ID to check permissions for
	user_id: discord.Snowflake,

	--- The target ID to check permissions for
	target_id: discord.Snowflake,

	--- The needed permissions
	needed_permissions: string
}
PropTypeDescription
user_id
The user ID to check permissions for
target_id
The target ID to check permissions for
needed_permissions
The needed permissions

AntiRaidCheckPermissionsResponse

Extra/additional success response for checking if a user has the needed Discord permissions to perform an action

Raw Type
--- Extra/additional success response for checking if a user has the needed Discord permissions to perform an action
type AntiRaidCheckPermissionsResponse = {
	--- The partial guild
	partial_guild: discord.Partial<discord.GuildObject>,

	--- The member
	member: discord.GuildMemberObject,

	--- The permissions
	permissions: string
}
PropTypeDescription
partial_guild
The partial guild
member
The member
permissions
The permissions

AntiRaidCheckChannelPermissionsOptions

Raw Type
type AntiRaidCheckChannelPermissionsOptions = {
	--- The user ID to check permissions for
	user_id: discord.Snowflake,

	--- The channel ID to check permissions for
	channel_id: discord.Snowflake,

	--- The needed permissions
	needed_permissions: string
}
PropTypeDescription
user_id
The user ID to check permissions for
channel_id
The channel ID to check permissions for
needed_permissions
The needed permissions

AntiRaidCheckChannelPermissionsResponse

Raw Type
type AntiRaidCheckChannelPermissionsResponse = {
	--- The partial guild
	partial_guild: discord.Partial<discord.GuildObject>,

	--- The channel
	channel: discord.ChannelObject,

	--- The member
	member: discord.GuildMemberObject,

	--- The permissions
	permissions: string
}
PropTypeDescription
partial_guild
The partial guild
channel
The channel
member
The member
permissions
The permissions

AntiraidFusedMemberSingle

Raw Type
type AntiraidFusedMemberSingle = {
	--- The member
	member: discord.GuildMemberObject,

	--- The resolved permissions of the member in the guild
	resolved_perms: string
}
PropTypeDescription
member
The member
resolved_perms
The resolved permissions of the member in the guild

AntiraidFusedMember

A fused member contains both a member, the guild and the resolved permissions of

the member in the guild. This is useful for operations that require both the member and the guild context, such as permission checks.

Raw Type
--- A fused member contains both a member, the guild and the resolved permissions of
--- the member in the guild. This is useful for operations that require both the member and the guild context, such as permission checks.
type AntiraidFusedMember = {
	--- The partial guild
	guild: discord.Partial<discord.GuildObject>,

	--- The member and resolved permissions
	members: {AntiraidFusedMemberSingle}
}
PropTypeDescription
guild
The partial guild
members
The member and resolved permissions

CreateGuildRoleOptions

Options for creating a guild role

Raw Type
--- Options for creating a guild role
type CreateGuildRoleOptions = {
	--- The reason for the creation
	reason: string,

	--- The data to create the role with
	data: discordRest.CreateGuildRoleRequest
}
PropTypeDescription
reason
The reason for the creation
data
The data to create the role with

ModifyRolePositionOptions

Options for modifying a guild role position

Raw Type
--- Options for modifying a guild role position
type ModifyRolePositionOptions = {
	--- The data to modify the role position with
	data: {discordRest.ModifyGuildRolePositionsRequest},

	--- The reason for the modification
	reason: string
}
PropTypeDescription
data
The data to modify the role position with
reason
The reason for the modification

EditGuildRoleOptions

Options for modifying a guild role

Raw Type
--- Options for modifying a guild role
type EditGuildRoleOptions = {
	--- The reason for the creation
	reason: string,

	--- The data to create the role with
	data: discordRest.ModifyGuildRoleRequest,

	--- Role ID
	role_id: discord.Snowflake
}
PropTypeDescription
reason
The reason for the creation
data
The data to create the role with
role_id
Role ID

DeleteGuildRoleOptions

Options for deleting a guild role

Raw Type
--- Options for deleting a guild role
type DeleteGuildRoleOptions = {
	--- The reason for the creation
	reason: string,

	--- Role ID
	role_id: discord.Snowflake
}
PropTypeDescription
reason
The reason for the creation
role_id
Role ID

CreateChannelInviteOptions

Raw Type
type CreateChannelInviteOptions = {
	--- The channel ID
	channel_id: discord.Snowflake,

	--- The data to create the invite with
	data: discordRest.CreateChannelInviteRequest,

	--- The reason for the creation
	reason: string
}
PropTypeDescription
channel_id
The channel ID
data
The data to create the invite with
reason
The reason for the creation

DeleteChannelPermissionOptions

Raw Type
type DeleteChannelPermissionOptions = {
	--- The channel ID
	channel_id: discord.Snowflake,

	--- The overwrite ID
	overwrite_id: discord.Snowflake,

	--- The reason for the deletion
	reason: string
}
PropTypeDescription
channel_id
The channel ID
overwrite_id
The overwrite ID
reason
The reason for the deletion

FollowAnnouncementChannelOptions

Raw Type
type FollowAnnouncementChannelOptions = {
	--- The Channel ID
	channel_id: discord.Snowflake,

	--- Data
	data: discordRest.FollowAnnouncementChannelRequest,

	--- Reason
	reason: string
}
PropTypeDescription
channel_id
The Channel ID
data
Data
reason
Reason

GetInviteOptions

[[ #[derive(serde::Serialize, serde::Deserialize)] pub struct GetInviteOptions { pub code: String, pub with_counts: Option<bool>, // default to false pub with_expiration: Option<bool>, // default to false pub guild_scheduled_event_id: Option<serenity::all::ScheduledEventId>,
}

#[derive(serde::Serialize, serde::Deserialize)] pub struct DeleteInviteOptions { pub code: String, pub reason: String, } ]]

Raw Type
--[[
#[derive(serde::Serialize, serde::Deserialize)]
pub struct GetInviteOptions {
    pub code: String,
    pub with_counts: Option<bool>, // default to false
    pub with_expiration: Option<bool>, // default to false
    pub guild_scheduled_event_id: Option<serenity::all::ScheduledEventId>,    
}

#[derive(serde::Serialize, serde::Deserialize)]
pub struct DeleteInviteOptions {
    pub code: String,
    pub reason: String,
}
]]
type GetInviteOptions = {
	--- The invite code
	code: string,

	--- Whether to include counts
	with_counts: boolean?,

	--- Whether to include expiration
	with_expiration: boolean?,

	--- The guild scheduled event ID
	guild_scheduled_event_id: discord.Snowflake?
}
PropTypeDescription
code
The invite code
with_counts?
Whether to include counts
with_expiration?
Whether to include expiration
guild_scheduled_event_id?
The guild scheduled event ID

DeleteInviteOptions

Raw Type
type DeleteInviteOptions = {
	--- The invite code
	code: string,

	--- The reason for the deletion
	reason: string
}
PropTypeDescription
code
The invite code
reason
The reason for the deletion

DiscordExecutor

DiscordExecutor allows templates to access/use the Discord API in a sandboxed form.

Raw Type
--- DiscordExecutor allows templates to access/use the Discord API in a sandboxed form.
type DiscordExecutor = {
	-- Bulk operations
	--- When performing bulk operations, AntiRaid's standard GCRA based ratelimits might not work so well. 
	---
	--- For this, AntiRaid provides a \`\`antiraid_bulk_op\`\` which will return a discord \`\`Plugin\`\` that allows performing bulk operations. 
	---
	--- To do a bulk operation, your code must perform one operation at a time, and then call \`\`antiraid_bulk_op_wait\`\` to wait for the enforced wait period
	--- between each operation (otherwise, AntiRaid will reject the operation). Note that AntiRaid will automatically no-op if you can still perform another 
	--- operation.
	---
	--- Note that the calls to \`\`antiraid_bulk_op\`\` and \`\`antiraid_bulk_op_wait\`\` will respect AntiRaid's standard GCRA 
	--- ratelimits (with the exception that global bucket will not be hit) to ensure user code cannot just keep creating 
	--- new bulk operations.
	---
	--- A bulk operaction executor will expire 10 seconds after the last call to \`\`antiraid_bulk_op\`\` or \`\`antiraid_bulk_op_wait\`\` returns.
	---
	--- An \`\`action\`\` can be specified to increase/improve the ratelimits+wait period at the cost of limiting the executor
	--- to only the \`\`action\`\` specified. If no action is specified, the executor will be able to perform any action but with
	--- harsher ratelimits and a longer enforced wait period.
	antiraid_bulk_op: (self: DiscordExecutor, action: string?) -> DiscordExecutor,

	--- @yields
	---
	--- Waits for the bulk operation executor to finish the enforced wait period
	---
	--- Errors if the executor has expired or if the executor is used in a different thread than the one that created it
	--- or if the executor is not a bulk operation executor (the executor returned by \`\`antiraid_bulk_op\`\`).
	antiraid_bulk_op_wait: (self: DiscordExecutor) -> nil,

	-- Antiraid helpers
	--- @yields
	---
	--- Checks an audit log reason for validity, errors out if invalid
	antiraid_check_reason: (self: DiscordExecutor, reason: string) -> nil,

	--- @yields
	---
	--- Checks if a specified user with an ID of \`data.user_id\` has the specified permissions in the server
	antiraid_check_permissions: (self: DiscordExecutor, data: AntiRaidCheckPermissionsOptions) -> AntiRaidCheckPermissionsResponse,

	--- @yields
	---
	--- Checks if a specified user with an ID of \`data.user_id\` has the specified permissions in the server and is above the target user with an ID of \`data.target_id\` in terms of hierarchy
	antiraid_check_permissions_and_hierarchy: (self: DiscordExecutor, data: AntiRaidCheckPermissionsAndHierarchyOptions) -> AntiRaidCheckPermissionsResponse,

	--- @yields
	---
	--- Checks if a specified user with an ID of \`data.user_id\` has the specified permissions in the channel \`data.channel_id\`
	antiraid_check_channel_permissions: (self: DiscordExecutor, data: AntiRaidCheckChannelPermissionsOptions) -> AntiRaidCheckChannelPermissionsResponse,

	--- @yields
	---
	--- Fetches the member and resolved permissions of a user in the guild
	--- (also called a 'fused member' as it contains both the member and the resolved permissions)
	antiraid_get_fused_member: (self: DiscordExecutor, ids: {discord.Snowflake}) -> LazyAntiraidFusedMember,

	-- Discord API
	-- Audit Logs
	--- @yields
	---
	--- Gets the audit logs
	get_audit_logs: (self: DiscordExecutor, data: GetAuditLogOptions) -> LazyAuditLogObject,

	-- Auto Moderation
	--- @yields
	--- 
	--- Lists the auto moderation rules available
	list_auto_moderation_rules: (self: DiscordExecutor) -> LazyAutomoderationRuleObjectList,

	--- @yields
	---
	--- Gets an auto moderation rule by ID
	get_auto_moderation_rule: (self: DiscordExecutor, data: GetAutoModerationRuleOptions) -> LazyAutomoderationRuleObject,

	--- @yields
	---
	--- Creates an auto moderation rule
	create_auto_moderation_rule: (self: DiscordExecutor, data: CreateAutoModerationRuleOptions) -> LazyAutomoderationRuleObject,

	--- @yields
	---
	--- Edits an auto moderation rule
	edit_auto_moderation_rule: (self: DiscordExecutor, data: EditAutoModerationRuleOptions) -> LazyAutomoderationRuleObject,

	--- @yields
	---
	--- Deletes an auto moderation rule
	delete_auto_moderation_rule: (self: DiscordExecutor, data: DeleteAutoModerationRuleOptions) -> LazyAutomoderationRuleObject,

	-- Channel
	--- @yields
	---
	--- Gets a channel
	get_channel: (self: DiscordExecutor, channel_id: string) -> LazyChannelObject,

	--- @yields
	---
	--- Edits a channel
	edit_channel: (self: DiscordExecutor, data: EditChannelOptions) -> LazyChannelObject,

	--- @yields
	---
	--- Deletes a channel
	delete_channel: (self: DiscordExecutor, data: DeleteChannelOptions) -> LazyChannelObject,

	--- @yields
	---
	--- Edits channel permissions for a target
	edit_channel_permissions: (self: DiscordExecutor, data: EditChannelPermissionsOptions) -> nil,

	--- @yields
	---
	--- Gets all invites a channel has
	get_channel_invites: (self: DiscordExecutor) -> LazyInviteObjectList,

	--- @yields
	---
	--- Creates a channel invite
	create_channel_invite: (self: DiscordExecutor, data: CreateChannelInviteOptions) -> LazyInviteObject,

	--- @yields
	---
	--- Deletes a channel permission
	delete_channel_permission: (self: DiscordExecutor, data: DeleteChannelPermissionOptions) -> nil,

	--- @yields
	---
	--- Follows a announcement channel
	follow_announcement_channel: (self: DiscordExecutor, data: FollowAnnouncementChannelOptions) -> LazyChannelObject,

	-- Guild
	--- @yields
	---
	--- Gets the guild
	get_guild: (self: DiscordExecutor) -> LazyGuildObject,

	--- @yields
	---
	--- Gets the guilds preview
	get_guild_preview: (self: DiscordExecutor) -> LazyGuildPreviewObject,

	--- @yields
	---
	--- Edits the guild
	modify_guild: (self: DiscordExecutor, data: ModifyGuildOptions) -> LazyGuildObject,

	--- @yields
	---
	--- Gets the guild channels
	get_guild_channels: (self: DiscordExecutor) -> LazyChannelsObject,

	--- @yields
	---
	--- Creates a guild channel
	create_guild_channel: (self: DiscordExecutor, data: CreateChannelOptions) -> LazyChannelObject,

	--- @yields
	---
	--- Modify guild channel positions. Only channels to be modified are required to be passed in \`data\`.
	modify_guild_channel_positions: (self: DiscordExecutor, data: {discordRest.ModifyGuildChannelPositionsRequest}) -> nil,

	--- @yields
	---
	--- List active guild threads
	list_active_guild_threads: (self: DiscordExecutor) -> LazyActiveGuildThreadsResponse,

	--- @yields
	---
	--- Gets a guild member by ID
	get_guild_member: (self: DiscordExecutor, user_id: string) -> LazyGuildMemberObject,

	--- @yields
	---
	--- List all guild members
	list_guild_members: (self: DiscordExecutor, data: GetGuildMembersOptions) -> LazyGuildMembersObject,

	--- @yields
	---
	--- Search guild members
	search_guild_members: (self: DiscordExecutor, data: SearchGuildMembersOptions) -> LazyGuildMembersObject,

	--- @yields
	---
	--- Modify guild member (this includes timing out a member using \`communication_disabled_until\`)
	modify_guild_member: (self: DiscordExecutor, data: ModifyGuildMemberOptions) -> LazyGuildMemberObject,

	--- @yields
	---
	--- Adds a role to a member
	add_guild_member_role: (self: DiscordExecutor, data: AddGuildMemberRoleOptions) -> nil,

	--- @yields
	---
	--- Removes a role from a member
	remove_guild_member_role: (self: DiscordExecutor, data: RemoveGuildMemberRoleOptions) -> nil,

	--- @yields
	---
	--- Removes a member from a guild
	remove_guild_member: (self: DiscordExecutor, data: RemoveGuildMemberOptions) -> nil,

	--- @yields
	---
	--- Gets guild bans
	get_guild_bans: (self: DiscordExecutor, data: GetGuildBansOptions) -> LazyBanObjectList,

	--- @yields
	---
	--- Gets a guild ban for a user or nil if it does not exist
	get_guild_ban: (self: DiscordExecutor, user_id: discord.Snowflake) -> LazyBanOptionalObject,

	--- @yields
	---
	--- Creates a guild ban
	create_guild_ban: (self: DiscordExecutor, data: CreateGuildBanOptions) -> nil,

	--- @yields
	---
	--- Removes a guild ban
	remove_guild_ban: (self: DiscordExecutor, data: RemoveGuildBanOptions) -> nil,

	--- @yields
	---
	--- Returns the guild roles of a guild
	get_guild_roles: (self: DiscordExecutor) -> LazyRolesObject,

	--- @yields
	---
	--- Returns a guild role by ID
	get_guild_role: (self: DiscordExecutor, role_id: discord.Snowflake) -> LazyRoleObject,

	--- @yields
	---
	--- Creates a guild role
	create_guild_role: (self: DiscordExecutor, data: CreateGuildRoleOptions) -> LazyRoleObject,

	--- @yields
	---
	--- Modify guild role positions
	modify_guild_role_positions: (self: DiscordExecutor, data: ModifyRolePositionOptions) -> LazyRolesObject,

	--- @yields
	---
	--- Modifies a guild role
	modify_guild_role: (self: DiscordExecutor, data: EditGuildRoleOptions) -> LazyRoleObject,

	--- @yields
	---
	--- Deletes a guild role
	delete_guild_role: (self: DiscordExecutor, data: DeleteGuildRoleOptions) -> (),

	-- Invites
	--- @yields
	---
	--- Gets an invite by code
	get_invite: (self: DiscordExecutor, data: GetInviteOptions) -> LazyInviteObject,

	--- @yields
	---
	--- Deletes an invite by code
	delete_invite: (self: DiscordExecutor, data: DeleteInviteOptions) -> LazyInviteObject,

	-- Messages
	--- @yields
	---
	--- Gets messages from a channel
	get_channel_messages: (self: DiscordExecutor, data: GetMessagesOptions) -> LazyMessagesObject,

	--- @yields
	---
	--- Gets a message
	get_channel_message: (self: DiscordExecutor, data: GetMessageOptions) -> LazyMessageObject,

	--- @yields
	---
	--- Creates a message
	create_message: (self: DiscordExecutor, data: CreateMessageOptions) -> LazyMessageObject,

	--- @yields
	---
	--- Crossposts a message to an announcement channel
	crosspost_message: (self: DiscordExecutor, channel_id: discord.Snowflake, message_id: discord.Snowflake) -> LazyMessageObject,

	--- @yields
	---
	--- Creates a reaction to a message
	create_reaction: (self: DiscordExecutor, data: CreateReactionOptions) -> nil,

	--- @yields
	--- Deletes the reaction AntiRaid has made on a message
	delete_own_reaction: (self: DiscordExecutor, data: DeleteOwnReactionOptions) -> nil,

	--- @yields
	--- Deletes a reaction another user has made on a message (see \`\`delete_own_reaction\`\` for AntiRaid's
	--- reactions)
	delete_user_reaction: (self: DiscordExecutor, data: DeleteUserReactionOptions) -> nil,

	--- @yields
	---
	--- Gets all users who have reacted to awith the provided reaction based on provided criteria
	get_reactions: (self: DiscordExecutor, data: GetReactionsOptions) -> LazyUsersObject,

	--- @yields
	---
	--- Deletes all reactions on a message
	delete_all_reactions: (self: DiscordExecutor, channel_id: discord.Snowflake, message_id: discord.Snowflake) -> nil,

	--- @yields
	---
	--- Deletes all reactions for a specific emoji on a message
	delete_all_reactions_for_emoji: (self: DiscordExecutor, data: DeleteAllReactionsForEmojiOptions) -> nil,

	--- @yields
	---
	--- Edits a message
	edit_message: (self: DiscordExecutor, data: EditMessageOptions) -> LazyMessageObject,

	--- @yields
	---
	--- Deletes a message
	delete_message: (self: DiscordExecutor, channel_id: discord.Snowflake, message_id: discord.Snowflake, reason: string) -> nil,

	--- @yields
	---
	--- Bulk deletes messages in a channel
	bulk_delete_messages: (self: DiscordExecutor, channel_id: discord.Snowflake, message_ids: {discord.Snowflake}, reason: string) -> nil,

	-- Interactions
	--- @yields
	---
	--- Creates an interaction response
	create_interaction_response: (self: DiscordExecutor, data: CreateInteractionResponseOptions) -> nil,

	--- @yields
	---
	--- Gets the original interaction response
	get_original_interaction_response: (self: DiscordExecutor, interaction_token: string) -> LazyMessageObject,

	--- @yields
	---
	--- Edits the original interaction response
	edit_original_interaction_response: (self: DiscordExecutor, data: EditInteractionResponseOptions) -> LazyMessageObject,

	--- @yields
	---
	--- Deletes the original interaction response
	delete_original_interaction_response: (self: DiscordExecutor, interaction_token: string) -> nil,

	--- @yields
	---
	--- Gets a followup interaction response
	get_followup_message: (self: DiscordExecutor, data: GetFollowupMessageOptions) -> LazyMessageObject,

	--- @yields
	---
	--- Creates a followup interaction response
	create_followup_message: (self: DiscordExecutor, data: CreateFollowupMessageOptions) -> LazyMessageObject,

	--- @yields
	---
	--- Edits a followup interaction response
	edit_followup_message: (self: DiscordExecutor, data: EditFollowupMessageOptions) -> LazyMessageObject,

	--- @yields
	---
	--- Deletes a followup interaction response
	delete_followup_message: (self: DiscordExecutor, data: DeleteFollowupMessageOptions) -> nil,

	-- Uncategorized (for now)
	--- @yields
	---
	--- Gets all guild commands currently registered
	get_guild_commands: (self: DiscordExecutor) -> LazyApplicationCommandsObject,

	--- @yields
	---
	--- Creates a guild command
	create_guild_command: (self: DiscordExecutor, data: CreateCommandOptions) -> LazyApplicationCommandObject,

	--- @yields
	---
	--- Creates multiple guild commands
	create_guild_commands: (self: DiscordExecutor, data: CreateCommandsOptions) -> LazyApplicationCommandsObject
}
PropTypeDescription
antiraid_bulk_op
(self, action: string?) -> DiscordExecutor
When performing bulk operations, AntiRaid's standard GCRA based ratelimits might not work so well.For this, AntiRaid provides a ``antiraid_bulk_op`` which will return a discord ``Plugin`` that allows performing bulk operations.To do a bulk operation, your code must perform one operation at a time, and then call ``antiraid_bulk_op_wait`` to wait for the enforced wait periodbetween each operation (otherwise, AntiRaid will reject the operation). Note that AntiRaid will automatically no-op if you can still perform anotheroperation.Note that the calls to ``antiraid_bulk_op`` and ``antiraid_bulk_op_wait`` will respect AntiRaid's standard GCRAratelimits (with the exception that global bucket will not be hit) to ensure user code cannot just keep creatingnew bulk operations.A bulk operaction executor will expire 10 seconds after the last call to ``antiraid_bulk_op`` or ``antiraid_bulk_op_wait`` returns.An ``action`` can be specified to increase/improve the ratelimits+wait period at the cost of limiting the executorto only the ``action`` specified. If no action is specified, the executor will be able to perform any action but withharsher ratelimits and a longer enforced wait period.
antiraid_bulk_op_wait
(self) -> nil
@yields Waits for the bulk operation executor to finish the enforced wait periodErrors if the executor has expired or if the executor is used in a different thread than the one that created itor if the executor is not a bulk operation executor (the executor returned by ``antiraid_bulk_op``).
antiraid_check_reason
(self, reason: string) -> nil
@yields Checks an audit log reason for validity, errors out if invalid
antiraid_check_permissions
@yields Checks if a specified user with an ID of `data.user_id` has the specified permissions in the server
antiraid_check_permissions_and_hierarchy
@yields Checks if a specified user with an ID of `data.user_id` has the specified permissions in the server and is above the target user with an ID of `data.target_id` in terms of hierarchy
antiraid_check_channel_permissions
@yields Checks if a specified user with an ID of `data.user_id` has the specified permissions in the channel `data.channel_id`
antiraid_get_fused_member
@yields Fetches the member and resolved permissions of a user in the guild(also called a 'fused member' as it contains both the member and the resolved permissions)
get_audit_logs
@yields Gets the audit logs
list_auto_moderation_rules
@yields Lists the auto moderation rules available
get_auto_moderation_rule
@yields Gets an auto moderation rule by ID
create_auto_moderation_rule
@yields Creates an auto moderation rule
edit_auto_moderation_rule
@yields Edits an auto moderation rule
delete_auto_moderation_rule
@yields Deletes an auto moderation rule
get_channel
(self, channel_id: string) -> LazyChannelObject
@yields Gets a channel
edit_channel
@yields Edits a channel
delete_channel
@yields Deletes a channel
edit_channel_permissions
@yields Edits channel permissions for a target
get_channel_invites
@yields Gets all invites a channel has
create_channel_invite
@yields Creates a channel invite
delete_channel_permission
@yields Deletes a channel permission
follow_announcement_channel
@yields Follows a announcement channel
get_guild
(self) -> LazyGuildObject
@yields Gets the guild
get_guild_preview
@yields Gets the guilds preview
modify_guild
@yields Edits the guild
get_guild_channels
@yields Gets the guild channels
create_guild_channel
@yields Creates a guild channel
modify_guild_channel_positions
@yields Modify guild channel positions. Only channels to be modified are required to be passed in `data`.
list_active_guild_threads
@yields List active guild threads
get_guild_member
(self, user_id: string) -> LazyGuildMemberObject
@yields Gets a guild member by ID
list_guild_members
@yields List all guild members
search_guild_members
@yields Search guild members
modify_guild_member
@yields Modify guild member (this includes timing out a member using `communication_disabled_until`)
add_guild_member_role
@yields Adds a role to a member
remove_guild_member_role
@yields Removes a role from a member
remove_guild_member
(self, data: RemoveGuildMemberOptions) -> nil
@yields Removes a member from a guild
get_guild_bans
@yields Gets guild bans
get_guild_ban
@yields Gets a guild ban for a user or nil if it does not exist
create_guild_ban
(self, data: CreateGuildBanOptions) -> nil
@yields Creates a guild ban
remove_guild_ban
(self, data: RemoveGuildBanOptions) -> nil
@yields Removes a guild ban
get_guild_roles
(self) -> LazyRolesObject
@yields Returns the guild roles of a guild
get_guild_role
(self, role_id: discord.Snowflake) -> LazyRoleObject
@yields Returns a guild role by ID
create_guild_role
@yields Creates a guild role
modify_guild_role_positions
@yields Modify guild role positions
modify_guild_role
@yields Modifies a guild role
delete_guild_role
(self, data: DeleteGuildRoleOptions) -> ()
@yields Deletes a guild role
get_invite
@yields Gets an invite by code
delete_invite
@yields Deletes an invite by code
get_channel_messages
@yields Gets messages from a channel
get_channel_message
@yields Gets a message
create_message
@yields Creates a message
crosspost_message
(self, channel_id: discord.Snowflake, message_id: discord.Snowflake) -> LazyMessageObject
@yields Crossposts a message to an announcement channel
create_reaction
(self, data: CreateReactionOptions) -> nil
@yields Creates a reaction to a message
delete_own_reaction
(self, data: DeleteOwnReactionOptions) -> nil
@yields Deletes the reaction AntiRaid has made on a message
delete_user_reaction
@yields Deletes a reaction another user has made on a message (see ``delete_own_reaction`` for AntiRaid'sreactions)
get_reactions
@yields Gets all users who have reacted to awith the provided reaction based on provided criteria
delete_all_reactions
(self, channel_id: discord.Snowflake, message_id: discord.Snowflake) -> nil
@yields Deletes all reactions on a message
delete_all_reactions_for_emoji
@yields Deletes all reactions for a specific emoji on a message
edit_message
@yields Edits a message
delete_message
(self, channel_id: discord.Snowflake, message_id: discord.Snowflake, reason: string) -> nil
@yields Deletes a message
bulk_delete_messages
(self, channel_id: discord.Snowflake, message_ids: {discord.Snowflake}, reason: string) -> nil
@yields Bulk deletes messages in a channel
create_interaction_response
@yields Creates an interaction response
get_original_interaction_response
(self, interaction_token: string) -> LazyMessageObject
@yields Gets the original interaction response
edit_original_interaction_response
@yields Edits the original interaction response
delete_original_interaction_response
(self, interaction_token: string) -> nil
@yields Deletes the original interaction response
get_followup_message
@yields Gets a followup interaction response
create_followup_message
@yields Creates a followup interaction response
edit_followup_message
@yields Edits a followup interaction response
delete_followup_message
@yields Deletes a followup interaction response
get_guild_commands
@yields Gets all guild commands currently registered
create_guild_command
@yields Creates a guild command
create_guild_commands
@yields Creates multiple guild commands

Plugin

Raw Type
type Plugin = DiscordExecutor

DiscordExecutor

Last updated on