diff options
| author | Joe Robinson <joe@lc8n.com> | 2016-10-15 20:59:27 +0100 | 
|---|---|---|
| committer | Joe Robinson <joe@lc8n.com> | 2016-10-15 20:59:27 +0100 | 
| commit | 777808182320e0584a38e2ae9fdfb6e8e7d99973 (patch) | |
| tree | c78e33ffc2eb333d8fb0eb33312e98387de7dbb1 /commands.js | |
| parent | 855db48bbba753508d68b7d91ec858855e003c9c (diff) | |
Move set topic and join channel functions to commands.js
Diffstat (limited to 'commands.js')
| -rw-r--r-- | commands.js | 34 | 
1 files changed, 34 insertions, 0 deletions
diff --git a/commands.js b/commands.js new file mode 100644 index 0000000..b8f53f5 --- /dev/null +++ b/commands.js @@ -0,0 +1,34 @@ +var client + +module.exports.init = function(myClient) { +    client = myClient +} + +module.exports.setTopic = function(channel, topic) { +    client.raw("TOPIC", channel, topic); +} + +module.exports.joinChannel = function (channel, sendJoin) { + +    var channelObj = client.channel(channel); +    if (sendJoin) { +        channelObj.join(); +        channelObj.say("beep"); +    } +    chanId = $(".active.chat").attr("data-id") + +    $(".active").removeClass("active"); + +    $(".ui.menu").append("<a class='active item' data-id='"+numChans+"' data-tab='"+channel+"'>"+channel+"</a>"); +    $("#chan-container").append("<div class='ui active tab' data-id='"+numChans+"' data-tab='"+channel+"'></div>"); + +    var chanTab = $("[data-tab='"+ channel +"'].tab"); + +    chanTab.append("<div class='ui selection list users' data-id='"+numChans+"' data-tab='"+channel+"'></div>"); +    chanTab.append("<div class='ui segment chat' data-id='"+numChans+"' data-tab='"+channel+"'></div>"); +    chanTab.append("<div class='ui topic' data-id='"+numChans+"' data-tab='"+channel+"'></div>"); + +    $('.menu .item').tab({history:false}); + +    numChans++; +}  | 
