From 778edb26afa7a1bf48e148379ce2c30f3ee12090 Mon Sep 17 00:00:00 2001 From: Nihilazo Date: Wed, 29 Sep 2021 19:16:53 +0100 Subject: [PATCH] add irc bot, everything is in haiku, even this commit --- irc.pd | 209 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ ircmsg.pd | 15 ++++ 2 files changed, 224 insertions(+) create mode 100644 irc.pd create mode 100644 ircmsg.pd diff --git a/irc.pd b/irc.pd new file mode 100644 index 0000000..687d7cf --- /dev/null +++ b/irc.pd @@ -0,0 +1,209 @@ +#N canvas 628 59 1084 779 12; +#X obj 261 205 netsend -b; +#X obj 328 238 sel 10; +#X msg 181 148 disconnect; +#X obj 367 329 list store; +#X msg 403 258 append \$1; +#X obj 399 397 list tosymbol; +#X msg 328 289 bang; +#X obj 328 263 t b b, f 6; +#X obj 399 422 print incoming; +#X msg 261 148 connect localhost 6669; +#X text 119 103 connect to irc; +#X obj 367 354 t a a; +#X text 502 398 log; +#X obj 229 95 t b b; +#X obj 243 515 list tosymbol; +#X obj 342 515 list tosymbol; +#X obj 243 565 symbol; +#X obj 243 652 s server; +#X obj 658 341 r server; +#X obj 34 311 s server; +#X obj 656 303 s server; +#X obj 656 279 ircmsg; +#X obj 243 625 ircmsg; +#X obj 229 35 bng 50 250 50 0 empty empty join! 50 7 0 20 -258113 -1 +-1; +#X obj 34 287 ircmsg; +#X obj 698 391 list tosymbol; +#X obj 306 178 r server; +#X obj 698 416 print; +#X obj 658 366 list split 1; +#X text 24 510 server sends a PING \,; +#X text 24 532 send a matching PONG to it.; +#X text 20 14 Doing IRC; +#X text 20 33 using music patch language \,; +#X text 20 52 cursed? I do not know.; +#X text 101 286 first send register \,; +#X text 101 306 server knows that we're a friend; +#X text 101 326 tell it where to chat; +#X text 753 316 this is to debug; +#X text 753 340 log outgoing messages; +#X text 753 364 to see if they break; +#X msg 656 254 symbol PRIVMSG\ #bots\ :beep\ boop; +#X text 24 554 This only just works.; +#X msg 243 590 symbol PONG\\\ \$1; +#X obj 243 485 list split 5; +#X obj 243 540 sel PING\ ; +#X obj 243 460 t a a, f 33; +#X text 563 525 loop through the message; +#X text 563 544 see if PRIVMSG is found; +#X text 563 563 if so \, do respond!; +#X obj 471 521 list length; +#X obj 471 577 until; +#X obj 471 546 t f b; +#X obj 471 603 f; +#X obj 498 603 + 1; +#X msg 512 577 0; +#X obj 471 658 list store; +#X obj 471 683 list tosymbol; +#X text 585 671 very bad way to do this; +#X text 585 652 this parsing is shit \,; +#X msg 471 628 get \$1 8; +#X obj 471 708 sel PRIVMSG\ ; +#X obj 471 733 f; +#X text 532 446 need to clean this up; +#X text 532 465 it is an unholy mess; +#X text 532 484 [s] and [r] should help; +#X obj 404 764 list split; +#X obj 471 485 t l l l; +#X text 585 690 does not work that well; +#X text 508 760 we got PRIVMSG; +#X text 508 779 time to seperate the text; +#X text 508 798 from the protocol; +#X msg 506 730 bang; +#X obj 437 826 list length; +#X obj 437 882 until; +#X obj 437 851 t f b; +#X obj 437 908 f; +#X obj 464 908 + 1; +#X msg 478 882 0; +#X obj 437 963 list store; +#X obj 437 988 list tosymbol; +#X obj 407 1013 f; +#X obj 437 790 t l l l; +#X msg 477 1013 bang; +#X msg 437 933 get \$1 1; +#X obj 437 1013 sel :; +#X text 525 878 same way as before; +#X text 525 898 loop through for delimiter; +#X text 525 918 this time \, for the text!; +#X obj 340 1076 list split; +#X obj 407 1038 + 2; +#X obj 373 1098 s message_text; +#X obj 551 26 r message_text; +#X text 678 28 when there's PRIVMSG; +#X text 678 49 this thing gets the text of it; +#X text 678 70 do stuff with it here!; +#X obj 517 166 list store; +#X obj 551 50 t b b l; +#X obj 517 108 f; +#X obj 555 109 + 1; +#X msg 574 83 0, f 2; +#X msg 517 139 get \$1 1; +#X text 661 124 serialise list; +#X text 661 145 for each letter play a beep; +#X text 661 166 annoying? maybe; +#X msg 584 195 0; +#X obj 517 276 testsynth; +#X obj 517 301 dac~; +#X obj 517 251 makenote 127 50; +#X obj 500 78 metro 100; +#X obj 517 193 mod 60; +#X obj 517 218 + 20; +#X msg 34 231 symbol USER\ pdbot\ 0\ *\ :puredatabot \, symbol NICK\ pdbot +\, symbol JOIN\ #tildetown \,, f 33; +#X connect 0 1 1 0; +#X connect 1 0 7 0; +#X connect 1 1 4 0; +#X connect 2 0 0 0; +#X connect 3 0 11 0; +#X connect 4 0 3 0; +#X connect 5 0 8 0; +#X connect 6 0 3 1; +#X connect 7 0 6 0; +#X connect 7 1 3 0; +#X connect 9 0 0 0; +#X connect 11 0 45 0; +#X connect 11 1 5 0; +#X connect 13 0 111 0; +#X connect 13 1 9 0; +#X connect 14 0 44 0; +#X connect 15 0 16 1; +#X connect 16 0 42 0; +#X connect 18 0 28 0; +#X connect 21 0 20 0; +#X connect 22 0 17 0; +#X connect 23 0 13 0; +#X connect 24 0 19 0; +#X connect 25 0 27 0; +#X connect 26 0 0 0; +#X connect 28 1 25 0; +#X connect 40 0 21 0; +#X connect 42 0 22 0; +#X connect 43 0 14 0; +#X connect 43 1 15 0; +#X connect 44 0 16 0; +#X connect 45 0 43 0; +#X connect 45 1 66 0; +#X connect 49 0 51 0; +#X connect 50 0 52 0; +#X connect 51 0 50 0; +#X connect 51 1 54 0; +#X connect 52 0 53 0; +#X connect 52 0 59 0; +#X connect 52 0 61 1; +#X connect 53 0 52 1; +#X connect 54 0 52 0; +#X connect 55 0 56 0; +#X connect 56 0 60 0; +#X connect 59 0 55 0; +#X connect 60 0 61 0; +#X connect 60 0 71 0; +#X connect 61 0 65 1; +#X connect 65 1 81 0; +#X connect 66 0 65 0; +#X connect 66 1 49 0; +#X connect 66 2 55 1; +#X connect 71 0 50 1; +#X connect 72 0 74 0; +#X connect 73 0 75 0; +#X connect 74 0 73 0; +#X connect 74 1 77 0; +#X connect 75 0 76 0; +#X connect 75 0 83 0; +#X connect 75 0 80 1; +#X connect 76 0 75 1; +#X connect 77 0 75 0; +#X connect 78 0 79 0; +#X connect 79 0 84 0; +#X connect 80 0 89 0; +#X connect 81 0 88 0; +#X connect 81 1 72 0; +#X connect 81 2 78 1; +#X connect 82 0 73 1; +#X connect 83 0 78 0; +#X connect 84 0 80 0; +#X connect 84 0 82 0; +#X connect 88 1 90 0; +#X connect 89 0 88 1; +#X connect 91 0 96 0; +#X connect 95 0 109 0; +#X connect 95 1 104 0; +#X connect 96 0 108 0; +#X connect 96 1 99 0; +#X connect 96 2 95 1; +#X connect 97 0 98 0; +#X connect 97 0 100 0; +#X connect 98 0 97 1; +#X connect 99 0 97 1; +#X connect 100 0 95 0; +#X connect 104 0 108 0; +#X connect 105 0 106 0; +#X connect 105 0 106 1; +#X connect 107 0 105 0; +#X connect 107 1 105 1; +#X connect 108 0 97 0; +#X connect 109 0 110 0; +#X connect 110 0 107 0; +#X connect 111 0 24 0; diff --git a/ircmsg.pd b/ircmsg.pd new file mode 100644 index 0000000..345ff3f --- /dev/null +++ b/ircmsg.pd @@ -0,0 +1,15 @@ +#N canvas 169 570 353 206 12; +#X obj 19 23 inlet; +#X obj 19 57 list fromsymbol; +#X obj 19 82 list prepend send; +#X obj 19 107 list append 10; +#X obj 19 132 list trim; +#X obj 19 157 outlet; +#X text 135 22 symbol conversion; +#X text 135 39 into network messages \,; +#X text 135 56 this is a bad way.; +#X connect 0 0 1 0; +#X connect 1 0 2 0; +#X connect 2 0 3 0; +#X connect 3 0 4 0; +#X connect 4 0 5 0;