-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improvements to /vouches command and activate sticky roles
- Loading branch information
Showing
10 changed files
with
140 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { DiscordIdProp, Document, SchemaDocument, getSchemaFromClass, modelSchemaWithCache } from "../util" | ||
|
||
@Document("TransientRole", "transientroles") | ||
class TransientRoleSchema { | ||
static isTransient(role: string) { | ||
return cache.has(role) | ||
} | ||
|
||
@DiscordIdProp({ required: true }) | ||
_id!: string | ||
} | ||
|
||
const schema = getSchemaFromClass(TransientRoleSchema) | ||
export const TransientRole = modelSchemaWithCache(schema, TransientRoleSchema) | ||
export type TransientRole = SchemaDocument<typeof schema> | ||
|
||
const cache = new Set() | ||
TransientRole.cache.on("add", (role) => cache.add(role._id)) | ||
TransientRole.cache.on("delete", (role) => cache.delete(role._id)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.