so i have been trying to make a serverinfo commands but it always give me an error.
My code:
@bot.command(name='ServerInfo', description='Shows Server Info')
async def serverinfo(ctx):
member = len(ctx.guild.members)
Roles = len(ctx.guild.roles)
embed = nextcord.Embed(title='**Information:**')
embed.add_field(name='Name:', value=ctx.guild.name, inline=False)
embed.add_field(name='ID:', value=ctx.guild.id, inline=False)
embed.add_field(name='Owner:', value=ctx.guild.owner_id, inline=False)
embed.add_field(name='Created At:', value=ctx.guild.created_at.strftime('Day: %d/%m/%Y Hour: %H:%M:%S %p'), inline=False)
embed.add_field(name='Region:', value=ctx.guild.region, inline=False)
embed.add_field(name='Total Members:', value=f'`{member}`', inline=False)
embed.add_field(name=f'Total Roles:', value=f'`{Roles}`', inline=False)
embed.set_thumbnail(url=ctx.guild.icon_url)
embed.set_author(name=ctx.author, icon_url=ctx.author.avatar_url)
embed.timestamp = datetime.datetime.utcnow()
await ctx.send(embed=embed)
Here is the error:
raise CommandInvokeError(exc) from exc
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Guild' object has no attribute 'icon_url'
The same thing happens with ctx.author.avatar_url. Can anyone help?
Thanks!