Discord/Python:TypeError:只能将str(而不是“资产”)连接到str
我正在调试,我想我发现了问题。但我不明白 这是密码Discord/Python:TypeError:只能将str(而不是“资产”)连接到str,python,discord,discord.py,Python,Discord,Discord.py,我正在调试,我想我发现了问题。但我不明白 这是密码 async def ship(ctx, qim: discord.Member = None): #if no one is pinged if not qim: # Error message await ctx.send("bu sunucudaki birini etiketleyin!") #if someone is pinged continue else:
async def ship(ctx, qim: discord.Member = None):
#if no one is pinged
if not qim:
# Error message
await ctx.send("bu sunucudaki birini etiketleyin!")
#if someone is pinged continue
else:
#author and pinged users profile pictures
pic1 = ctx.message.author.avatar_url
pic2 = qim.avatar_url
#their usernames without # tag
name1 = str(ctx.message.author.display_name)
name2 = str(qim.display_name)
#send the variables, of course for debugging
await ctx.send(' pic1: ' + pic1 + ' pic2: ' + pic2 + ' name1: ' + name1 + ' name2: ' + name2)
当有人ping时抛出这个错误
TypeError: can only concatenate str (not "Asset") to str
我在谷歌上搜索了what's asset,什么也没找到://
我不知道为什么它不起作用,当你查看user.avatar\u url的文档时,我复制了其他人关于这部分代码的作业,它说返回类型是“资产”。如果将调用包装在str()中,那么它应该将url转换为字符串类型 e、 g
pic1 = str(ctx.message.author.avatar_url)
pic2 = str(qim.avatar_url)