Git Product home page Git Product logo

talkertexasranger's Introduction

TalkerTexasRanger

Is a bot for TalkerApp.com with plugin support. This is still in beta and not stable. If you find any bugs please create an issue, or why not contribute with a solution?

Getting started

Get and install node.js

http://nodejs.org/#download

Install TalkerTexasRanger

Download TalkerTexasRanger as a zip file or

git clone [email protected]:I-ARE-RIO/TalkerTexasRanger.git

Create a config.json file, you can use config.json.example as a starting point.

{
  "host": "you.talkerapp.com",
  "port": 8500,
  "token": "find this at: http://you.talkerapp.com/settings#api",
  "rooms": [
    { "name": "Main", "id": "9999" },
    { "name": "Slave", "id": "333" }
  ],
  "plugins": [
    "example"
  ],
  "command": "!"
}

host: The hostname to connect to, most likely this is you.talkerapp.com where you is the account name.
port: This is most likely the default 8500
token: Token is your personal user key to to authenticate and it can be found at: http://talkerapp.com/settings#api
rooms: A list of rooms that you want the bot to connect to at application start up.
plugins: A list of plugins that gets autoloaded at application start up.
command: The command indicator. All registered commands will be prefixed with this. For example **!**hello

Run it from your command line using

node TalkerTexasRanger

Plugins

Plugins is the core foundation of TalkerTexasRanger without them he would be just a silent observer.
A plugin is simply a regular node module that hooks into the talker client in different ways.
TalkerTexasRanger includes several plugins (or atleast aims to) that you can opt in and use if you like.
However chances are that you want to write your own custom Plugins. So here is how you do it:

Create myplugin.js inside the plugins/ directory

This is actually not a must, but highly recommended. The plugin loader will look first inside plugins/ directory then fallback into looking inside node_modules/ etc.

Get talker client instance

At the very beginning of myplugin.js:

var talker = require('../lib/talker');

talker.on (event, listener, [rooms])

When the event occurs the listener will be called with a data object containing information about
the event as its first and only parameter.
By default the event listener is added to each room, but optionally a list of rooms can be supplied.
There are several events that your plugin can listen too.

connected: when TalkerTexasRanger connects to a room.
join: when a user enters a room.
leave: when a user leaves a room.
users: when the client receives a "Who's here" message when joining a room.
message: when someone writes a message to a room.
failure: when any error within TalkerApp has occured.
idle: when a users goes idle.
back: when a users comes back from idle.

talker.on('connected', function (data) {
  talker.message(data.room, 'Hello world!');
} 

talker.command (command, callback, [rooms])

Listens for commands prefixed by an command identifier which is specified in config.json.
Commands can take any number of arguments separated by [space]. This example listens for the message !sum n n n... in all rooms.

talker.command('sum', function(data, args) {
  var sum = args.reduce(function (a, b) {
    return a + b;
  });
  talker.message(data.room, sum);
});

talkertexasranger's People

Contributors

riovv avatar puj avatar

Stargazers

 avatar wolfjung avatar  avatar

Watchers

 avatar

Forkers

puj

talkertexasranger's Issues

Unexpected token {

Sometimes it works:

00:53:04 #Sitra Connected to frojd.talkerapp.com:8500
00:53:04 #Test Connected to frojd.talkerapp.com:8500
00:53:04 #Main Connected to frojd.talkerapp.com:8500
00:53:05 #Sitra Authorized as chuck.norris ([email protected])
00:53:05 #Sitra Who's here: chuck.norris
00:53:05 #Test Authorized as chuck.norris ([email protected])
00:53:05 #Main Authorized as chuck.norris ([email protected])
00:53:05 #Test Who's here: chuck.norris
00:53:05 #Main Who's here: chuck.norris

00:52:56 #Sitra Connected to xxx.talkerapp.com:8500
00:52:56 #Main Connected to xxx.talkerapp.com:8500
00:52:56 #Test Connected to xxx.talkerapp.com:8500
00:52:56 #Sitra Authorized as chuck.norris ([email protected])
00:52:56 #Sitra chuck.norris has entered the room
00:52:56 #Sitra Who's here: chuck.norris
00:52:56 #Test Authorized as chuck.norris ([email protected])

Sometimes it doesn't:

undefined:2
{"type":"join","id":"31aeebe01fa6012f529212313d01ccc7","time":1326412256,"user
^
SyntaxError: Unexpected token {
at Object.parse (native)
at [object Object].messageLog (/path/TalkerTexasRanger/lib/talker.js:99:19)
at CleartextStream. (native)
at CleartextStream.emit (events.js:67:17)
at CleartextStream._push (tls.js:357:31)
at SecurePair.cycle (tls.js:684:20)
at EncryptedStream.write (tls.js:122:13)
at Socket.ondata (stream.js:38:26)
at Socket.emit (events.js:67:17)
at TCP.onread (net.js:347:14)

Arguments for talker.command

The ability to add use arguments with a command. !hello world.
It should be possible to use n arguments.
Each argument should be passed to the callback as a parameter.

Color theme

Create a color theme to be used for all the console output with consistency and good design in mind.

package.json

A package.json containing information for npm including dependencies etc.

Plugin Support

API for writing plugins that can be attached to all the events sent by TalkerApp.

Admin authentication

Another user should be able to authenticate and administer TalkerTexasRanger through TalkerApp commands.

Gravatar

Since TalkerApp.com uses gravatar, TalkerTexasRanger should include a nice Chuck Norris gravatar image.
Format 1:1

Multiple rooms

TalkerTexasRanger should be able to connect to multiple rooms and manage them correctly.

pingpong kills Talker 15-16

This occurs on startup within one hour after pingis.

15:06:19 #ROOM1< Time for ping pong everyone!
15:06:19 #ROOM2 < Time for ping pong everyone!
15:06:20 #ROOM1 Connected to team.talkerapp.com:8500
15:06:20 #ROOM2 Connected to team.talkerapp.com:8500
15:06:20 #ROOM1 Not connected to a channel
15:06:20 #ROOM2 Not connected to a channel

tls.js:96
    throw new Error('CryptoStream is not writable');
          ^
Error: CryptoStream is not writable
     at CleartextStream.write (tls.js:96:11)
     at [object Object].write (C:\pgammin\Node\TalkerTexasRanger\lib\talker.js:157:31)
     at Object.message (C:\pgammin\Node\TalkerTexasRanger\lib\talker.js:123:22)
     at C:\pgammin\Node\TalkerTexasRanger\lib\talker.js:131:12
     at Array.forEach (native)
     at Object.broadcast (C:\pgammin\Node\TalkerTexasRanger\lib\talker.js:130:9)
     at C:\pgammin\Node\TalkerTexasRanger\plugins\svnmonitor\index.js:97:15
     at C:\pgammin\Node\TalkerTexasRanger\node_modules\svnmonitor\index.js:100:3
     at ChildProcess.exithandler (child_process.js:281:7)
     at ChildProcess.emit (events.js:70:17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.