category subspaces #113
2 changed files with 6 additions and 0 deletions
never revert a manually linked category subspace
commit
a7632181f9
|
|
@ -52,6 +52,7 @@ async function event(event) {
|
|||
|
||||
try {
|
||||
await createSpace.syncSpaceFully(guild_id)
|
||||
process.exit(0)
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
process.exit(1) // won't exit automatically on thrown error due to living discord connection, so manual exit is necessary
|
||||
|
|
|
|||
|
|
@ -85,6 +85,11 @@ async function shouldMakeCategorySpace(guild, channel, parentChannel, autocreate
|
|||
if (parentChannel?.type === DiscordTypes.ChannelType.GuildForum) return true
|
||||
if (!autocreate || parentChannel.type !== DiscordTypes.ChannelType.GuildCategory) return false
|
||||
|
||||
// if there is already a bridged room for the parent channel, don't revert it
|
||||
// this can happen when manually linking categories in the web UI for default guilds
|
||||
const parentRoom = select("channel_room", "room_id", {room_id: parentChannel.id}).pluck().get()
|
||||
if (parentRoom) return true
|
||||
|
||||
const defaultRoles = select("role_default", "role_id", {guild_id: guild.id}).pluck().all()
|
||||
/** @type {DiscordTypes.APIChannel[]} */
|
||||
// @ts-ignore
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue