Skip to content

Commit

Permalink
Fix linter error
Browse files Browse the repository at this point in the history
  • Loading branch information
zuuring committed Mar 5, 2024
1 parent 1f72b15 commit 25d0059
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions discord-scripts/channel-management.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,6 @@ import {
} from "discord.js"
import { Robot } from "hubot"

export default async function manageChannelPermissions(
discordClient: Client,
robot: Robot,
) {
const { application } = discordClient

if (application) {
discordClient.on("channelCreate", async (channel) => {
if (channel.parent && channel.parent.name === "defense") {
const permissions = channel.parent.permissionOverwrites.cache
await channel.permissionOverwrites.set(permissions)
robot.logger.info("Channel permissions set to base category")
sendChannelPermissions(channel, permissions)
}
})
}
}

async function sendChannelPermissions(
channel: GuildChannel,
permissions: Map<string, PermissionOverwrites>,
Expand All @@ -32,7 +14,7 @@ async function sendChannelPermissions(
const textChannel = channel as TextChannel
let permissionsText =
"This channel is now configured with the following permissions from the base category:\n"
permissions.forEach((perm: PermissionOverwrites, key: string) => {
permissions.forEach((perm: PermissionOverwrites) => {
const roleName =
channel.guild.roles.cache.get(perm.id)?.name || "Unknown Role/User"
const allowedPermissions =
Expand All @@ -44,3 +26,21 @@ async function sendChannelPermissions(
await textChannel.send(permissionsText)
}
}

export default async function manageChannelPermissions(
discordClient: Client,
robot: Robot,
) {
const { application } = discordClient

if (application) {
discordClient.on("channelCreate", async (channel) => {
if (channel.parent && channel.parent.name === "defense") {
const permissions = channel.parent.permissionOverwrites.cache
await channel.permissionOverwrites.set(permissions)
robot.logger.info("Channel permissions set to base category")
sendChannelPermissions(channel, permissions)
}
})
}
}

0 comments on commit 25d0059

Please sign in to comment.