How do I run a node IRC bot? - node.js

I'd like to run this IRC Eliza bot but I lack some fundamental understanding of how to do it.
https://github.com/isaacs/node-eliza
I don't know anything about IRC or how to connect to them. Could someone explain how I connect to this bot? Do I need to host it remotely? Is there a way to run an IRC client locally and connect to it locally? Currently the program just runs without error but does nothing.
I understand node.js, but I seem to missing some fundamentals in understanding IRC on how to get an IRC bot running.
The readme gives me code that executes but doesn't do anything, quoted below:
Usage
var Eliza = require('eliza/irc.js')
new Eliza({ server: 'irc.freenode.net'
, nick: 'Eliza'
, channels: ['##turtles']
, userName: 'eliza'
, realName: 'eliza' })

IRC is the a global chat system, comprised of many individual hosts, all (eventually) linked. You usually don't run a part of IRC yourself, rather you use a client to connect to one of the hosts and thus gain access to the network and everyone on it.
An IRC bot is a piece of machine code that has its own logic (Eliza's logic, in your case), and is also connected to IRC and issues IRC commands that let it join channels, talk to other people/bots, received messages, etc.
In your case, you would simply need to run the bot, and let it know which IRC server to join (that the server parameter in new Eliza({...), what nick name to choose for itself, etc.
To run the bot just run node, in any environment (your home PC? hosting?) with the contents of the sample file.

Related

How to implement Laravel, node.js, socket.io and redis for creating realtime chat/notifications with database

I spend already 3 days for reading, watching tutorials about WebSockets, socket.io, node.js and so on.
Basically, I'm a Laravel developer and have just a basic idea about all the rest components.
With regret, after these 3 days I don't have in mind all logic step-by-step of implementing this architecture. I will try to explain what did I understand and you please correct me.
So :
WebSockets - is a bidirectional continuous connection between client and server. It uses another port, and basically it is not a HTTP/S connection.
For making this kind of app like I said, we need one more server, and idk why, but this is Node.js. At this Node.js server we should install socket.io (server-side package) and Redis.
Then, we need to add client-side socket.io (via CDN probably).
At Node.js server we are creating a server.js file where require all modules that we need, like socket.io and Redis. We open a connection for a specific non-used port (as 6001). Then we run this node server.
At front-end we are subscribe-ing to this channel and define method for emitting and listening to the server.
Example :
User1 is connecting to a specific route. User2 as well. User1 type a message for User2, when press Submit, message from User1 is sent to Node.js server, where it is sent in Redis(yes? if yes - Why?), and then Node.js is listening for what to do in this case, and send this message to specific user, or with broadcast to all users except the publisher.
Oh, it's even hard to explain that, too much steps and tehcnologies used.
Can please someone correct my logic? I really want to understand all that process and logic of using this components. Or please, give me some useful articles and videos, may be I didn't saw them. Thanks!
I suggest you read the official docs on how to build chat. Basically what you will have in the end is 2 servers, 1 for your Laravel app and the other for chat (Socket.io) . The key to this is using broadcasters and listening for events on both sides, frontend and backend.
Events are broadcast over "channels", which may be specified as public or private. Any visitor to your application may subscribe to a public channel without any authentication or authorization; however, in order to subscribe to a private channel, a user must be authenticated and authorized to listen on that channel.

HipChat Nodejs Bot - Cant receive room messages

I am trying to create an hip chat bot with nodejs. The main library is node-xmpp. However at the moment the build is failing and I think thats why my nom install doesn't work.
Any who I managed to write my own version based on the core modules.
- node-xmpp-client
- node-xmpp-component
- node-xmpp-jid
I can see messages fine and send. But only private! although I am registered in a room I cannot see room messages.
The source code of node-xmpp says thats a message or stanza should have a type and from that understand if the message is private or not. Well to me only private messages come. I wonder if its an issue with Hipchat.
If you want to take a look at the code, I made a github repo as it would an overkill to page here. github
The 'problem' lies with the xmpp protocol itself.
Due to the way the protocol works, you need to have joined the room before you can receive messages from it.
Why I was, lead to believe otherwise, was because hip chat showed the user as online on the room, but in reality he is not online on the group he is just online.

Running an IRC bot under current nick?

I'm developing my own irc bot and in a channel I'm in, one of the ops is able to activate a bot but run it under his own nick without a new nick joining the channel.
For example, guy's nick is #James and he activated a bot that says hello when you do .hello:
+John: .hello
#James: Hello, John.
Any idea how is this done possibly? The only way I've been able to run my bot is to connect it to the server & channel with a completely new nick.
This really depends on how the bot is written/implemented. Some IRC clients (like MIRC or HexChat/X-Chat) support scripting. As such you're able to extend them to act just like bots even though someone is actually using them as a standard client. I could also imagine some interface being use, like a bouncer, which allows multiple clients to connect to one permanent IRC session.
there are 2 ways
eggdrops
or mIRCScripting
script like on texts, can't be triggered by yourself
example
on $*:text:/^\.h(i|ello)$/iS:#:{
msg $chan $+(h,$regml(1)) $nick
}
the difference is, when you run your bot on the same mIRC client
you can specify who is the owner of the bot, and who is not
like
on $*:text:/^\.h(i|ello)$/iS:#:{
if ($me == botname) {
msg $chan $+(h,$regml(1)) $nick
}
}
the script will only trigger, if it is running under Bot's name

Execute irc action on computer

Just as the title says, I want a command be done when a certain word is said in my irc channel.
Ex: If someone types "Hey!" in the channel, the server performs an action like restarting an services.
The channel is private and only I will be getting access to it.
The purpose of it will be that if I send a command from my office that I want to restart Apache (example).
Then I'll type apacherst, the irc sends the command to my server and restarts apache.
Any idea?
Thanks!
/Phew
Check out a program called Hubot. It has a plug-in mechanism to let make your chat server extensible. It supports IRC and many other protocols.

A way to transfer IRC chatter/pm to gtalk

I'd like to know if some sort of bot/tool/service exists that would allow people on (regular) IRC chat to me on gtalk
so: irc user X sends a pm to MyBot (f.e.); that pm forwards to me
a irc room to chat would also work fine (so everything said in channel #abc gets into my gtalk conversation with mybot#domain.com
hope I was clear enough for you to understand what I'm looking for and that anyone knows a way for me to solve it.
Thanks!
You can use PircBotX to create an IRC bot in Java yourself, and use pm events to send gtalk messages using any old Jabber library. A quick search finds me Smack.
I did something similar once, but I made two instances of PircBotX, one to connect to the IRC server, and another to connect to this special IRC server somewhere that was configured to automatically pass on messages to popular IM protocols. I can't seem to remember what that service was called, perhaps you'll have better luck.
Well, there's the hans-irc-gtalk bot which does something like that. People need to subscribe to the messages in order to get them from gtalk. Not sure how well supported the project is.

Resources