diff --git a/Cargo.lock b/Cargo.lock index 16c93718..73b3e678 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3614,6 +3614,7 @@ dependencies = [ "chrono", "config", "dashmap 6.1.0", + "extract_map", "kittycat", "reqwest", "sandwich_driver", @@ -4126,6 +4127,7 @@ dependencies = [ "dashmap 6.1.0", "digest", "erased-serde", + "extract_map", "futures-util", "glam", "governor", @@ -4134,6 +4136,7 @@ dependencies = [ "indexmap", "kittycat", "limits", + "lockdowns", "log", "lz4", "md-5", diff --git a/core/rust b/core/rust index d263f5c5..fa936cd9 160000 --- a/core/rust +++ b/core/rust @@ -1 +1 @@ -Subproject commit d263f5c5abc79ff1213cb3283754eab863e80245 +Subproject commit fa936cd9ad1ea2aeacd344d6f8e6cd6dd4084fc0 diff --git a/docs/src/user/templating/2-plugins.md b/docs/src/user/templating/2-plugins.md index 74f45a95..108a08c1 100644 --- a/docs/src/user/templating/2-plugins.md +++ b/docs/src/user/templating/2-plugins.md @@ -948,6 +948,167 @@ function new(token: TemplateContext, scope: string?): KvExecutor +--- + +# @antiraid/lockdowns + +This plugin allows for templates to interact with AntiRaid lockdowns + +## Types + +
+ +### Lockdown + +A created lockdown + +```json +{ + "id": "805c0dd1-a625-4875-81e4-8edc6a14f659", + "reason": "Testing", + "type": "qsl", + "data": {}, + "created_at": "2025-01-05T18:35:14.927730080Z" +} +``` + +#### Fields + +- `id` ([string](#type.string)): The id of the lockdown +- `reason` ([string](#type.string)): The reason for the lockdown +- `type` ([string](#type.string)): The type of lockdown in string form +- `data` ([any](#type.any)): The data associated with the lockdown +- `created_at` ([string](#type.string)): The time the lockdown was created + + + + +### LockdownExecutor + +An executor for listing, creating and removing lockdowns + + + +#### Methods + +##### LockdownExecutor:list + +```lua +function LockdownExecutor:list(): {Lockdown} +``` + +Lists all active lockdowns + +**Note that this method returns a promise that must be yielded using [`promise.yield`](#type.promise.yield) to actually execute and return results.** + + + +###### Returns + +- `lockdowns` ([{Lockdown}](#type.Lockdown)): A list of all currently active lockdowns +##### LockdownExecutor:qsl + +```lua +function LockdownExecutor:qsl(reason: string) +``` + +Starts a quick server lockdown + +**Note that this method returns a promise that must be yielded using [`promise.yield`](#type.promise.yield) to actually execute and return results.** + + + +###### Parameters + +- `reason` ([string](#type.string)): The reason for the lockdown + +##### LockdownExecutor:tsl + +```lua +function LockdownExecutor:tsl(reason: string) +``` + +Starts a traditional server lockdown + +**Note that this method returns a promise that must be yielded using [`promise.yield`](#type.promise.yield) to actually execute and return results.** + + + +###### Parameters + +- `reason` ([string](#type.string)): The reason for the lockdown + +##### LockdownExecutor:scl + +```lua +function LockdownExecutor:scl(channel: string, reason: string) +``` + +Starts a lockdown on a single channel + +**Note that this method returns a promise that must be yielded using [`promise.yield`](#type.promise.yield) to actually execute and return results.** + + + +###### Parameters + +- `channel` ([string](#type.string)): The channel to lock down +- `reason` ([string](#type.string)): The reason for the lockdown + +##### LockdownExecutor:role + +```lua +function LockdownExecutor:role(role: string, reason: string) +``` + +Starts a lockdown on a role + +**Note that this method returns a promise that must be yielded using [`promise.yield`](#type.promise.yield) to actually execute and return results.** + + + +###### Parameters + +- `role` ([string](#type.string)): The role to lock down +- `reason` ([string](#type.string)): The reason for the lockdown + +##### LockdownExecutor:remove + +```lua +function LockdownExecutor:remove(id: string) +``` + +Removes a lockdown + +**Note that this method returns a promise that must be yielded using [`promise.yield`](#type.promise.yield) to actually execute and return results.** + + + +###### Parameters + +- `id` ([string](#type.string)): The id of the lockdown to remove + + + +## Methods + +### new + +```lua +function new(token: TemplateContext): LockdownExecutor +``` + +#### Parameters + +- `token` ([TemplateContext](#type.TemplateContext)): The token of the template to use + + +#### Returns + +- `executor` ([LockdownExecutor](#type.LockdownExecutor)): A lockdown executor + + + --- # @antiraid/page @@ -1816,7 +1977,7 @@ Represents a sting on AntiRaid "creator": "system", "target": "user:1945824", "state": "active", - "created_at": "2025-01-03T09:48:34.148555950Z", + "created_at": "2025-01-05T18:35:14.928053825Z", "duration": { "secs": 60, "nanos": 0 @@ -2496,6 +2657,114 @@ Creates a new I64. +--- + +# @antiraid/userinfo + +This plugin allows for templates to interact with user's core information on AntiRaid (permissions etc) + +## Types + + + +### UserInfo + +A user info object + +```json +{ + "discord_permissions": "2111062325329919", + "kittycat_staff_permissions": { + "user_positions": [], + "perm_overrides": [ + { + "namespace": "global", + "perm": "*", + "negator": false + } + ] + }, + "kittycat_resolved_permissions": [ + { + "namespace": "moderation", + "perm": "kick", + "negator": false + }, + { + "namespace": "moderation", + "perm": "ban", + "negator": false + } + ], + "guild_owner_id": "1234567890", + "guild_roles": [], + "member_roles": [ + "1234567890" + ] +} +``` + +#### Fields + +- `discord_permissions` ([string](#type.string)): The discord permissions of the user +- `kittycat_staff_permissions` ([StaffPermissions](#type.StaffPermissions)): The staff permissions of the user +- `kittycat_resolved_permissions` ([{Permission}](#type.Permission)): The resolved permissions of the user +- `guild_owner_id` ([string](#type.string)): The guild owner id +- `guild_roles` ([{[string]: Serenity.Role}](#type.[string]: Serenity.Role)): The roles of the guild +- `member_roles` ([{string}](#type.string)): The roles of the member + + + + +### UserInfoExecutor + +UserInfoExecutor allows templates to access/use user infos not otherwise sent via events. + + + +#### Methods + +##### UserInfoExecutor:get + +```lua +function UserInfoExecutor:get(user: string): +``` + +Gets the user info of a user. + +**Note that this method returns a promise that must be yielded using [`promise.yield`](#type.promise.yield) to actually execute and return results.** + + + +###### Parameters + +- `user` ([string](#type.string)): The user id to get the info of. + + +###### Returns + +- `UserInfo` ([](#type.)): The user info of the user. + + +## Methods + +### new + +```lua +function new(token: TemplateContext): UserInfoExecutor +``` + +#### Parameters + +- `token` ([TemplateContext](#type.TemplateContext)): The token of the template to use. + + +#### Returns + +- `executor` ([UserInfoExecutor](#type.UserInfoExecutor)): A userinfo executor. + + + --- # Primitives diff --git a/infra/nirn-proxy b/infra/nirn-proxy index a69b5b65..082d0b28 160000 --- a/infra/nirn-proxy +++ b/infra/nirn-proxy @@ -1 +1 @@ -Subproject commit a69b5b65a9c850128c12051e3ea098ee4c6d23d2 +Subproject commit 082d0b2825b1d9482e5cd9c0e27868119155f88c diff --git a/infra/templating-types b/infra/templating-types index 8048fac9..0cf75a6d 160000 --- a/infra/templating-types +++ b/infra/templating-types @@ -1 +1 @@ -Subproject commit 8048fac9af9bc59be997cd49c3423cb8a231b632 +Subproject commit 0cf75a6d14b31cf0598d4e133505079b82694155 diff --git a/services/bot b/services/bot index 04553488..037fdba3 160000 --- a/services/bot +++ b/services/bot @@ -1 +1 @@ -Subproject commit 04553488519a2fecb58bba31bfeb5f5921cf1b3b +Subproject commit 037fdba38128e7e540d68d805b9e19e6baa0e250 diff --git a/services/template-worker b/services/template-worker index a32850e3..7c00742f 160000 --- a/services/template-worker +++ b/services/template-worker @@ -1 +1 @@ -Subproject commit a32850e3413d394f6361e5bc8b0832015485de19 +Subproject commit 7c00742faf1d60f35c021910b551591151d57b9d