import disnake
import os
from disnake.ext import commands
class slash(commands.Cog):
def __int__(self, bot):
self.bot = bot
print('Модуль {} загружен'.format(self.__class__.__name__))
@commands.command()
async def avatar(self, ctx, *, member: disnake.Member = None):
if not member:
member = ctx.message.author
userAvatar = member.avatar_url
em = disnake.Embed(color=disnake.Color.from_rgb(255, 0, 0), title="Ссылка на аватар", url=userAvatar)
em.set_image(url=f"{userAvatar}")
em.set_author(name=f"{member}", icon_url=f"{userAvatar}")
em.set_footer(text=f'Сделанно: {ctx.message.author}', icon_url=f"{ctx.author.avatar_url}")
await ctx.reply(embed=em)
def setup(bot):
bot.add_cog(slash(bot))
Ignoring exception in command avatar:
Traceback (most recent call last):
File "C:\bot\venv\lib\site-packages\disnake\ext\commands\core.py", line 173, in wrapped
ret = await coro(*args, **kwargs)
File "c:\bot\cogs\avatar.py", line 13, in avatar
userAvatar = member.avatar_url
AttributeError: 'Member' object has no attribute 'avatar_url'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\bot\venv\lib\site-packages\disnake\ext\commands\bot_base.py", line 589, in invoke
await ctx.command.invoke(ctx)
File "C:\bot\venv\lib\site-packages\disnake\ext\commands\core.py", line 914, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\bot\venv\lib\site-packages\disnake\ext\commands\core.py", line 182, in wrapped
raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Member' object has no attribute 'avatar_url'
Ignoring exception in command avatar:
Traceback (most recent call last):
File "C:\bot\venv\lib\site-packages\disnake\ext\commands\core.py", line 173, in wrapped
ret = await coro(*args, **kwargs)
File "c:\bot\cogs\avatar.py", line 13, in avatar
userAvatar = member.avatar_url
AttributeError: 'Member' object has no attribute 'avatar_url'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\bot\venv\lib\site-packages\disnake\ext\commands\bot_base.py", line 589, in invoke
await ctx.command.invoke(ctx)
File "C:\bot\venv\lib\site-packages\disnake\ext\commands\core.py", line 914, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\bot\venv\lib\site-packages\disnake\ext\commands\core.py", line 182, in wrapped
raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Member' object has no attribute 'avatar_url'