feat(configuration): Adds missing implermentations
This commit is contained in:
parent
b82ab7dbc4
commit
ec0aa5654c
7 changed files with 150 additions and 32 deletions
|
|
@ -2,7 +2,7 @@ import {Repository} from "./Repository";
|
|||
import {GroupModel} from "../Models/GroupModel";
|
||||
import Groups, {DBGroup} from "../Database/tables/Groups";
|
||||
import {DatabaseConnection} from "../Database/DatabaseConnection";
|
||||
import {GuildMember} from "discord.js";
|
||||
import {GuildMember, UserFlagsBitField} from "discord.js";
|
||||
import {Nullable} from "../types/Nullable";
|
||||
import {PlaydateRepository} from "./PlaydateRepository";
|
||||
import {Container} from "../Container/Container";
|
||||
|
|
@ -16,7 +16,6 @@ export class GroupRepository extends Repository<GroupModel, DBGroup> {
|
|||
database,
|
||||
Groups
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public findGroupByName(name: string): Nullable<GroupModel> {
|
||||
|
|
@ -60,6 +59,19 @@ export class GroupRepository extends Repository<GroupModel, DBGroup> {
|
|||
return group.leader.memberid === member.id;
|
||||
})
|
||||
}
|
||||
|
||||
public isMemberInGroup(member: Nullable<GuildMember>, group: GroupModel): boolean
|
||||
{
|
||||
if (!member) {
|
||||
throw new Error("Can't find member for guild: none given");
|
||||
}
|
||||
|
||||
const groups = this.findGroupsByRoles(member.guild.id, [...member.roles.cache.keys()])
|
||||
|
||||
return groups.some((dbGroup) => {
|
||||
return group.id === dbGroup.id;
|
||||
})
|
||||
}
|
||||
|
||||
public deleteGroup(group: GroupModel): void {
|
||||
this.delete(group.id);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue