Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Add unresponsive /ignore and /unignore commands
Browse files Browse the repository at this point in the history
Signed-off-by: Travis Ralston <[email protected]>
  • Loading branch information
turt2live committed Sep 14, 2017
1 parent 2bc866b commit 2d51707
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/SlashCommands.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,35 @@ const commands = {
return reject(this.getUsage());
}),

ignore: new Command("ignore", "<userId>", function(roomId, args) {
if (args) {
const matches = args.match(/^(\S+)$/);
if (matches) {
const ignoredUsers = MatrixClientPeg.get().getIgnoredUsers();
ignoredUsers.push(matches[1]); // de-duped internally below
return success(
MatrixClientPeg.get().setIgnoredUsers(ignoredUsers),
);
}
}
return reject(this.getUsage());
}),

unignore: new Command("unignore", "<userId>", function(roomId, args) {
if (args) {
const matches = args.match(/^(\S+)$/);
if (matches) {
const ignoredUsers = MatrixClientPeg.get().getIgnoredUsers();
const index = ignoredUsers.indexOf(matches[1]);
if (index !== -1) ignoredUsers.splice(index, 1);
return success(
MatrixClientPeg.get().setIgnoredUsers(ignoredUsers),
);
}
}
return reject(this.getUsage());
}),

// Define the power level of a user
op: new Command("op", "<userId> [<power level>]", function(roomId, args) {
if (args) {
Expand Down

0 comments on commit 2d51707

Please sign in to comment.