mirror of
https://github.com/reality/dbot.git
synced 2024-11-27 14:29:29 +01:00
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].votes, vote)) {
|
||||
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[vote]++;
|
||||
polls[name].votees[user] = vote;
|
||||
@ -131,6 +131,13 @@ var commands = function(dbot) {
|
||||
var name = event.input[1].toLowerCase();
|
||||
|
||||
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', {
|
||||
'name': name,
|
||||
'description': polls[name].description,
|
||||
@ -139,7 +146,7 @@ var commands = function(dbot) {
|
||||
'port': dbot.config.web.webPort,
|
||||
'path': 'polls/' + name
|
||||
})
|
||||
}));
|
||||
}) + optionString);
|
||||
} else {
|
||||
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}"
|
||||
},
|
||||
"poll_describe": {
|
||||
"english": "{name}: {description} - {url}"
|
||||
"english": "{name}: {description} - {url}."
|
||||
},
|
||||
"changed_vote": {
|
||||
"english": "{user} changed their vote in {poll} to '{vote}' ({count}).",
|
||||
|
Loading…
Reference in New Issue
Block a user