discord.pydiscord-interactions

Discord.py bot not able to send embed messages?


Trying to implement embedded messages for my discord bot using interactions. The following is the code with the error message under it.

import interactions
import discord

bot = interactions.Client(token="<REDACTED>")

@bot.command(
    name="test",
    description="Tests"
)
async def test(ctx: interactions.CommandContext):
    embed = interactions.Embed(
        title="testing",
        description="test purposes"
    )
    await ctx.send(embed = embed)

Error Message:

payload = await super().send(content, **kwargs)

TypeError: _Context.send() got an unexpected keyword argument 'embed'

Solution

  • interactions.py documentation said This is quite simple: The argument embed got deprecated by Discord. The new naming is embeds.
    Changed embed into embeds and it works now.

    @bot.command(
        name="test",
        description="Tests"
    )
    async def test(ctx: interactions.CommandContext):
        embeds = interactions.Embed(
            title="testing",
            description="test purposes"
        )
        await ctx.send(embeds = embeds)