mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Enforce unified lock names by using functions to generate lock keys (#165)
This commit is contained in:
parent
fcbb25b7ff
commit
c5d68650a3
18 changed files with 70 additions and 28 deletions
26
backend/src/utils/lockNameHelpers.ts
Normal file
26
backend/src/utils/lockNameHelpers.ts
Normal file
|
@ -0,0 +1,26 @@
|
|||
import { Member, Message, User } from "eris";
|
||||
import { SavedMessage } from "../data/entities/SavedMessage";
|
||||
|
||||
export function allStarboardsLock() {
|
||||
return `starboards`;
|
||||
}
|
||||
|
||||
export function banLock(user: Member | User | { id: string }) {
|
||||
return `ban-${user.id}`;
|
||||
}
|
||||
|
||||
export function counterIdLock(counterId: number | string) {
|
||||
return `counter-${counterId}`;
|
||||
}
|
||||
|
||||
export function memberRolesLock(member: Member | User | { id: string }) {
|
||||
return `member-roles-${member.id}`;
|
||||
}
|
||||
|
||||
export function messageLock(message: Message | SavedMessage | { id: string }) {
|
||||
return `message-${message.id}`;
|
||||
}
|
||||
|
||||
export function muteLock(user: Member | User | { id: string }) {
|
||||
return `mute-${user.id}`;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue