rootspring / r.go
Naposledy aktivní
1 | func Fetch( |
2 | sfo *state.StateFetchOptions, |
3 | efo ExtraFetchOptions, |
4 | opts FetchOptions, |
5 | ) (*ClientResponse, error) { |
6 | for { |
7 | var headers = map[string]string{} |
8 | |
9 | if !efo.NoExtraHeaders { |
10 | headers["Content-Type"] = "application/json" |
rootspring / fix.ts
Naposledy aktivní
1 | export const createFieldsForUpdate = ( |
2 | columnField: Record<string, any>, |
3 | configOpt: CanonicalConfigOption, |
4 | oldFields: Record<string, any>, |
5 | allDerivedData: Record<string, DerivedData> |
6 | ): SettingsExecute => { |
7 | let fields: Record<string, any> = {}; |
8 | let dependencyFields: string[] = []; |
9 | Object.keys(columnField).forEach((k) => { |
10 | let column = configOpt.columns.find((c) => c.id === k); |
rootspring / multi.svelte
Naposledy aktivní
1 | |
2 | <!--For screen readers--> |
3 | <select {id} class="sr-only" multiple {required} aria-required={required} bind:value> |
4 | {#each choices as choice} |
5 | <option value={choice.value}>{choice.label}</option> |
6 | {/each} |
7 | </select> |
8 | |
9 | <div class="not-sr-only"> |
10 | <button |
rootspring / cache.rs
Naposledy aktivní
1 | use super::core::{Limit, LimitTypes}; |
2 | use governor::{DefaultKeyedRateLimiter, Quota}; |
3 | use moka::future::Cache; |
4 | use serenity::all::{GuildId, UserId}; |
5 | use std::collections::HashMap; |
6 | use std::num::NonZeroU32; |
7 | use std::sync::{Arc, LazyLock}; |
8 | |
9 | // Hashmap of limit types to a hashmap of limit ids to its ratelimiter |
10 | pub type RatelimiterMap<RlKey> = |
rootspring / member.rs
Naposledy aktivní
1 | use kittycat::perms::Permission; |
2 | use serenity::all::{GuildId, RoleId, UserId}; |
3 | |
4 | /// Rederive permissions rederives the permissions given a member id and a list of roles |
5 | /// |
6 | /// Calling rederive_perms has some side-effects |
7 | /// |
8 | /// 0. The member will automatically be added to the guild_members table if they are not already in it |
9 | /// 1. Resolved_perms_cache will be updated in the guild_members table |
10 | pub async fn rederive_perms( |
rootspring / quick.rs
Naposledy aktivní
1 | use serde::{Deserialize, Serialize}; |
2 | use std::collections::HashSet; |
3 | |
4 | /// The base permissions for quick lockdown |
5 | static BASE_PERMS: [serenity::model::permissions::Permissions; 3] = [ |
6 | serenity::all::Permissions::VIEW_CHANNEL, |
7 | serenity::all::Permissions::SEND_MESSAGES, |
8 | serenity::all::Permissions::SEND_MESSAGES_IN_THREADS, |
9 | ]; |
rootspring / fix
Naposledy aktivní
1 | <script lang="ts"> |
2 | import { createEventDispatcher } from 'svelte'; |
3 | export let name: string; |
4 | export let value: string[] = []; |
5 | export let placeholder: string | null = null; |
6 | export let list: any[] = []; |
7 | export let showFilter: boolean = false; |
8 | $: getSelected = (): any[] => { |
9 | return list?.filter((i) => { |
10 | const val: string = i?.value; |
rootspring / lua-docs.md
Naposledy aktivní
Lua Templating
At AntiRaid, we prioritize flexibility and customization for our users. To this end, our bot supports advanced templating to allow for extensive personalization of embeds and messages. While many bots utilize proprietary languages or templating engines, we have chosen to leverage Lua—a renowned scripting language widely used in game development and other applications. This decision ensures that our users benefit from a powerful, well-documented, and versatile language, enhancing the capability and ease of customizing their AntiRaid experience.
Specifically, Anti Raid uses a variant of Lua called Luau. If you've ever used Roblox before, this is the same variant of Lua used there too (which is why Luau is also known as Roblox Lua in many places). You can check out the Luau docs for more information on the language itself. Unlike PUC Lua (the reference implementation), Luau is both faster and offers robust sandboxing capabilities allowing Anti-Raid to run scripts in as safe an environment as possible.
Getting Started
Note that the remainder of these docs will cover Anti-Raids Lua SDKs. To learn more about Lua itself, please checkout Lua's official tutorial for Lua 5.0 here. Other resources for Lua exist (Lua is very popular after all), including Roblox's tutorial (ignore the Studio bits), TutorialPoint and Codecademy.
rootspring / templater.ts
Naposledy aktivní
1 | import { builderVersion, Embed, TemplateBuilderData, TemplateBuilderDataComment } from "./types"; |
2 | |
3 | export const parseString = (s: string): string => { |
4 | // If it starts with $expr:, then it's a raw string |
5 | if (s.startsWith("$expr")) { |
6 | return s.substring(5).trim(); |
7 | } |
8 | |
9 | return `"${s}"`; |
10 | } |
rootspring / worker.rs
Naposledy aktivní
1 | // NOTE: Because the mlua crate is not Sync, we can use tokio spawn_local to run the Lua VM in an async context |
2 | // but pinned to a single thread |
3 | // |
4 | // This is highly experimental |
5 | pub struct LuaWorker { |
6 | /// A handle that allows stopping the VM inside its tokio localset |
7 | /// |
8 | /// This is wrapped in an option to allow destroying the handle when the LuaWorker is dropped |
9 | pub tx_stop: Option<tokio::sync::oneshot::Sender<()>>, |
10 | /// A channel used for sending requests to the VM |