Skip to content

Instantly share code, notes, and snippets.

@jwcrawley
Created November 9, 2015 16:03
Show Gist options
  • Save jwcrawley/66df682a1c810af72707 to your computer and use it in GitHub Desktop.
Save jwcrawley/66df682a1c810af72707 to your computer and use it in GitHub Desktop.
IRC Logging Bot

This is a flow that creates a bot for IRC, and logs all content to a Dropbox account/file of your choice.

To make this work, import the flow to your local node-red instance. From there, you will need to configure the nodes. You will also need the IRC and Dropbox node-red nodes.

-Configuration-

IRC node: Add a new IRC server and choose which channel you would like to record

File (connected to IRC flow): Change "/path/to/filename.txt" to the location where you want the file to be saved.

File (in/out): Change "/path/to/filename.txt" to appropriate filename and location provided above.

Dropbox: Create API key and set up account on Dropbox side. Copy the Secret, Key, and Token for the app you make. This is all done on Dropbox.com's website. Then you copy and paste them in setup. Then provide the filename, and then the path to the filename.

Then deploy the node. It will take about 5 seconds for the 'Bot to show up in the channel. Logging will be done to Dropbox every 10 seconds. That can be configured by changing the settings on Inject node.

[{"id":"5e6318ba.6f02f","type":"irc in","name":"","ircserver":"","channel":"","x":232,"y":195,"z":"567f9779.93c7e8","wires":[["d7234329.904838","b200dbe5.7044f"],["6f04a8f4.7c09f"]]},{"id":"bbd1b18a.2b4d","type":"file","name":"","filename":"/path/to/filename.txt","appendNewline":true,"createDir":false,"overwriteFile":"false","x":648,"y":190,"z":"567f9779.93c7e8","wires":[]},{"id":"98abaf7a.437258","type":"dropbox out","dropbox":"","filename":"filename.txt","localFilename":"/path/to/filename.txt","name":"","x":616,"y":405,"z":"567f9779.93c7e8","wires":[]},{"id":"35282e1e.ed0ada","type":"file in","name":"","filename":"/path/to/filename.txt","format":"utf8","x":370,"y":406,"z":"567f9779.93c7e8","wires":[["98abaf7a.437258"]]},{"id":"938b0b98.54c878","type":"inject","name":"","topic":"","payload":"","payloadType":"none","repeat":"10","crontab":"","once":true,"x":175,"y":407,"z":"567f9779.93c7e8","wires":[["35282e1e.ed0ada"]]},{"id":"d7234329.904838","type":"debug","name":"","active":true,"console":"false","complete":"payload","x":511,"y":112,"z":"567f9779.93c7e8","wires":[]},{"id":"b200dbe5.7044f","type":"function","name":"","func":"msg.datetime = new Date().toString();\nif (msg.to == \"#hntesting\"){\n msg.payload = msg.datetime + \" \" + msg.topic +\": \" + msg.payload;\n}else{\n msg.payload = msg.datetime +\" \" + msg.to +\" \"+ msg.topic + \" : \" + msg.payload ;\n}\nreturn msg;","outputs":1,"noerr":0,"x":453,"y":190,"z":"567f9779.93c7e8","wires":[["bbd1b18a.2b4d"]]},{"id":"6f04a8f4.7c09f","type":"function","name":"","func":"if(msg.payload.join != null){msg.payload = msg.payload + msg.payload.join;}\nif(msg.payload.part != null){msg.payload = msg.payload + msg.payload.part;}\nif(msg.payload.quit != null){msg.payload = msg.payload + msg.payload.quit;}\nif(msg.payload.kick != null){msg.payload = msg.payload + msg.payload.kick;}\n\nreturn msg;","outputs":1,"noerr":0,"x":452,"y":232,"z":"567f9779.93c7e8","wires":[["bbd1b18a.2b4d"]]}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment