Skip to content

PartialMessage.edit does not work with DesignerView (cv2) #3236

@Paillat-dev

Description

@Paillat-dev

Summary

It is not possible to use the PartialMessage.edit method when passing a DesignerView instance as view.

Reproduction Steps

  1. Send a message with the bot
  2. Get its id
  3. Use message = get_partial_message(id)
  4. Use await message.edit(view=DesignerView(TextDisplay("Hello World")))

Minimal Reproducible Code

import discord
import os
from dotenv import load_dotenv
import logging

logging.basicConfig(level=logging.INFO)

load_dotenv()

bot = discord.Bot()


@bot.slash_command()
async def ping(ctx: discord.ApplicationContext):
    await ctx.respond("Pong")
    message = await ctx.send("Hello World")

    view = discord.ui.DesignerView(discord.ui.TextDisplay("Hello World"))

    partial_message = ctx.channel.get_partial_message(message.id)
    await partial_message.edit(view=view)


bot.run(os.getenv("TOKEN_2"))

Expected Results

The message to be edited

Actual Results

The edit fails with

  File "[...].venv\Lib\site-packages\discord\message.py", line 2578, in edit
    data = await self._state.http.edit_message(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "[...].venv\Lib\site-packages\discord\http.py", line 393, in request
    raise HTTPException(response, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In components.0: Value of field "type" must be one of (1,).

Intents

n/a

System Information

n/a

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.

Additional Context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomers

Type

No fields configured for Bug.

Projects

Status
In Progress

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions