我做了这个代码:
@client.command()
async def status(ctx):
em = discord.Embed(
title = 'Status',
color = 0x900ff,
description = "",
timestamp = ctx.message.created_at
)
em.add_field(name = "Online?", value = "Yes", inline=False)
em.add_field(name = "Ping?", value = f"{round(client.latency * 1000)}ms", inline=False)
em.set_author(name = "Brobotel V2 is Bacc", url ="", icon_url="https://i.imgur.com/mc9Gcdp.jpg")
em.set_footer(text = f'Invoked by: @{ctx.author}!')
await ctx.send(embed = em)
但它给了我一个错误:
答案 0 :(得分:0)
你的 em = discord.Embed(
应该像下面的例子一样缩进
import discord
from discord.ext import commands
client = commands.Bot(command_prefix='$')
@client.command()
async def status(ctx):
em = discord.Embed(
title = 'Status',
color = 0x900ff,
description = "",
timestamp = ctx.message.created_at
)
em.add_field(name = "Online?", value = "Yes", inline=False)
em.add_field(name = "Ping?", value = f"{round(client.latency * 1000)}ms", inline=False)
em.set_author(name = "Brobotel V2 is Bacc", url ="", icon_url="https://i.imgur.com/mc9Gcdp.jpg")
em.set_footer(text = f'Invoked by: @{ctx.author}!')
await ctx.send(embed = em)