Skip to content

Commit

Permalink
fixed channel creation (role mapping issue)
Browse files Browse the repository at this point in the history
  • Loading branch information
itskekoff committed Apr 28, 2024
1 parent c356faf commit bda42ee
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions modules/cloner.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ async def clone_categories(self, perms: bool = True) -> None:
if perms:
for role, permissions in category.overwrites.items():
if isinstance(role, discord.Role):
overwrites[self.mappings["roles"][role]] = permissions
overwrites[self.mappings["roles"][role.id]] = permissions
new_category = await self.new_guild.create_category(
name=category.name, position=category.position, overwrites=overwrites
)
Expand Down Expand Up @@ -245,7 +245,7 @@ async def clone_channels(self, perms: bool = True) -> None:
if perms:
for role, permissions in channel.overwrites.items():
if isinstance(role, discord.Role):
overwrites[self.mappings["roles"][role]] = permissions
overwrites[self.mappings["roles"][role.id]] = permissions
if self.debug and overwrites:
self.logger.debug(f"Got overwrites mapping for channel #{channel.name}")
if isinstance(channel, discord.TextChannel):
Expand Down Expand Up @@ -319,7 +319,7 @@ async def add_community_channels(self, perms: bool = True) -> None:
if perms and channel.overwrites:
for role, permissions in channel.overwrites.items():
if isinstance(role, discord.Role):
overwrites[self.mappings["roles"][role]] = permissions
overwrites[self.mappings["roles"][role.id]] = permissions
if isinstance(channel, discord.ForumChannel):
tags: discord.abc.Sequence[discord.ForumTag] = (
channel.available_tags
Expand Down Expand Up @@ -453,6 +453,8 @@ async def send_webhook(self,
else ""
)

content = content.replace("\n", "")

self.logger.debug(f"Cloned message from {author.name}" + f": {content}" if content else "")
except discord.errors.HTTPException:
if self.debug:
Expand Down

0 comments on commit bda42ee

Please sign in to comment.