Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Commit

Permalink
Add 'pm' command
Browse files Browse the repository at this point in the history
Also improve 'custom' command documentation
  • Loading branch information
Ecuacion committed Nov 24, 2015
1 parent c793666 commit e4f93a4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion commands/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ Administrative Commands

Commands for controlling the bot and command permissions for chat rooms.

- `custom` - Send anything to current room
- `custom [text]` - Send something to current room
- `custom [room] [text]` - Send something to a chat room. Brackets are obligatory if you specify the room. Example of usage: `custom [lobby] Some text here`
- `pm [user], [text]` - Send a private message
- `join [room1], [room2]...` - Join chat rooms
- `leave` - Leave chat rooms
- `joinrooms [official/public/all]` - Join all rooms
Expand Down
11 changes: 11 additions & 0 deletions commands/base-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ exports.commands = {
this.say(tarRoom || room, arg);
},

sendpm: 'pm',
pm: function (arg, by, room, cmd) {
if (!this.isRanked('admin')) return false;
var args = arg.split(",");
if (args.length < 2) return this.reply("Usage: " + this.cmdToken + cmd + " [user], [message]");
var targetUser = toId(args.shift());
var msg = args.join(",").trim();
if (!targetUser || !msg) return this.reply("Usage: " + this.cmdToken + cmd + " [user], [message]");
this.sendPM(targetUser, msg);
},

"join": function (arg, by, room, cmd) {
if (!this.isRanked('admin')) return false;
if (!arg) return;
Expand Down

0 comments on commit e4f93a4

Please sign in to comment.