Skip to content

Commit

Permalink
Reintroduce _invoke_flag
Browse files Browse the repository at this point in the history
  • Loading branch information
baronkobama committed Jun 17, 2022
1 parent 3623497 commit 7cd61ee
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion discord/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def _update(self, guild: Guild, data: Union[TextChannelPayload, ForumChannelPayl
self._type: int = data["type"]

# This data may be missing depending on how this object is being created/updated
if data.get("position", None) is not None:
if not data.pop("_invoke_flag", False):
self.topic: Optional[str] = data.get("topic")
self.position: int = data.get("position")
self.nsfw: bool = data.get("nsfw", False)
Expand Down
1 change: 1 addition & 0 deletions discord/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,7 @@ async def _invoke(self, ctx: ApplicationContext) -> None:
int(arg) in ctx.guild._channels or int(arg) in ctx.guild._threads
):
arg = ctx.guild.get_channel_or_thread(int(arg))
_data["_invoke_flag"] = True
arg._update(_data) if isinstance(arg, Thread) else arg._update(ctx.guild, _data)
else:
obj_type = None
Expand Down
2 changes: 1 addition & 1 deletion discord/threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def _from_data(self, data: ThreadPayload):
self.flags: ChannelFlags = ChannelFlags._from_value(data.get("flags", 0))

# Here, we try to fill in potentially missing data
if thread := self.guild.get_thread(self.id):
if thread := self.guild.get_thread(self.id) and data.pop("_invoke_flag", False):
self.owner_id = thread.owner_id if self.owner_id is None else self.owner_id
self.last_message_id = thread.last_message_id if self.last_message_id is None else self.last_message_id
self.message_count = thread.message_count if self.message_count is None else self.message_count
Expand Down

0 comments on commit 7cd61ee

Please sign in to comment.