fetch members of roleId from guild
This commit is contained in:
parent
6220268b14
commit
f6476c609b
@ -1,5 +1,5 @@
|
|||||||
import { Collection, GuildMember } from "discord.js"
|
import { Collection, Guild, GuildMember, Role, User } from "discord.js"
|
||||||
import { ChangedRoles, PermissionLevel } from "../interfaces"
|
import { ChangedRoles, Maybe, PermissionLevel } from "../interfaces"
|
||||||
import { logger } from "../logger"
|
import { logger } from "../logger"
|
||||||
import { config } from "../configuration"
|
import { config } from "../configuration"
|
||||||
|
|
||||||
@ -16,6 +16,13 @@ export function filterRolesFromMemberUpdate(oldMember: GuildMember, newMember: G
|
|||||||
return { addedRoles, removedRoles }
|
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> {
|
export function getGuildSpecificTriggerRoleId(): Collection<string, PermissionLevel> {
|
||||||
const outVal = new Collection<string, PermissionLevel>()
|
const outVal = new Collection<string, PermissionLevel>()
|
||||||
outVal.set(config.bot.watcher_role, "VIEWER")
|
outVal.set(config.bot.watcher_role, "VIEWER")
|
||||||
|
Loading…
Reference in New Issue
Block a user