Skip to content

Commit

Permalink
removed ambiguity
Browse files Browse the repository at this point in the history
  • Loading branch information
zWolfrost committed Jan 15, 2025
1 parent 1245a4f commit 823915b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions gallery_dl/extractor/discord.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def _api_call(offset):
yield from self.extract_channel_text(thread["id"])

def extract_generic_channel(self, channel_id):
self.channel_metadata = self.parse_channel(channel_id)
self.parse_channel(channel_id)

# https://discord.com/developers/docs/resources/channel#channel-object-channel-types
if self.channel_metadata["channel_type"] in (0, 5):
Expand Down Expand Up @@ -122,11 +122,11 @@ def parse_channel(self, channel_id):
}

if base_channel_metadata["channel_type"] in (0, 5, 10, 11, 12):
channel_metadata = {
type_channel_metadata = {
"channel": channel["name"]
}
elif base_channel_metadata["channel_type"] in (1, 3):
channel_metadata = {
type_channel_metadata = {
"recipients": (
[user["username"] for user in channel["recipients"]]
),
Expand All @@ -136,18 +136,20 @@ def parse_channel(self, channel_id):
"channel": "DMs"
}
elif base_channel_metadata["channel_type"] in (15, 16):
channel_metadata = {}
type_channel_metadata = {}
else:
raise exception.StopExtraction(
"This channel type is not supported."
)

return {
self.channel_metadata = {
**self.server_metadata,
**base_channel_metadata,
**channel_metadata
**type_channel_metadata
}

return self.channel_metadata

def parse_server(self, server_id):
server = self.api.get_server(server_id)

Expand Down

0 comments on commit 823915b

Please sign in to comment.