Skip to content

Commit bfcb722

Browse files
skip forbidden channels
1 parent be1ac7f commit bfcb722

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

git_archive.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def should_archive_channel(self, channel) -> bool:
121121
if channel.name in excluded_channels:
122122
return False
123123

124-
# Check allowed categories
124+
# Check allowed categories (empty list = all categories allowed)
125125
allowed_categories = server_config.get('allowed_categories', [])
126126
if allowed_categories:
127127
category_name = channel.category.name if channel.category else None

git_archive_config.json.example

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@
99
"allowed_categories": ["public", "governance"],
1010
"excluded_channels": ["mod-chat"],
1111
"include_attachments": true
12+
},
13+
"9999999999999999999": {
14+
"enabled": true,
15+
"repo_url": "https://github.com/org/another-archive.git",
16+
"branch": "main",
17+
"allowed_categories": [],
18+
"excluded_channels": [],
19+
"include_attachments": true
1220
}
1321
}
1422
}

main.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,9 @@ async def on_ready():
618618
new_last_msg_id = await backup_channel(thread, last_msg_id)
619619
if new_last_msg_id is not None:
620620
await set_last_message_id(thread, new_last_msg_id)
621+
except nextcord.Forbidden as e:
622+
print(f'\tAccess denied ({e}), skipping channel.')
623+
break
621624
except Exception as e: # pylint: disable=W0718
622625
wait_time = attempt * 5
623626
print(f'\tAttempt {attempt} failed ({e}), retrying in {wait_time} seconds...')

0 commit comments

Comments
 (0)