From 326968d8c8a1c5934a54c746eadca52b1700917e Mon Sep 17 00:00:00 2001 From: mio Date: Fri, 20 Jan 2023 18:32:52 +0000 Subject: [PATCH] [javapool] Add readme - [javapool] Add readme with build instructions - Fix message parsing crash when spaces appear as first char of message body (thanks lucidiot) --- .../{init => init-scripts}/javapool-openrc | 0 .../{init => init-scripts}/javapool.service | 0 bots/javapool/readme.md | 20 +++++++++++++++++++ cirrus.nim | 2 +- readme.md | 2 +- 5 files changed, 22 insertions(+), 2 deletions(-) rename bots/javapool/{init => init-scripts}/javapool-openrc (100%) rename bots/javapool/{init => init-scripts}/javapool.service (100%) create mode 100644 bots/javapool/readme.md diff --git a/bots/javapool/init/javapool-openrc b/bots/javapool/init-scripts/javapool-openrc similarity index 100% rename from bots/javapool/init/javapool-openrc rename to bots/javapool/init-scripts/javapool-openrc diff --git a/bots/javapool/init/javapool.service b/bots/javapool/init-scripts/javapool.service similarity index 100% rename from bots/javapool/init/javapool.service rename to bots/javapool/init-scripts/javapool.service diff --git a/bots/javapool/readme.md b/bots/javapool/readme.md new file mode 100644 index 0000000..02fb23a --- /dev/null +++ b/bots/javapool/readme.md @@ -0,0 +1,20 @@ +# javapool + + +## Install + +- Install [Nim], then build the executable: `nim c -d:release -d:ssl bot.nim` + +- Copy the `.config-sample/` directory and rename it to `.config`. + +- Edit .config/config.json` to insert the server connection details, and + `.config/codes.json` to add or remove the service codes to which the bot will + respond. + +- Run the bot: `./bot` + +- To run the bot in the background, you can use a service unit manager like + systemd (see examples of service files in `init-scripts/`). + + +[Nim]: https://nim-lang.org/install.html diff --git a/cirrus.nim b/cirrus.nim index 02e6272..1f529d0 100644 --- a/cirrus.nim +++ b/cirrus.nim @@ -191,7 +191,7 @@ proc parseMessage*(prefix: string, str: string): Message = var msg: Message strLen: int - if find(str, "PRIVMSG") != -1 and find(str, "!") != -1: + if find(str, "PRIVMSG") != -1 and find(str, ":" & prefix) != -1: # code strLen = split(str)[3].len() - 1 var cPLen = prefix.len() diff --git a/readme.md b/readme.md index ae75aa1..39a5afa 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,6 @@ # Readme -Cirrus is a IRC bot script. +Cirrus is a mini IRC bot script. ## License