我的discord机器人有以下代码,它基本上是一个图像处理命令,但我不知道如何使用逗号分隔两个参数,在旧的discord.py中,我只会使用“message.content.split(“,””),但在discord.py重写中它似乎不再起作用,有什么建议或想法吗? 代码:
async def topone(ctx, *, frstInput = "Tartarus", scndInput = "riot"):
for attachment in ctx.message.attachments:
await attachment.save("toponeimg.png")
back_im = Image.open("toponetemplate.png")
imre = Image.open("toponeimg.png")
imre_resize = imre.resize((207, 116))
back_im.paste((imre_resize), (38, 29))
draw = ImageDraw.Draw(back_im)
imgFont = ImageFont.truetype("C:/Users/Flippy/AppData/Local/Microsoft/Windows/Fonts/Montserrat-Semibold.ttf", 34)
imgFont2 = ImageFont.truetype("C:/Users/Flippy/AppData/Local/Microsoft/Windows/Fonts/Montserrat-Semibold.ttf", 24,)
draw.text((318, 74), frstInput, (0, 0, 0), font=imgFont, anchor="ls")
# 'scndInput' is the argument I want to specify after a command, like "!topone Arg1, Arg2"
draw.text((262, 112), scndInput, (74, 74, 74), font=imgFont2, anchor="ls")
back_im.save("follow_hourly_bbc_on_twitter.png", quality=68)
await ctx.send(file = discord.File("follow_hourly_bbc_on_twitter.png"))
return
可以将所有文本作为单个字符串,然后用逗号分隔
相关问题 更多 >
编程相关推荐