Skip to content

Commit

Permalink
Change Chat.modlog and Chat.splitTarget to better work with typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
Asheviere committed Jul 12, 2018
1 parent be83c4a commit 9191997
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions chat-plugins/hangman.js
Expand Up @@ -250,7 +250,7 @@ const commands = {
room.game = game;
game.display(user, true);

this.modlog('HANGMAN', null);
this.modlog('HANGMAN');
return this.privateModAction(`(A game of hangman was started by ${user.name}.)`);
},
createhelp: ["/hangman create [word], [hint] - Makes a new hangman game. Requires: % @ * # & ~"],
Expand All @@ -276,7 +276,7 @@ const commands = {

const game = /** @type {Hangman} */ (room.game);
game.end();
this.modlog('ENDHANGMAN', null);
this.modlog('ENDHANGMAN');
return this.privateModAction(`(The game of hangman was ended by ${user.name}.)`);
},
endhelp: ["/hangman end - Ends the game of hangman before the man is hanged or word is guessed. Requires: % @ * # & ~"],
Expand Down
4 changes: 2 additions & 2 deletions chat-plugins/poll.js
Expand Up @@ -279,7 +279,7 @@ const commands = {
room.poll.display();

this.roomlog(`${user.name} used ${message}`);
this.modlog('POLL', null);
this.modlog('POLL');
return this.privateModAction(`(A poll was started by ${user.name}.)`);
},
newhelp: [`/poll create [question], [option1], [option2], [...] - Creates a poll. Requires: % @ * # & ~`],
Expand Down Expand Up @@ -356,7 +356,7 @@ const commands = {

room.poll.end();
delete room.poll;
this.modlog('POLL END', null);
this.modlog('POLL END');
return this.privateModAction(`(The poll was ended by ${user.name}.)`);
},
endhelp: [`/poll end - Ends a poll and displays the results. Requires: % @ * # & ~`],
Expand Down
2 changes: 1 addition & 1 deletion chat-plugins/thing-of-the-day.js
Expand Up @@ -435,7 +435,7 @@ let commands = {
if (room !== handler.room) return this.errorReply(`This command can only be used in ${handler.room.title}.`);
if (!this.can('mute', null, room)) return false;

target = this.splitTarget(target, false);
target = this.splitTarget(target);
let name = this.targetUsername;
let userid = toId(name);
if (!userid) return this.errorReply(`'${name}' is not a valid username.`);
Expand Down
10 changes: 5 additions & 5 deletions chat.js
Expand Up @@ -638,11 +638,11 @@ class CommandContext {
}
/**
* @param {string} action
* @param {string | User?} user
* @param {string?} note
* @param {string | User?} [user]
* @param {string?} [note]
* @param {object} options
*/
modlog(action, user, note = null, options = {}) {
modlog(action, user = null, note = null, options = {}) {
let buf = `(${this.room.id}) ${action}: `;
if (user) {
if (typeof user === 'string') {
Expand Down Expand Up @@ -1089,9 +1089,9 @@ class CommandContext {
* message has no comma)
*
* @param {string} target
* @param {boolean} exactName
* @param {boolean} [exactName]
*/
splitTarget(target, exactName) {
splitTarget(target, exactName = false) {
let [name, rest] = this.splitOne(target);

this.targetUser = Users.get(name, exactName);
Expand Down

0 comments on commit 9191997

Please sign in to comment.