Properly implement querying with API
This commit is contained in:
@@ -499,5 +499,12 @@ class API(object):
|
||||
name = f"{net}{num}"
|
||||
if name not in main.IRCPool.keys():
|
||||
return dumps({"success": False, "reason": f"relay {num} not on {net}"})
|
||||
main.IRCPool[name].sendmsg(channel, msg)
|
||||
# We are in a query
|
||||
if channel == main.IRCPool[name].nickname:
|
||||
if "nick" not in data:
|
||||
return dumps({"success": False, "reason": "no nick specified to query"})
|
||||
else:
|
||||
main.IRCPool[name].sendmsg(data["nick"], msg, in_query=True)
|
||||
else:
|
||||
main.IRCPool[name].sendmsg(channel, msg)
|
||||
return dumps({"success": True, "message": f"sent message to {channel} on {name}"})
|
||||
|
||||
Reference in New Issue
Block a user