Commit Graph

59 Commits

Author SHA1 Message Date
Ivo Julca
4fa6c5499b Build: Fix issues reported by the latest Eslint version 2016-11-17 14:27:39 -05:00
panpawn
76285471a0 Fix double errorReply while muted in some cases (#2830)
Due to the recent refactor that changed how `this.canTalk` works, if a user was muted in a room, and then tried to do a command that wasn't allowed to be used if they can't talk, it would send two replies: "You are muted and cannot talk in this room." AND "You cannot do this while unable to talk."

This makes it so that if you're using a command while muted that isn't allowed to be used if you can't talk, it will just use the "You are muted and cannot talk in this room." errorReply.
2016-10-08 20:58:16 -07:00
Guangcong Luo
d6f5404e7e Rename CommandParser to Chat
We had a lot of discussion in Dev and a somewhat-close poll, but in
the end "Chat" was a better name than "Messages", and also has the
advantage of being shorter (which is nice for Chat.html and
Chat.plural which should be short).
2016-09-30 18:31:15 -07:00
Guangcong Luo
da1b318707 Move text processing from Tools to CommandParser
The following functions have been renamed:

- Tools.html to CommandParser.html
- Tools.plural to CommandParser.plural
- Tools.escapeHTML to CommandParser.escapeHTML
- Tools.toDurationString to CommandParser.toDurationString
- Tools.toTimeStamp to CommandParser.toTimestamp
  (notice the lowercase 's')

This is in preparation for a rename of Tools to Dex (by removing the
non-dex-related functions) and a rename of CommandParser to either
Messages or Chat.
2016-09-30 18:04:13 -07:00
Lord-Haji
2ce71c5e19 Polls: add "button" class to the button (#2652) 2016-09-26 13:38:16 -07:00
Guangcong Luo
e420ed88a2 Polls: Improve separator detection 2016-09-12 16:14:32 -05:00
spekss
a5c99b71c5 Add help command for /poll htmlcreate" (#2715)
* Add help command for /poll htmlcreate"

* Update poll.js

* Update poll.js

* Update poll.js

* Update poll.js

* Update poll.js

* Update poll.js

* Update poll.js

* Update poll.js

* Update poll.js
2016-08-25 06:23:09 -05:00
panpawn
01213fcf0b Polls: Fix not showing results on blank vote (#2673)
I've experienced this problem before, and it's sometimes hard to replicate, but this should correct it.

The reason why this was a problem was that because of the return statement, the line this.updateTo(user); never actually happened, so it wasn't updating in one specific instance.
2016-08-06 20:02:26 +04:00
panpawn
36d7728b06 Update help commands to reflect new bot rank (#2634)
Also, give the bot rank the new addhtml permission in config/config-example.js

... And, we are going to fix promoting locked users to rank bot.
2016-07-20 19:50:47 -06:00
Ivo Julca
d5cb9af524 Polls: warn when trying to queue commands on creation 2016-06-02 19:31:32 -05:00
Ivo Julca
80b4ba55ad Polls: add support for multiline input in creation and HTML in options 2016-05-29 18:36:59 -05:00
Ivo Julca
b6b7b3cca3 Poll: Export Poll class 2016-05-26 18:55:30 -05:00
Ivo Julca
ea9f7e3bd4 Poll: Add support for HTML in questions 2016-04-12 21:04:29 -05:00
Guangcong Luo
df9997b748 Nicer looking poll buttons 2016-04-11 19:49:15 -04:00
panpawn
5ff893b8a5 polls: Make button style remain consistent
Before, if a button text spanned over one line, it would default to the OS buttons.



Using the button class with in-line CSS, this makes the buttons remain consistent regardless of how many lines the button spans for a poll question.
2016-04-06 21:12:04 -07:00
Ivo Julca
10bb83bf3c Improvements to command broadcast API
- Method `this.runBroadcast()` has been split from `this.canBroadcast()`.
It's now the only method handling command-usage and intended as the main API
for synchronous commands. Async commands will execute both separately.
Note that the `suppressMessage` parameter is now passed to `runBroadcast`.

- The semantics of `broadcasting` have been similarly split.
`this,broadcastMessage` will be set to a truthy value when `this.canBroadcast` is run.
`this,broadcasting` will only be set to `true` once `this.runBroadcast` is executed.
2016-04-02 15:46:13 -05:00
Arburator
dc8a328118 minute(s) not minutes [poll.js]
"The poll timer was turned on: the poll will end in 1 minutes"
2016-03-28 17:17:56 +01:00
Bär Halberkamp
3465829e22 Add permissions for roomgames 2016-02-26 22:19:19 +01:00
Bär Halberkamp
c207fab3cd Fix false negatives in polls upon joining 2016-02-17 21:09:44 +01:00
Guangcong Luo
b665660608 Refactor for more ES6 features
Now that nodejs/node#3072 is mostly fixed, we can finally start using
Node 4+ features.

This refactor:

- uses arrow functions where appropriate

  Note that arrow functions still aren't used in Mocha, where `this`
  is sometimes meaningful.

  This also removes the need for .bind() nearly everywhere, as well
  as the `self = this` trick.

- refactors Validator and Connection into ES6 classes

- no longer uses Array#forEach for iterating arrays

  We strongly prefer for (let i = 0; i < arr.length; i++) because of
  performance reasons. Most forEaches have been replaced with for..of,
  though, which is 5x slower than the long-form loop but 2x faster
  than forEach, which is good enough outside of most inner loops.

  The only exception is tournaments, which is due for a more invasive
  refactor soon anyway.
2016-02-10 17:40:21 -06:00
Marty-D
ccd75e0325 Fix build error in 64a5b14445 2016-01-27 21:51:00 -05:00
Guangcong Luo
64a5b14445 Polls: Make clear you can't vote after seeing results 2016-01-27 18:32:59 -05:00
Guangcong Luo
b355059f4e Polls: Optimize bandwidth use 2016-01-27 18:32:59 -05:00
Guangcong Luo
9d245a1652 Revert "Revert "Remove explicit decimal radix from parseInt""
This reverts commit 55df20be60.
2016-01-07 18:45:50 -06:00
Slayer95
55df20be60 Revert "Remove explicit decimal radix from parseInt" 2016-01-05 12:56:32 -05:00
Bär Halberkamp
c254c663d3 Remove explicit decimal radix from parseInt 2016-01-05 17:35:12 +01:00
Konrad Borowski
81f602b8d8 Always use trailing comma for multiline objects 2016-01-01 00:20:07 +01:00
panpawn
239accce9d Poll: replies should say 'timer', not 'timeout'
"Timeout" is mostly a programming term; not something I want to show users. - Zarel
2015-12-21 17:18:56 +00:00
Guangcong Luo
fab79a636a Fix poll display
Polls now correctly display to connections, not users.
2015-12-14 17:22:41 -05:00
Guangcong Luo
b6e370e789 Add 'Show results' button to polls 2015-12-09 06:25:49 -05:00
Guangcong Luo
2c9ceb23af Make polls stay in roomlog after ending 2015-12-09 06:23:54 -05:00
Bär Halberkamp
f133118ab4 Poll: convert poll to the new class syntax 2015-12-05 15:50:45 +01:00
Guangcong Luo
dfc79474d7 Polls: Better error messages 2015-11-24 23:54:27 -05:00
panpawn
6727d87808 Standardize canTalk() permission in chat-plugins 2015-11-23 16:06:12 +00:00
Ivo Julca
4adc1b4ca4 Fix /poll timer
- Check for max supported timeout.
- Fix return value for /poll timer clear
2015-11-20 20:40:15 -05:00
Bär Halberkamp
75a6b6549a Fix a serious mistake in the poll code 2015-11-12 04:43:29 +01:00
Bär Halberkamp
a731536451 Add a check for userid for polls
This way, users with a dynamic IP will not be able to vote twice on the same name.
2015-11-09 22:32:02 +01:00
Bär Halberkamp
20efd5d395 Update polls to indicate what option was voted for 2015-11-09 22:31:21 +01:00
Ivo Julca
9a52fe337f Parse all numerical user input as base 10
Also took the chance to commit some style fixes missed in 90973d5 and 04c64c1.
2015-11-07 20:08:01 -05:00
Juanma Serrano
c4ac8d6e2f Use strict mode and let and const instead of var
This commit also fixes some duplicated variable declarations.
2015-11-06 21:56:52 -05:00
Ivo Julca
9106519add Log content of polls 2015-11-04 00:15:02 -05:00
Bär Halberkamp
e91e28eb0c Send a reply when there's no timer for the poll as well 2015-10-27 21:57:40 +01:00
Bär Halberkamp
3850950fe1 Allow the timer of a poll to be cleared with /poll timer clear 2015-10-27 21:57:40 +01:00
Bär Halberkamp
eb1658326e Make /poll timer check for negative time 2015-10-27 21:57:37 +01:00
Bär Halberkamp
367beb3868 Update /poll timer to show the timeout
as well as showing it to everyone when being set
2015-10-27 20:40:02 +01:00
Bär Halberkamp
d88922da57 Allow users to do /poll results to see the results instead of voting 2015-10-27 20:27:03 +01:00
Bär Halberkamp
1f86ed1bac add alias 'show' for /poll display 2015-10-14 00:44:37 +02:00
Bär Halberkamp
2b0e227346 Make /poll return the entire help, and remove the second line from the help 2015-10-14 00:41:53 +02:00
panpawn
ac0fd7413f Specifiy "poll" timeout in /poll timer
Some room staff or people looking in the modlog may get confused by the message "The timeout was set to...," so this specifies that it's referring to "The poll" as it does when a poll is started / ended.
2015-10-12 19:35:19 -04:00
Guangcong Luo
7acd5bfa1e Merge pull request #2200 from bumbadadabum/poll3
More updates to /poll
2015-10-11 17:11:45 -05:00