Почему не работают дополнительные элементы Эмбеда?

Не работает всё, что начинается с embed.set

@bot.command()
async def test(ctx):
    emb = discord.Embed(
        title="Title", description="This is a description", colour=discord.Colour.blue())
    
    # Отсюда не работает
    embed.set_footer(text="This is a footer.")
    embed.set_image(url="https://cdn.discordapp.com/attachments/520265639680671747/533389224913797122/rtgang.jpeg")
    embed.set_thumbnail(url="https://cdn.discordapp.com/attachments/520265639680671747/533389224913797122/rtgang.jpeg")
    embed.set_author(name="Author Name",
                     icon_url="https://cdn.discordapp.com/attachments/520265639680671747/533389224913797122/rtgang.jpeg")
    # До сюда
    await ctx.send(embed=emb)

Код до команды:

import discord
from discord.ext import commands


TOKEN = ''
client = discord.Client()
bot = commands.Bot(command_prefix='$')

Текст ошибки:

Ignoring exception in command test:
Traceback (most recent call last):
  File "D:\pyprojects\venv\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "D:/pyprojects/Embed bot/DsBotMain.py", line 48, in test
    embed.set_footer(text="This is a footer.")
AttributeError: 'Command' object has no attribute 'set_footer'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "D:\pyprojects\venv\lib\site-packages\discord\ext\commands\bot.py", line 903, in invoke
    await ctx.command.invoke(ctx)
  File "D:\pyprojects\venv\lib\site-packages\discord\ext\commands\core.py", line 859, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "D:\pyprojects\venv\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Command' object has no attribute 'set_footer'


Ответы (1 шт):

Автор решения: denisnumb

Ошибка в том, что вы создаете embed с названием emb, а после пытаетесь добавить изображения и прочие наполнения не в него, а в несуществующий объект embed.

В строчках, приведенных ниже, замените embed на ваш объект emb

embed.set_footer()
embed.set_image()
embed.set_thumbnail()
embed.set_author()

Также, по поводу несущественной проблемы.

У вас в коде объявлено 2 бота:

client = discord.Client() 

и

bot = commands.Bot(command_prefix='$')

При этом второй имеет больший функционал, так как умеет обрабатывать команды. Рекомендую убрать discord.Client() из кода и все client просто заменить на bot. Работать будет также

→ Ссылка