diff --git a/src/channelsyncroniser.ts b/src/channelsyncroniser.ts index bb0939a7a766dc02e577b7f250a0835289c2e2e7..6e1f9b30d4b8142a8fde44a0468350df49c0e9ec 100644 --- a/src/channelsyncroniser.ts +++ b/src/channelsyncroniser.ts @@ -61,7 +61,7 @@ export class ChannelSyncroniser { } } - public async OnGuildUpdate(guild: Discord.Guild) { + public async OnGuildUpdate(guild: Discord.Guild, force = false) { log.verbose(`Got guild update for guild ${guild.id}`); const channelStates = []; for (const [_, channel] of guild.channels) { @@ -69,7 +69,7 @@ export class ChannelSyncroniser { continue; // not supported for now } try { - const channelState = await this.GetChannelUpdateState(channel as Discord.TextChannel); + const channelState = await this.GetChannelUpdateState(channel as Discord.TextChannel, force); channelStates.push(channelState); } catch (e) { log.error("Failed to get channel state", e); diff --git a/tools/chanfix.ts b/tools/chanfix.ts index 4c57c858480cdc7fc7ffe0e01a5958b44ddd6591..446f9d2e457cb89e91edcd9a4146fbdfc29a0ec2 100644 --- a/tools/chanfix.ts +++ b/tools/chanfix.ts @@ -128,18 +128,12 @@ bridge.loadDatabases().catch((e) => { let delay = config.limits.roomGhostJoinDelay; // we'll just re-use this client.guilds.forEach((guild) => { - guild.channels.forEach((channel) => { - if (channel.type !== "text") { - return; - } - - promiseChain = promiseChain.return(Bluebird.delay(delay).then(() => { - return chanSync.EnsureState(channel).catch((err) => { - log.warn(`Couldn't update rooms for ${channel.id}`, err); - }); - })); - delay += config.limits.roomGhostJoinDelay; - }); + promiseChain = promiseChain.return(Bluebird.delay(delay).then(() => { + return chanSync.OnGuildUpdate(guild, true).catch((err) => { + log.warn(`Couldn't update rooms of guild ${guild.id}`, err); + }); + })); + delay += config.limits.roomGhostJoinDelay; }); return promiseChain; }).catch((err) => {