+-Discord Shoutbox


Alternatively, join us on Discord directly.
You can help CodeWalrus stay online by donating here.

YukiBot

Started by Yuki, December 17, 2014, 11:03:21 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Yuki

December 17, 2014, 11:03:21 PM Last Edit: December 23, 2014, 05:48:55 PM by Juju
It's our post notifier bot I just wrote, along with a few features I should probably write (based on Eeems' EeeZorBot framework).

Features
- Notifies of posts made on CodeWalrus
- Provides services to the IRC channels

How it works

The forum software simply sends an UDP packet to the bot which posts it on IRC. Probably the simplest and the fastest way so it won't lag at all. I chose UDP because it's a connectionless protocol, unlike TCP.

Restart

Should you have the need restart it (which I doubt), it's pretty much the same way as OmnomIRC (it could probably be converted as a systemd service if you want). Look for something like "js lib/main.js" or "npm start", kill it, cd to where the bot is (currently in my homedir) and type "npm start" in a screen.

Code
If you guys want to write a mod, I'll post the current diff here:

--- Subs-Post.php~ 2014-12-17 21:38:52.494808188 +0000
+++ Subs-Post.php 2014-12-19 01:14:23.910808189 +0000
@@ -2032,6 +2032,15 @@
if ($msgOptions['approved'])
updateLastMessages($topicOptions['board'], $new_topic || !empty($topicOptions['is_approved']) ? $msgOptions['id'] : 0);

+ // Send this to IRC
+ if(!in_array($topicOptions['board'], array(2, 12)))
+ {
+        $ircsocket = stream_socket_client('udp://127.0.0.1:33333');
+        $sendstr = "PRIVMSG #CodeWalrus :\x0310New ".($new_topic?"topic":"post")." by \x0304".html_entity_decode($posterOptions['name'])."\x0310 on \x0303".html_entity_decode($msgOptions['subject'])."\x0310 http://codewalr.us/".$topicOptions['id']."/".$msgOptions['id'];
+        stream_socket_sendto($ircsocket, $sendstr);
+        fclose($ircsocket);
+ }
+
// Alright, done now... we can abort now, I guess... at least this much is done.
ignore_user_abort($previous_ignore_user_abort);


The diff is for both /Sources/Subs-Post.php and /mobiquo/include/Subs-Post.php (because Tapatalk copied the file in its own directory or I dunno).

For the bot plugins I added, it's here: https://github.com/juju2143/EeeZorBot-scripts

Current bugs
- Doesn't hide the staff board
- Tapatalk fixed!
- No customization other than modifying the code directly
- No topic length limit (it probably shouldn't be annoying but we can always add it if it's a problem, just tell me)
- Some commands are still experimental and can crash the bot

Have fun. :P
  • Calculators owned: TI-83+ (dead?), Casio Prizm (also dead???)
  • Consoles, mobile devices and vintage computers owned: A lot
Read Zarmina!
YUKI-CHAAAANNNN
In the beginning there was walrii. In the end there will be walrii. All hail our supreme leader :walrii: --Snektron



if you wanna throw money at me and/or CodeWalrus monthly it's here

DJ Omnimaga

December 18, 2014, 07:00:04 AM #1 Last Edit: December 18, 2014, 07:03:53 AM by DJ Omnimaga
Ok thanks for the tip. It should make it easier to upgrade until we get a mod of this. :)

I doubt topic lenght should be an issue, because of the short URLs.


