Created
April 1, 2016 15:59
-
-
Save DrewDahlman/4d490ab03f83ff066628ea630094d37c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chatCommands: { | |
unknown: function(e) { | |
this.addSystemMessage('"/' + e + '" is not a command') | |
}, | |
help: function() { | |
this.addSystemMessage("Welcome to Robin."), this.addSystemMessage("Be sure to use the buttons in the sidebar to vote on the future of the room before the polls are closed."), this.addSystemMessage("Non-votes and abstentions will be counted as votes to abandon."), this.addSystemMessage("We do hope you enjoy the discussion.") | |
}, | |
commands: function() { | |
this.addSystemMessage("/vote abandon - vote to abandon"), this.addSystemMessage("/vote stay - vote to stay"), this.addSystemMessage("/vote grow - vote to grow"), this.addSystemMessage("/whois <user_in_room> - provide information about <user_in_room>") | |
}, | |
vote: function(t) { | |
if (this.room.isComplete()) { | |
this.addSystemMessage("voting is complete"); | |
return | |
} | |
var n = e.robin.VOTE_TYPES.map(function(e) { | |
return this.getLabelFromVote(e) | |
}, this); | |
if (!t) { | |
this.addSystemMessage("use: /vote [" + n.join(",") + "]"); | |
return | |
} | |
var r = t.toUpperCase(); | |
n.indexOf(r) < 0 && (r = this.getLabelFromVote(r)); | |
var i = this.getVoteFromLabel(r); | |
e.robin.VOTE_TYPES.indexOf(i) < 0 ? this.addSystemMessage("that is not a valid vote type") : i === this.currentUser.get("vote") ? this.addSystemMessage("that is already your vote") : (this.room.postVote(i), this.voteWidget.setActiveVote(i)) | |
}, | |
me: function() { | |
var e = [].slice.call(arguments).join(" "); | |
e.length > 0 ? this.room.postMessage("/me " + e) : this.addSystemMessage("use: /me your message here") | |
}, | |
whois: function(e) { | |
var t = this.roomParticipants.get(e); | |
if (!t) this.addSystemMessage("There is no user by that name in the room"); | |
else if (t === this.currentUser) this.addSystemMessage("That is you"); | |
else { | |
var n = t.get("present") ? "present" : "away"; | |
t.hasVoted() ? this.addSystemMessage("%(userName)s is %(presence)s and has voted to %(vote)s".format({ | |
userName: e, | |
presence: n, | |
vote: t.get("vote") | |
})) : this.addSystemMessage("%(userName)s is %(presence)s and has not voted".format({ | |
userName: e, | |
presence: n | |
})) | |
} | |
}, | |
leave_room: function() { | |
this.room.postLeaveRoom() | |
}, | |
remind: function(e) { | |
e = parseInt(e, 10); | |
var t = [].slice.call(arguments, 1).join(" "); | |
if (n.isNaN(e) || t.length === 0) { | |
this.addSystemMessage("use: /remind <seconds> <message>"); | |
return | |
} | |
var i = this.currentUser.get("name"), | |
s = i + ": " + t; | |
setTimeout(function() { | |
this.addSystemMessage(s.slice(0, r.RobinMessage.MAX_LENGTH)) | |
}.bind(this), e * 1e3), this.addSystemAction("set timer for " + e + " seconds from now") | |
}, | |
clear: function() { | |
this.chatWindow.startJuicyPoppin() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment