Server Info Command Discord.py
@client.command()
async def server(ctx):
embed = discord.Embed(title = f"{ctx.guild.name} Info", description = "Information of this Server", color = discord.Colour.blue())
embed.add_field(name = '🆔Server ID', value = f"{ctx.guild.id}", inline = True)
embed.add_field(name = '📆Created On', value = ctx.guild.created_at.strftime("%b %d %Y"), inline = True)
embed.add_field(name = '👑Owner', value = f"{ctx.guild.owner}", inline = True)
embed.add_field(name = '👥Members', value = f'{ctx.guild.member_count} Members', inline = True)
embed.add_field(name = '💬Channels', value = f'{ctx.guild.text_channel_count} Text | {ctx.guild.voice_channel_count} Voice', inline = True)
embed.add_field(name = '🌎Region', value = f'{ctx.guild.region}', inline = True)
embed.set_thumbnail(url = ctx.guild.icon_url)
embed.set_footer(text = "⭐ • Duo")
embed.set_author(name = f'{ctx.guild.name}', url = embed.Empty, icon_url = {ctx.guild.icon_url})
await ctx.send(embed=embed)
I wrote this Code, everything seems fine, when I run the bot, there are no errors. The terminal is blank, but when I run this command, it doesn't work, it doesn't send a response, there is no error in the terminal also. Please Help..
At first glance, you're not indenting properly. I also have never heard of url = embed.Empty
.
As an aside, I replaced the embed.set_author
line embed.set_author(name = f'{ctx.guild.name}', icon_url = {ctx.guild.icon_url})
with embed.set_author(name = f'{ctx.author.name}' icon_url = {ctx.message.author.avatar_url}
because it seemed to me like that was the line you wanted to display information about the author rather than the guild.
@client.command()
async def server(ctx):
embed = discord.Embed(title = f"{ctx.guild.name} Info", description = "Information of this Server", color = discord.Colour.blue())
embed.add_field(name = '🆔Server ID', value = f"{ctx.guild.id}", inline = True)
embed.add_field(name = '📆Created On', value = ctx.guild.created_at.strftime("%b %d %Y"), inline = True)
embed.add_field(name = '👑Owner', value = f"{ctx.guild.owner}", inline = True)
embed.add_field(name = '👥Members', value = f'{ctx.guild.member_count} Members', inline = True)
embed.add_field(name = '💬Channels', value = f'{ctx.guild.text_channel_count} Text | {ctx.guild.voice_channel_count} Voice', inline = True)
embed.add_field(name = '🌎Region', value = f'{ctx.guild.region}', inline = True)
embed.set_thumbnail(url = ctx.guild.icon_url)
embed.set_footer(text = "⭐ • Duo")
embed.set_author(name = f'{ctx.author.name}' icon_url = {ctx.message.author.avatar_url}
await ctx.send(embed=embed)
If resolving your indentation and removing url = embed.Empty
doesn't do the trick, then you'll have to run debug print statements line by line until you isolate the troublesome line.