Skip to content

Commit

Permalink
reacto channel permission issues
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticroentgen committed Jan 17, 2024
1 parent 141bcc8 commit 6346198
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ disable=
C0114, # docstrings
C0115,
C0116,
C0301 #line too long
C0301, #line too long
R0912
27 changes: 16 additions & 11 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,17 +298,22 @@ async def backup_channel(channel, last_message_id):
raise

# pull all messages since message
while True:
messages = await channel.history(limit=100, after=after, oldest_first=True).flatten()
if not messages:
break

# Process messages
for message in messages:
backup_msg = extract_message(message)
write_to_storage(backup_msg)

after = messages[-1]
try:
while True:
messages = await channel.history(limit=100, after=after, oldest_first=True).flatten()
if not messages:
break

# Process messages
for message in messages:
backup_msg = extract_message(message)
write_to_storage(backup_msg)

after = messages[-1]
except nextcord.Forbidden:
print('No permission to read channel. Check roles in discord!')
# exit the function with no new location msg id
return None

# Seal the manifest
seal_manifest(channel.guild.id, channel.id)
Expand Down

0 comments on commit 6346198

Please sign in to comment.