【发布时间】:2021-04-10 00:15:52
【问题描述】:
我一直在开发一个新的 Discord 机器人。我已经学到了一些东西,现在我想让这些东西更加自定义。
我一直在尝试让机器人发送嵌入,而不是普通消息:
@bot.command()
async def testinfo(ctx, *, arg):
idtouser = robloxpy.GetName(f'{arg}'.format(arg))
usergroups = robloxpy.GetUserGroups(f'{arg}'.format(arg))
userjoin = robloxpy.AccountAgeDays(f'{arg}'.format(arg))
userbanned = robloxpy.IsBanned(f'{arg}'.format(arg))
userval = robloxpy.GetUserLimitedValue(f'{arg}'.format(arg))
onfriends = robloxpy.GetOnlineFriends(f'{arg}'.format(arg))
frinedsoff = robloxpy.GetOfflineFriends(f'{arg}'.format(arg))
embedVar = discord.Embed(title='user: {idtouser} account stats can be folow below'.format(arg))
embedVar.add_field(name = 'User value', value= "{userval}", inline = True)
embedVar.add_field(name = 'Check if banned', value = "{userbanned}", inline = True)
embedVar.add_field(name = 'User join date (in days)', value = "{userjoin}", inline = True)
embedVar.add_field(name = 'User groups', value = "{usergroups}", inline = True)
embedVar.add_field(name = 'Users friends online', value = "{onfriends}", inline = True)
embedVar.add_field(name = 'Users offline friends', value = "{friendsoff}", inline = True)
embed.set_footer(text=ctx.author.name, icon_url = ctx.author.avatar_url)
await ctx.send(embed=embedVar)
当我尝试运行我的机器人时,出现语法错误:
await ctx.send(embed=embedVar)
^
SyntaxError: invalid syntax
【问题讨论】:
标签: python syntax discord bots