IRCWebHooks
Barry Adding better IRC commands 17a841f (4 years, 1 month ago)
diff --git a/src/irc.c b/src/irc.c
index aa8f545..adfcb73 100644
--- a/src/irc.c
+++ b/src/irc.c
@@ -221,17 +221,35 @@ bot(void)
else
target = user;
- if (target == user && !strncmp(message, "JOIN ", 5) && auth(ident, vhost)) {
- raw("%s\r\n", message);
- char *p = message+5;
- while (*p++) if (*p == '\n' || *p == '\r' || *p == ' ') *p = '\0';
- insert_first(message+5);
- } else
- if (target == user && !strncmp(message, "LEAVE ", 6) && auth(ident, vhost)) {
- raw("PART %s\r\n", message+6);
- char *p = message+5;
- while (*p++) if (*p == '\n' || *p == '\r' || *p == ' ') *p = '\0';
- delete(message+6);
+ if (target == user) {
+ if (!strncmp(message, "JOIN ", 5) && auth(ident,vhost)) {
+ raw("%s\r\n", message);
+ char *p = message+5;
+ while (*p++) if (*p == '\n' || *p == '\r' || *p == ' ') *p = '\0';
+ insert_first(message+5);
+ raw("PRIVMSG %s :Joined %s\r\n", target, message+5);
+ } else if (!strncmp(message, "JOIN", 4) && auth(ident, vhost)) {
+ raw("PRIVMSG %s :%s\r\n", target, "Usage: JOIN #<channel name>");
+ }
+ if (!strncmp(message, "LEAVE ", 6) && auth(ident, vhost)) {
+ raw("PART %s\r\n", message+6);
+ char *p = message+5;
+ while (*p++) if (*p == '\n' || *p == '\r' || *p == ' ') *p = '\0';
+ delete(message+6);
+ raw("PRIVMSG %s :Left %s\r\n", target, message+6);
+ } else if (!strncmp(message, "LEAVE", 5) && auth(ident, vhost)) {
+ raw("PRIVMSG %s :%s\r\n", target, "Usage: LEAVE #<channel name>");
+ }
+ if (!strncmp(message, "HELP", 4) && auth(ident, vhost)) {
+ raw("PRIVMSG %s :%s\r\n", target, "IRC Web Hook Bot (https://barryserver.net/)");
+ raw("PRIVMSG %s :%s\r\n", target, "Commands:");
+ raw("PRIVMSG %s :%s\r\n", target, " JOIN #<channel>");
+ raw("PRIVMSG %s :%s\r\n", target, " Joins the specified channel");
+ raw("PRIVMSG %s :%s\r\n", target, " LEAVE #<channel>");
+ raw("PRIVMSG %s :%s\r\n", target, " Parts the specified channel");
+ raw("PRIVMSG %s :%s\r\n", target, " HELP");
+ raw("PRIVMSG %s :%s\r\n", target, " Shows this message");
+ }
}
#ifdef VERBOSE