@Dizzeryyy

Ошибка с icon_url disnake. как исправить?

ошибка: disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'ApplicationCommandInteraction' object has no attribute 'icon_url'

код: ```import datetime
from datetime import datetime
from datetime import timezone
from distutils.sysconfig import PREFIX
from http import HTTPStatus, client
from multiprocessing.connection import Client
from this import d
import disnake
from disnake.ext import commands
from config import config

prefix = '!'
bot = commands.Bot(command_prefix=prefix, intents=disnake.Intents.all())

@bot.event
async def on_ready():
activity = disnake.Game(name="/help", type=1)
await bot.change_presence(status=disnake.Status.idle, activity=activity)
print("Bot is ready!")

@bot.slash_command(description="Shows basic information about the user.")
async def user(inter, user: disnake.Member = None):
if user is None:
user = inter.author

roles = [role for role in user.roles if role !=inter.guild.default_role]

embed = disnake.Embed(title=f"Information about {user}", colour= disnake.Color.dark_green(), timestamp=datetime.now(timezone.utc))


embed.set_thumbnail(url=user.display_avatar),

embed.set_footer(text='Flopis', icon_url="https://images-ext-2.discordapp.net/external/rkSJM...")

embed.add_field(name='ID:', value=user.id,inline=False)
embed.add_field(name="Display Name:", value=user.display_name, inline=False)
embed.add_field(name='Name:', value=user.name,inline=False)




t = user.status
if t == disnake.Status.dnd:
d = "<:dnd:1044169181010079744> Do Not Disturb"

t = user.status
if t == disnake.Status.online:
d = "<:online:1044165216038039552> Online"

t = user.status
if t == disnake.Status.idle:
d = "<:idle:1044167187268640878> Idle"

t = user.status
if t == disnake.Status.offline:
d = "<:offline:1044169516621512734> Offline"
embed.add_field(name="Status:", value=d,inline=False)

if user.activity is not None:
embed.add_field(name="Activity:", value=user.activity.name,inline=False)


embed.add_field(name='Joined at:',value=disnake.utils.format_dt(user.joined_at, style="f"),inline=False)
embed.add_field(name='Created at:', value=disnake.utils.format_dt(user.created_at, style="f"), inline=False)

embed.add_field(name="Top role:", value=user.top_role.mention, inline=False)
embed.add_field(name="Roles:", value="".join(role.mention for role in roles), inline=False)


embed.add_field(name='Bot?', value=user.bot,inline=False)

await inter.send(embed=embed)
await inter.response.defer()

@bot.slash_command(description="Shows the user's avatar.")
async def avatar(inter, user: disnake.Member = None):
if user is None:
user = inter.author

user = inter.author if not user else user
embed = disnake.Embed(title=f"Avatar {user.name}", colour= disnake.Color.dark_green(), timestamp=datetime.now(timezone.utc))
embed.set_footer(text='Flopis', icon_url="https://images-ext-2.discordapp.net/external/rkSJM...")
embed.set_image(url=user.display_avatar)
embed.set_author(name=f"Avatar - {user}")
await inter.send(embed=embed)

@bot.slash_command(description="Shows basic information about the server.")
async def server(inter):
role_count = len(inter.guild.roles)
list_of_bots = [bot.mention for bot in inter.guild.members if bot.bot]
owner=inter.guild.owner_id
server = str(inter.guild.name)
region = str(inter.guild.region)
icon = str(inter.icon_url)

embed = disnake.Embed(title=f"Information about {server}", colour= disnake.Color.dark_green(), timestamp=datetime.now(timezone.utc))
embed.set_thumbnail(url=icon)

embed.add_field(name="Name:", value=f"{inter.guild.name}", inline=False)
embed.add_field(name="Members:", value=inter.guild.member_count, inline=False)
embed.add_field(name="Verification Level:", value=str(inter.guild.verification_level), inline=False)
embed.add_field(name="Top Role:", value=inter.guild.roles[-2], inline=False)
embed.add_field(name="Number Roles:", value=str(role_count), inline=False)
embed.add_field(name="Bots:", value=', '.join(list_of_bots), inline=False)
embed.add_field(name="Server ID:", value=inter.guild.id, inline=False)
embed.add_field(name="Server Owner:", value=f'<@{owner}>')
embed.add_field(name="Text channels:", value=len(inter.author.guild.text_channels), inline=False)
embed.add_field(name=" Voice channels:", value=len(inter.author.guild.voice_channels), inline=False)
embed.add_field(name="Categories:", value=len(inter.author.guild.categories), inline=False)
embed.add_field(name="Description:", value=inter.guild.description, inline=False)
embed.add_field(name="Region:", value=region, inline=False)
embed.set_footer(text='Flopis', icon_url="https://images-ext-2.discordapp.net/external/rkSJM...")

await inter.send(embed=embed)

@bot.slash_command(description="Выдать мут пользователю")
@commands.has_permissions(administrator=True)
async def mute(inter: disnake.CommandInteraction, member: disnake.Member = None, time: str = None, reason='Не указана'):
if member == inter.author:
await inter.response.send_message('Вы не можете замутить сами себя.')

bot.run(config['token'])```
  • Вопрос задан
  • 189 просмотров
Пригласить эксперта
Ответы на вопрос 1
Ошибка в команде /server.

Решение:
icon = str(inter.guild.icon)
embed.set_thumbnail(url=icon)
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы