Skip to content

Latest commit

History

23 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

#LCTV Bot

##Setup Create an oject that contains your nickname and passowrd and pass it to the module

config.json

{
"nickname": "test",
"password": "test"
}

main.js

varlctvbot=require('lctvbot');varconfig=require('./config.json');varbot=newlctvbot(config);

##Events ###online This event fire when the bot comes online, it get's passed the data variable

bot.on('online',function(data){bot.join('channel');});

###error Fired when the xmpp-client throws and error

bot.on('error',function(e){console.error(e);});

###message The raw message event, this is available for anyone who wants to parse the raw data.

bot.on('message',function(stanza){console.log(stanza.toString());});

###msg Event fired when a user sends a message

bot.on('msg',function(nickname,channel,message,stanza){console.log(nickname+'said '+message+' in '+channel);});

###presence The raw even for presence

bot.on('presence',function(stanza){console.log(stanza.toString());});

###join Fired when a user join the chat. NOTE: This will fire when the bot joins a channel for all current users

bot.on('join',function(channel,nickname,stanza){console.log([channel,nickname,stanza.toString()]);});

###part Fires when a user leaves the channel

bot.on('part',function(channel,nickname,stanza){bot.message(channel,'Goodbye'+nickname+'!','groupchat');});

##Functions ###join Makes the bot join a channel. This can recieve a raw name from the stanza or just the channel name.

bot.join('sean111');bot.join('sean111@chat.livecoding.tv');

###part Makes the bot leave a channel

bot.part('sean111');bot.part('sean111@chat.livecoding.tv');

###getMessage Gets the message from a message stanza

varmessage=bot.getMessage(stanza);

###message Sends a message to the channel ( LCTV doesn't currently support user messaging, "chat" type )

bot.message('sean111','Hello World!','groupchat');

###getNickname Gets the nickname from the stanza

varnickname=bot.getNickname(stanza);

###getChannel Gets the channel from the stanza

varchannel=bot.getChannel(stanza);

###isMod Returns if the user is a mod in the channel or not ( true / false )

if(bot.isMod(channel,nickname){console.log(nickname+" is a mod");}

About

Node module to create a bot for livecoding.tv using XMPP

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages