Skip to content

Commit bab2b14

Browse files
authored
better impl
1 parent 9bea01e commit bab2b14

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

discord/interactions.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,7 +1186,8 @@ async def edit_message(
11861186
if parent.type not in (InteractionType.component, InteractionType.modal_submit):
11871187
return
11881188

1189-
flags = MessageFlags._from_value(self._parent.message.flags.value)
1189+
is_cv2 = None
1190+
11901191
payload = {}
11911192
if content is not MISSING:
11921193
payload["content"] = None if content is None else str(content)
@@ -1205,7 +1206,7 @@ async def edit_message(
12051206
state.prevent_view_updates_for(message_id)
12061207
payload["components"] = [] if view is None else view.to_components()
12071208
if view and view.is_components_v2():
1208-
flags.is_components_v2 = True
1209+
is_cv2 = True
12091210

12101211
if file is not MISSING and files is not MISSING:
12111212
raise InvalidArgument(
@@ -1232,8 +1233,12 @@ async def edit_message(
12321233
# we keep previous attachments when adding new files
12331234
payload["attachments"] = [a.to_dict() for a in msg.attachments]
12341235

1235-
if suppress is not MISSING:
1236-
flags.suppress_embeds = suppress
1236+
if suppress is not MISSING or is_cv2:
1237+
flags = MessageFlags._from_value(msg.flags.value)
1238+
if is_cv2:
1239+
flags.is_components_v2 = True
1240+
if suppress is not MISSING:
1241+
flags.suppress_embeds = suppress
12371242
payload["flags"] = flags.value
12381243

12391244
if allowed_mentions is None:

0 commit comments

Comments
 (0)