mirror of
https://git.wownero.com/dsc/craiyon-irc.git
synced 2024-08-15 01:03:24 +00:00
better command parsing
This commit is contained in:
parent
12c2d3ff9f
commit
44015f2475
1 changed files with 13 additions and 5 deletions
18
main.py
18
main.py
|
@ -162,14 +162,22 @@ async def message_received(nick, target, message, **kwargs):
|
||||||
|
|
||||||
async def handle_msg(nick, msg, target, now: float):
|
async def handle_msg(nick, msg, target, now: float):
|
||||||
global TASK_AUTHORS, TASK_QUEUE
|
global TASK_AUTHORS, TASK_QUEUE
|
||||||
if not msg.startswith("!dall "):
|
|
||||||
|
def _err(target, err):
|
||||||
|
return bot.send("PRIVMSG", target=target, message=err)
|
||||||
|
|
||||||
|
if "!dall" not in msg:
|
||||||
return
|
return
|
||||||
msg = msg[6:].strip()
|
|
||||||
|
spl = msg.split(' ')
|
||||||
|
if "!dall" not in spl[:2]:
|
||||||
|
return
|
||||||
|
|
||||||
|
msg = msg[msg.find("!dall"):]
|
||||||
|
msg = msg[5:].strip()
|
||||||
|
|
||||||
if len(msg) <= 8:
|
if len(msg) <= 8:
|
||||||
err = f"{nick}: longer query required."
|
return _err(target, f"longer query required.")
|
||||||
bot.send("PRIVMSG", target=target, message=err)
|
|
||||||
return
|
|
||||||
|
|
||||||
TASK_AUTHORS.setdefault(nick, 0)
|
TASK_AUTHORS.setdefault(nick, 0)
|
||||||
if TASK_AUTHORS[nick] >= 3:
|
if TASK_AUTHORS[nick] >= 3:
|
||||||
|
|
Loading…
Reference in a new issue