mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-05-09 04:23:45 -05:00
Fix /invite to room aliases and nonexistent rooms
This commit is contained in:
parent
3677615792
commit
db4dc3acfb
11
commands.js
11
commands.js
|
|
@ -131,6 +131,17 @@ var commands = exports.commands = {
|
|||
case 'me':
|
||||
case 'announce':
|
||||
case 'invite':
|
||||
var targetRoomid = toId(target.substr(8));
|
||||
if (targetRoomid === 'global') return false;
|
||||
|
||||
var targetRoom = Rooms.search(targetRoomid) || Simulator.battles[targetRoomid];
|
||||
if (!targetRoom) return connection.send('|pm|' + user.getIdentity() + '|' + targetUser.getIdentity() + "|/text The room '" + targetRoomid + "' does not exist.");
|
||||
if (targetRoom.staffRoom && !targetUser.isStaff) return connection.send('|pm|' + user.getIdentity() + '|' + targetUser.getIdentity() + "|/text User '" + this.targetUsername + "' requires global auth to join room '" + targetRoom.id + "'.");
|
||||
if (targetRoom.isPrivate && !((targetRoom.auth && targetRoom.auth[user.userid]) || targetUser.can('bypassall'))) {
|
||||
return connection.send('|pm|' + user.getIdentity() + '|' + targetUser.getIdentity() + "|/text The room '" + targetRoomid + "' does not exist.");
|
||||
}
|
||||
|
||||
target = '/invite ' + targetRoom.id;
|
||||
break;
|
||||
default:
|
||||
return connection.send('|pm|' + user.getIdentity() + '|' + targetUser.getIdentity() + "|/text The command '/" + targetCmd + "' was unrecognized or unavailable in private messages. To send a message starting with '/" + targetCmd + "', type '//" + targetCmd + "'.");
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user