I think nicknames should be made color-less or medium gray, though (there's an IRC character for that that is not black), because right now it might look too much like a ripoff of Omnimaga post notifications (we use the same color scheme). Green is fine, though, because the site mainly uses green anyway)
  • Calculators owned: TI-84 Plus C Silver Edition, TI-84 Plus CE, Casio fx-CG10, HP Prime, fx 1.0 Plus, fx-7400G Plus, fx-9750G Plus, fx-9860G, HP 39gII
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Nintendo Wii U

novenary

Hmmm nice. You might wanna consider moving it to freenode though once we have a better botnet.

Yuki

It should connect to all three networks, but I still have to figure out why it's not connecting to Omninet and Freenode. Once it's figured out the post notifier will move to Omninet.
  • Calculators owned: TI-83+ (dead?), Casio Prizm (also dead???)
  • Consoles, mobile devices and vintage computers owned: A lot
Read Zarmina!
YUKI-CHAAAANNNN
In the beginning there was walrii. In the end there will be walrii. All hail our supreme leader :walrii: --Snektron



if you wanna throw money at me and/or CodeWalrus monthly it's here

DJ Omnimaga

  • Calculators owned: TI-84 Plus C Silver Edition, TI-84 Plus CE, Casio fx-CG10, HP Prime, fx 1.0 Plus, fx-7400G Plus, fx-9750G Plus, fx-9860G, HP 39gII
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Nintendo Wii U

novenary


Yuki

She's on all three networks now. Also, if you want me to implement some features to her, like Google/DDG/CodeWalrus search, output the title of an URL or even improvments to the post notifier, please tell me and I'll try to work on them over the Xmas vacations.
  • Calculators owned: TI-83+ (dead?), Casio Prizm (also dead???)
  • Consoles, mobile devices and vintage computers owned: A lot
Read Zarmina!
YUKI-CHAAAANNNN
In the beginning there was walrii. In the end there will be walrii. All hail our supreme leader :walrii: --Snektron



if you wanna throw money at me and/or CodeWalrus monthly it's here

pimathbrainiac

Yay it works!

Should I take WalTopic down now?
Well, I'm bach here too!

DJ Omnimaga

Keep a copy in case we ever have major issues with the bot we got right now, though.
  • Calculators owned: TI-84 Plus C Silver Edition, TI-84 Plus CE, Casio fx-CG10, HP Prime, fx 1.0 Plus, fx-7400G Plus, fx-9750G Plus, fx-9860G, HP 39gII
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Nintendo Wii U

aeTIos

Why not name it YuukiBot as a reference to SAO2 :P
ceci n'est pas une signature

DJ Omnimaga

Ideally it should be named CodeWalrus or ^New and the post notifications made so that they use the /me command, so that way they are shorter. Eg they should probably look like this:

* CodeWalrus post by DJ Omnimaga in Walrification begins monday! http://codewalr.us/56/1946
  • Calculators owned: TI-84 Plus C Silver Edition, TI-84 Plus CE, Casio fx-CG10, HP Prime, fx 1.0 Plus, fx-7400G Plus, fx-9750G Plus, fx-9860G, HP 39gII
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Nintendo Wii U

Yuki

Quote from: aeTIos on December 19, 2014, 07:48:11 AM
Why not name it YuukiBot as a reference to SAO2 :P
Because it's a reference to Haruhi Suzumiya. (And because I mostly always use Yuki as a character name, but yeah, Haruhi.)

Quote from: DJ Omnimaga on December 19, 2014, 12:05:59 PM
Ideally it should be named CodeWalrus or ^New and the post notifications made so that they use the /me command, so that way they are shorter. Eg they should probably look like this:

* CodeWalrus post by DJ Omnimaga in Walrification begins monday! http://codewalr.us/56/1946
That's an idea.
  • Calculators owned: TI-83+ (dead?), Casio Prizm (also dead???)
  • Consoles, mobile devices and vintage computers owned: A lot
Read Zarmina!
YUKI-CHAAAANNNN
In the beginning there was walrii. In the end there will be walrii. All hail our supreme leader :walrii: --Snektron



if you wanna throw money at me and/or CodeWalrus monthly it's here

novenary

Hmmm does it sync topics (with omnom too) ? Cause iirc omnom topic syncing doesn't work.

DJ Omnimaga

If you mean the /topic command, then it won't sync unless the bot has ops in the channel. But again maybe it's broken. :P
  • Calculators owned: TI-84 Plus C Silver Edition, TI-84 Plus CE, Casio fx-CG10, HP Prime, fx 1.0 Plus, fx-7400G Plus, fx-9750G Plus, fx-9860G, HP 39gII
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Nintendo Wii U

Yuki

  • Calculators owned: TI-83+ (dead?), Casio Prizm (also dead???)
  • Consoles, mobile devices and vintage computers owned: A lot
Read Zarmina!
YUKI-CHAAAANNNN
In the beginning there was walrii. In the end there will be walrii. All hail our supreme leader :walrii: --Snektron



if you wanna throw money at me and/or CodeWalrus monthly it's here

Powered by EzPortal