From 97b19dcb02855b31ee1f975ce3501390b2e30388 Mon Sep 17 00:00:00 2001 From: Jisagi Date: Fri, 16 Nov 2018 15:59:35 +0100 Subject: [PATCH] bug fix v1.1.3 Extending fix from here https://github.com/Jisagi/Discord-guild-copy/commit/591c9b8da0c6950ed7568047eb0994b03d64d556 to categories and voice channels --- .gitignore | 1 + objects/serializer.js | 4 +++- package.json | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 6eec19a..b945f74 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ package-lock.json # Miscellaneous guildData.json logs/ +.vscode/ \ No newline at end of file diff --git a/objects/serializer.js b/objects/serializer.js index a709cd9..6b65022 100644 --- a/objects/serializer.js +++ b/objects/serializer.js @@ -116,6 +116,7 @@ class Serializer { categoryCollection = categoryCollection.sort((a, b) => a.position - b.position); let categories = categoryCollection.map(category => { let permOverwritesCollection = category.permissionOverwrites.filter(pOver => pOver.type === 'role'); + permOverwritesCollection = permOverwritesCollection.filter(pOver => guildToCopy.roles.has(pOver.id)); let permOverwrites = permOverwritesCollection.map(pOver => { return { id: pOver.id, @@ -149,7 +150,7 @@ class Serializer { textChannelCollection = textChannelCollection.sort((a, b) => a.rawPosition - b.rawPosition); let textChannel = textChannelCollection.map(tCh => { let permOverwritesCollection = tCh.permissionOverwrites.filter(pOver => pOver.type === 'role'); - permOverwritesCollection = permOverwritesCollection.filter(pOver => guildToCopy.roles.has(pOver.id)); // fix for a very rare bug + permOverwritesCollection = permOverwritesCollection.filter(pOver => guildToCopy.roles.has(pOver.id)); let permOverwrites = permOverwritesCollection.map(pOver => { return { id: pOver.id, @@ -188,6 +189,7 @@ class Serializer { voiceChannelCollection = voiceChannelCollection.sort((a, b) => a.rawPosition - b.rawPosition); let voiceChannel = voiceChannelCollection.map(vCh => { let permOverwritesCollection = vCh.permissionOverwrites.filter(pOver => pOver.type === 'role'); + permOverwritesCollection = permOverwritesCollection.filter(pOver => guildToCopy.roles.has(pOver.id)); let permOverwrites = permOverwritesCollection.map(pOver => { return { id: pOver.id, diff --git a/package.json b/package.json index 3322b1e..8465797 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "guildcopy", - "version": "1.1.2", + "version": "1.1.3", "description": "A tool to copy a discord guild", "main": "copy.js", "scripts": {