@antiraid-ext/utils/userinfo
API reference for @antiraid-ext/utils/userinfo
@antiraid-ext/utils/userinfo
Types
GuildRolePermission
Raw Type
type GuildRolePermission = {
position: Kittycat.PartialStaffPosition,
raw: kv.KvRecord
}
Prop | Type | Description |
---|---|---|
position | - | |
raw | - |
UserInfo
@class UserInfo
Represents a summary of a users permission related
information on AntiRaid
Raw Type
--- @class UserInfo
---
--- Represents a summary of a users permission related
--- information on AntiRaid
---
--- @field userid discord.Snowflake The ID of the user
--- @field discord_permissions discord.Snowflake The users discord permissions
--- @field kittycat_staff_permissions Kittycat.StaffPermissions The users kittycat staff permissions
--- @field kittycat_resolved_permissions {Kittycat.Permission} The users resolved kittycat permissions
--- @field guild_owner_id discord.Snowflake The ID of the guild owner
--- @field guild_roles {[discord.Snowflake]: discord.GuildRoleObject} The users guild roles (may not be present if guildRolesNeeded is not set)
--- @field member_roles {discord.Snowflake} The users member roles
--- @field guild_permissions {Kittycat.PartialStaffPosition} The guild permissions configured on the server
type UserInfo = {
userid: discord.Snowflake,
discord_permissions: discord.Snowflake,
kittycat_staff_permissions: Kittycat.StaffPermissions,
kittycat_resolved_permissions: {Kittycat.Permission},
guild_owner_id: discord.Snowflake,
guild_roles: {
[discord.Snowflake]: discord.GuildRoleObject
}?,
member_roles: {discord.Snowflake},
guild_permissions: {
[discord.Snowflake]: GuildRolePermission
},
permission_override_entry: MemberPermissionOverrideEntry
}
Prop | Type | Description |
---|---|---|
userid | - | |
discord_permissions | - | |
kittycat_staff_permissions | - | |
kittycat_resolved_permissions | - | |
guild_owner_id | - | |
guild_roles? | - | |
member_roles | - | |
guild_permissions | - | |
permission_override_entry | - |
Stage1Data
Stage1Data is a basic collation of user info that can then be cheaply expanded into a full UserInfo object
Raw Type
--- Stage1Data is a basic collation of user info that can then be cheaply expanded into a full UserInfo object
type Stage1Data = {
resolvedPerms: discord.Snowflake,
memberRoles: {discord.Snowflake},
guildRoles: {discord.GuildRoleObject},
guildOwnerId: discord.Snowflake,
pathUsed: string
}
Prop | Type | Description |
---|---|---|
resolvedPerms | - | |
memberRoles | - | |
guildRoles | - | |
guildOwnerId | - | |
pathUsed | - |
MemberPermissionOverrideEntry
Raw Type
type MemberPermissionOverrideEntry = {
userid: discord.Snowflake,
perm_overrides: {Kittycat.Permission},
raw: kv.KvRecord
}
UserInfoManager
UserInfoManager is a utility for fetching user info in a performant way
Raw Type
--- UserInfoManager is a utility for fetching user info in a performant way
type UserInfoManager = {
--- Gets the Stage1Data for a user (basic collation of user info)
--- @param user_id discord.Snowflake The ID of the user to get the UserInfo for
--- @param interaction? discord.InteractionObject Optional interaction object to use for fetching permissions (can speed up fetching/remove unnecessary API calls)
--- @return Stage1Data The Stage1Data for the user
getStage1Data: (user_id: discord.Snowflake, interaction: discord.InteractionObject?) -> Stage1Data,
--- Gets the UserInfo for a user (expansion of Stage1Data)
--- @param user_id discord.Snowflake The ID of the user to get the UserInfo for
--- @param interaction? discord.InteractionObject Optional interaction object to use for fetching permissions (can speed up fetching/remove unnecessary API calls)
--- @return UserInfo The UserInfo for the user
get: (user_id: discord.Snowflake, interaction: discord.InteractionObject?) -> UserInfo,
--- Gets the guild permissions configured
--- @return {Kittycat.PartialStaffPosition} The permissions globally set for the guild
getGuildPermissions: () -> {GuildRolePermission},
--- Returns the data of a single role
--- @return GuildRolePermission The permissions globally set for the specific role on the guild
getGuildPermissionForRole: (roleid: discord.Snowflake) -> GuildRolePermission?,
--- Sets the guild permission for a position
--- @param position Kittycat.PartialStaffPosition The position to set the permissions for
--- @return nil
setGuildPermission: (position: Kittycat.PartialStaffPosition) -> nil,
--- Reorders the guild permissions for a list of roles
--- @param reorderList { {role_id: discord.Snowflake, index: number} } The list of roles to reorder with their new indices
--- @return nil
applyReorder: (reorderList: {{
role_id: discord.Snowflake,
index: number
}}) -> nil,
--- Deletes the guild permission for a role
--- @param roleid discord.Snowflake The ID of the role to delete the permissions
--- @return nil
deleteGuildPermission: (roleid: discord.Snowflake) -> nil,
--- Gets all member permission overrides available
---
--- @return {MemberPermissionOverwriteEntry} The permission overrides available on the server
getMemberPermissionOverrides: () -> {MemberPermissionOverrideEntry},
--- Gets the member permission overrides for a user
--- @param userid discord.Snowflake The ID of the user to get the overrides for
--- @return {Kittycat.Permission} The member permission overrides for the user
getMemberPermissionOverridesForUser: (userid: discord.Snowflake) -> MemberPermissionOverrideEntry,
--- Sets the member permission overrides for a user
--- @param userid discord.Snowflake The ID of the user to set the overrides for
--- @param permissions {Kittycat.Permission} The permissions to set for the user
--- @return nil
setMemberPermissionOverrides: (userid: discord.Snowflake, permissions: {Kittycat.Permission}) -> nil,
--- Deletes the member permission overrides for a user
--- @param userid discord.Snowflake The ID of the user to delete the overrides for
--- @return nil
deleteMemberPermissionOverrides: (userid: discord.Snowflake) -> nil
}
Prop | Type | Description |
---|---|---|
getStage1Data | Gets the Stage1Data for a user (basic collation of user info) | |
get | Gets the UserInfo for a user (expansion of Stage1Data) | |
getGuildPermissions | Gets the guild permissions configured | |
getGuildPermissionForRole | Returns the data of a single role | |
setGuildPermission | Sets the guild permission for a position | |
applyReorder | Reorders the guild permissions for a list of roles | |
deleteGuildPermission | Deletes the guild permission for a role | |
getMemberPermissionOverrides | Gets all member permission overrides available | |
getMemberPermissionOverridesForUser | Gets the member permission overrides for a user | |
setMemberPermissionOverrides | Sets the member permission overrides for a user | |
deleteMemberPermissionOverrides | Deletes the member permission overrides for a user |
Functions
UserInfoManager
Function Signature
function UserInfoManager(ctx: Primitives.TemplateContext) -> UserInfoManager end
Arguments
ctx
Returns
ret1
Last updated on