forked from GitHub/dbot
Show voting options in ~pdesc [#155]
This commit is contained in:
parent
dd9962d465
commit
4d01187346
@ -98,7 +98,7 @@ var commands = function(dbot) {
|
|||||||
if(_.has(polls, name)) {
|
if(_.has(polls, name)) {
|
||||||
if(_.has(polls[name].votes, vote)) {
|
if(_.has(polls[name].votes, vote)) {
|
||||||
if(_.has(polls[name].votees, user)) {
|
if(_.has(polls[name].votees, user)) {
|
||||||
var oldVote = polls[name].votees[event.user];
|
var oldVote = polls[name].votees[user];
|
||||||
polls[name].votes[oldVote]--;
|
polls[name].votes[oldVote]--;
|
||||||
polls[name].votes[vote]++;
|
polls[name].votes[vote]++;
|
||||||
polls[name].votees[user] = vote;
|
polls[name].votees[user] = vote;
|
||||||
@ -131,6 +131,13 @@ var commands = function(dbot) {
|
|||||||
var name = event.input[1].toLowerCase();
|
var name = event.input[1].toLowerCase();
|
||||||
|
|
||||||
if(_.has(polls, name)) {
|
if(_.has(polls, name)) {
|
||||||
|
var options = _.keys(polls[name].votes);
|
||||||
|
var optionString = " Choices: ";
|
||||||
|
for(var i=0;i<options.length;i++) {
|
||||||
|
optionString += options[i] + ', ';
|
||||||
|
}
|
||||||
|
optionString = optionString.slice(0, -2) + '.';
|
||||||
|
|
||||||
event.reply(dbot.t('poll_describe', {
|
event.reply(dbot.t('poll_describe', {
|
||||||
'name': name,
|
'name': name,
|
||||||
'description': polls[name].description,
|
'description': polls[name].description,
|
||||||
@ -139,7 +146,7 @@ var commands = function(dbot) {
|
|||||||
'port': dbot.config.web.webPort,
|
'port': dbot.config.web.webPort,
|
||||||
'path': 'polls/' + name
|
'path': 'polls/' + name
|
||||||
})
|
})
|
||||||
}));
|
}) + optionString);
|
||||||
} else {
|
} else {
|
||||||
event.reply(dbot.t('poll_unexistent', { 'name': name }));
|
event.reply(dbot.t('poll_unexistent', { 'name': name }));
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
"na'vi": "sìpawm sna'o '{name}' ngìyop ({description}). Nga tìpe'unit Pe'eiun - {url}"
|
"na'vi": "sìpawm sna'o '{name}' ngìyop ({description}). Nga tìpe'unit Pe'eiun - {url}"
|
||||||
},
|
},
|
||||||
"poll_describe": {
|
"poll_describe": {
|
||||||
"english": "{name}: {description} - {url}"
|
"english": "{name}: {description} - {url}."
|
||||||
},
|
},
|
||||||
"changed_vote": {
|
"changed_vote": {
|
||||||
"english": "{user} changed their vote in {poll} to '{vote}' ({count}).",
|
"english": "{user} changed their vote in {poll} to '{vote}' ({count}).",
|
||||||
|
Loading…
Reference in New Issue
Block a user