我想将消息作为单个参数发送,但是API使用空格作为参数的分隔符。如何禁用它?
我有一个不和谐的机器人,我想向他发送一堆单词作为1个单个参数,但是API使用空格作为参数的分隔符。如何禁用它?我已经阅读了文档,但找不到任何内容。
@client.command()
async def addiata(ctx, mensaje):
# Removing comas from strings
iata = re.sub(",", "", iata)
ciudad = re.sub(",", "", ciudad)
estado = re.sub(",", "", estado)
if len(estado) > 2:
await ctx.send(f"{iata} couldn't be added.")
return
# Checks if its in the right format
if len(iata) == 3 and iata.isupper() and iata.isalpha():
x = f"{iata}: {ciudad} {estado}"
for i in IATAS:
if x == i:
await ctx.send(f"{iata} couldn't be added because its repeated.")
return
IATAS.append(x)
saveList(IATAS, "iatas.npy")
iatas = loadList("iatas.npy")
await ctx.send(f'{iata} has been added.')
else:
await ctx.send(f"{iata} couldn't be added.")
让我们说消息是:“。addiata ORD,伊利诺伊州芝加哥奥黑尔” 返回值是ORD,Chicago,O'Hare而不是 ORD,伊利诺伊州芝加哥奥黑尔
问题在于它使用空格作为分隔符