Commit Graph

71 Commits

Author SHA1 Message Date
Bär Halberkamp
a3dd7f0aaa Make (better) use of Room.gameNumber in chat plugins 2018-07-12 10:38:32 -04:00
Bär Halberkamp
9191997120 Change Chat.modlog and Chat.splitTarget to better work with typescript 2018-07-12 10:19:40 -04:00
Bär Halberkamp
2f5d6cb722 Typescript poll plugin 2018-07-10 17:10:37 -05:00
Jacob McLemore
18d7835a08 Polls: Refactor to use template strings (#4633) 2018-04-28 23:56:48 -05:00
Isaac Bruce
cd584edfd7 Poll: Call Room#update in Poll#end to immediately display results (#4629)
It was a little weird not seeing the results of an ended poll until someone spoke. I'm guessing it was unintentional?
2018-04-26 21:30:21 -05:00
Lycanium-Z
7ff401439c Block making polls in battles (#4375) 2018-01-25 08:43:16 -06:00
Charlie Kobayashi
331af4e794 Refactor Modlog Formatting (#3972) 2018-01-08 15:18:24 -06:00
Kris Johnson
a6ce5c9dc1 Refactor chat-plugins and formats to for...of (#4288) 2017-12-28 05:22:28 -06:00
Jeremy Piemonte
e0c08eafba Standardize help commands (#4285) 2017-12-27 19:35:32 -06:00
Guangcong Luo
0d43204487 Change room log API
Interaction with room logs is changing to be more straightforward. This
is the first step of the change, which changes rooms.js.

- Rename: logEntry -> roomlog
- Rename: sendModCommand -> sendMods
- Rename: addLogMessage -> addByUser
- New function: sendModsByUser

The long-term plan is documented in:

https://github.com/Zarel/Pokemon-Showdown/pull/3972#issuecomment-352226219
2017-12-18 22:51:21 -06:00
Guangcong Luo
044366f770 Suppress blankvote error
Closes #3218
2017-05-18 05:38:14 -05:00
Charlie Kobayashi
770d4d94fe Poll: Fix display (#3506)
- make all poll options align left
2017-05-07 16:30:34 -05:00
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