Skip to content

Commit

Permalink
Rename .location to .value from ScheduledEventLocation
Browse files Browse the repository at this point in the history
  • Loading branch information
Middledot committed Jan 8, 2022
1 parent 98e4b6a commit 18c5391
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions discord/audit_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,9 @@ def __init__(self, entry: AuditLogEntry, data: List[AuditLogChangePayload], *, s
if hasattr(self.before, 'location_type'):
from .scheduled_events import ScheduledEventLocation
if self.before.location_type is enums.ScheduledEventLocationType.external:
before = ScheduledEventLocation(state=state, location=before)
before = ScheduledEventLocation(state=state, value=before)
elif hasattr(self.before, 'channel'):
before = ScheduledEventLocation(state=state, location=self.before.channel)
before = ScheduledEventLocation(state=state, value=self.before.channel)

setattr(self.before, attr, before)

Expand All @@ -272,9 +272,9 @@ def __init__(self, entry: AuditLogEntry, data: List[AuditLogChangePayload], *, s
if hasattr(self.after, 'location_type'):
from .scheduled_events import ScheduledEventLocation
if self.after.location_type is enums.ScheduledEventLocationType.external:
after = ScheduledEventLocation(state=state, location=after)
after = ScheduledEventLocation(state=state, value=after)
elif hasattr(self.after, 'channel'):
after = ScheduledEventLocation(state=state, location=self.after.channel)
after = ScheduledEventLocation(state=state, value=self.after.channel)

setattr(self.after, attr, after)

Expand Down
2 changes: 1 addition & 1 deletion discord/guild.py
Original file line number Diff line number Diff line change
Expand Up @@ -3264,7 +3264,7 @@ async def create_scheduled_event(
payload["privacy_level"] = int(privacy_level)

if not isinstance(location, ScheduledEventLocation):
location = ScheduledEventLocation(state=self._state, location=location)
location = ScheduledEventLocation(state=self._state, value=location)

payload["entity_type"] = location.type.value

Expand Down
6 changes: 3 additions & 3 deletions discord/scheduled_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,9 @@ def __init__(self, *, state: ConnectionState, guild: Guild, creator: Optional[Me
entity_metadata = data.get('entity_metadata')
channel_id = data.get('channel_id', None)
if channel_id != None:
self.location = ScheduledEventLocation(state=state, location=int(channel_id))
self.location = ScheduledEventLocation(state=state, value=int(channel_id))
else:
self.location = ScheduledEventLocation(state=state, location=entity_metadata["location"])
self.location = ScheduledEventLocation(state=state, value=entity_metadata["location"])

def __str__(self) -> str:
return self.name
Expand Down Expand Up @@ -304,7 +304,7 @@ async def edit(

if location is not MISSING:
if not isinstance(location, (ScheduledEventLocation, utils._MissingSentinel)):
location = ScheduledEventLocation(state=self._state, location=location)
location = ScheduledEventLocation(state=self._state, value=location)

if location.type is ScheduledEventLocationType.external:
payload["channel_id"] = None
Expand Down

0 comments on commit 18c5391

Please sign in to comment.