mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Context Menu Actions v1, clean and mute support with full options
This commit is contained in:
parent
2281dbcfef
commit
ff774aa5f6
19 changed files with 657 additions and 152 deletions
35
backend/src/data/GuildContextMenuLinks.ts
Normal file
35
backend/src/data/GuildContextMenuLinks.ts
Normal file
|
@ -0,0 +1,35 @@
|
|||
import { DeleteResult, getRepository, InsertResult, Repository } from "typeorm";
|
||||
import { BaseGuildRepository } from "./BaseGuildRepository";
|
||||
import { ContextMenuLink } from "./entities/ContextMenuLink";
|
||||
|
||||
export class GuildContextMenuLinks extends BaseGuildRepository {
|
||||
private contextLinks: Repository<ContextMenuLink>;
|
||||
|
||||
constructor(guildId) {
|
||||
super(guildId);
|
||||
this.contextLinks = getRepository(ContextMenuLink);
|
||||
}
|
||||
|
||||
async get(id: string): Promise<ContextMenuLink | undefined> {
|
||||
return this.contextLinks.findOne({
|
||||
where: {
|
||||
guild_id: this.guildId,
|
||||
context_id: id,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async create(contextId: string, contextAction: string): Promise<InsertResult> {
|
||||
return this.contextLinks.insert({
|
||||
guild_id: this.guildId,
|
||||
context_id: contextId,
|
||||
action_name: contextAction,
|
||||
});
|
||||
}
|
||||
|
||||
async deleteAll(): Promise<DeleteResult> {
|
||||
return this.contextLinks.delete({
|
||||
guild_id: this.guildId,
|
||||
});
|
||||
}
|
||||
}
|
10
backend/src/data/entities/ContextMenuLink.ts
Normal file
10
backend/src/data/entities/ContextMenuLink.ts
Normal file
|
@ -0,0 +1,10 @@
|
|||
import { Column, Entity, PrimaryColumn } from "typeorm";
|
||||
|
||||
@Entity("context_menus")
|
||||
export class ContextMenuLink {
|
||||
@Column() guild_id: string;
|
||||
|
||||
@Column() @PrimaryColumn() context_id: string;
|
||||
|
||||
@Column() action_name: string;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue