feat/40-reroll-on-disinterest #54

Merged
kenobi merged 73 commits from feat/40-reroll-on-disinterest into master 2023-11-19 20:24:36 +01:00
Showing only changes of commit f6476c609b - Show all commits

View File

@ -1,5 +1,5 @@
import { Collection, GuildMember } from "discord.js"
import { ChangedRoles, PermissionLevel } from "../interfaces"
import { Collection, Guild, GuildMember, Role, User } from "discord.js"
import { ChangedRoles, Maybe, PermissionLevel } from "../interfaces"
import { logger } from "../logger"
import { config } from "../configuration"
@ -16,6 +16,13 @@ export function filterRolesFromMemberUpdate(oldMember: GuildMember, newMember: G
return { addedRoles, removedRoles }
}
export async function getMembersWithRoleFromGuild(roleId: string, guild: Guild): Promise<Collection<string, GuildMember>> {
const emptyResponse = new Collection<string, GuildMember>
const guildRole: Maybe<Role> = guild.roles.resolve(roleId)
if (!guildRole) return emptyResponse
return guildRole.members
}
export function getGuildSpecificTriggerRoleId(): Collection<string, PermissionLevel> {
const outVal = new Collection<string, PermissionLevel>()
outVal.set(config.bot.watcher_role, "VIEWER")