mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-13 21:35:02 +00:00
feat: add internal role manager plugin; add role buttons plugin
This commit is contained in:
parent
9314d57645
commit
3fe71b3e27
23 changed files with 732 additions and 1 deletions
39
backend/src/data/GuildRoleButtons.ts
Normal file
39
backend/src/data/GuildRoleButtons.ts
Normal file
|
@ -0,0 +1,39 @@
|
|||
import { getRepository, Repository } from "typeorm";
|
||||
import { Reminder } from "./entities/Reminder";
|
||||
import { BaseRepository } from "./BaseRepository";
|
||||
import moment from "moment-timezone";
|
||||
import { DBDateFormat } from "../utils";
|
||||
import { BaseGuildRepository } from "./BaseGuildRepository";
|
||||
import { RoleQueueItem } from "./entities/RoleQueueItem";
|
||||
import { connection } from "./db";
|
||||
import { RoleButtonsItem } from "./entities/RoleButtonsItem";
|
||||
|
||||
export class GuildRoleButtons extends BaseGuildRepository {
|
||||
private roleButtons: Repository<RoleButtonsItem>;
|
||||
|
||||
constructor(guildId) {
|
||||
super(guildId);
|
||||
this.roleButtons = getRepository(RoleButtonsItem);
|
||||
}
|
||||
|
||||
getSavedRoleButtons(): Promise<RoleButtonsItem[]> {
|
||||
return this.roleButtons.find({ guild_id: this.guildId });
|
||||
}
|
||||
|
||||
async deleteRoleButtonItem(name: string): Promise<void> {
|
||||
await this.roleButtons.delete({
|
||||
guild_id: this.guildId,
|
||||
name,
|
||||
});
|
||||
}
|
||||
|
||||
async saveRoleButtonItem(name: string, channelId: string, messageId: string, hash: string): Promise<void> {
|
||||
await this.roleButtons.insert({
|
||||
guild_id: this.guildId,
|
||||
name,
|
||||
channel_id: channelId,
|
||||
message_id: messageId,
|
||||
hash,
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue