我正在开发一个类似聊天机器人的IRC,用于连接IP.Board论坛,它将用于游戏和闲逛。我有一个命令问题,它真的开始困扰我,因为它一开始工作,然后开始抛出由函数的elif部分引起的错误。我昨晚在测试,它似乎工作得很好,但当我今天早上启动来做更多的工作时,它开始抛出错误:
user, newItem = args.split("with", 1)
ERROR requires 2 arguments but only one was specified
我已经包括了下面的脚本代码
编辑:我修复了这个问题,并更新了下面的代码,以帮助其他人
if cmd == "slap":
try:
if args == user.lower():
group.sendPost("-slaps "+args+" with "+random.choice(Items)+"-")
else:
user, newItem = args.split("with", 1)
group.sendPost("-Slaps "+user+" with "+newItem+"-")
f = open("DictItems", "a")
f.write("" + newItem + '\n')
f.close()
except:
print("Slap Command Errored with NewItem")
group.sendPost("I'm sorry, that command seems to be broken. I have notified the staff.")
self.sendPM(Yusei, "I'm sorry to inform but the slap command has failed with an error defining the newItem. Please look into it. Thank you.")
我也向那个通知我我不能那样做的人道歉。我看的时候把它看错了。谢谢你让我知道。这是最新的代码
相关问题 更多 >
编程相关推荐