mirror of
https://github.com/jech/galene.git
synced 2024-11-22 16:45:58 +01:00
Improve command error handling when not connected.
This commit is contained in:
parent
f4c5d6a6ef
commit
2b19a1034f
1 changed files with 6 additions and 2 deletions
|
@ -1627,13 +1627,15 @@ function clearChat() {
|
||||||
let commands = {}
|
let commands = {}
|
||||||
|
|
||||||
function operatorPredicate() {
|
function operatorPredicate() {
|
||||||
if(serverConnection.permissions.op)
|
if(serverConnection && serverConnection.permissions &&
|
||||||
|
serverConnection.permissions.op)
|
||||||
return null;
|
return null;
|
||||||
return 'You are not an operator';
|
return 'You are not an operator';
|
||||||
}
|
}
|
||||||
|
|
||||||
function recordingPredicate() {
|
function recordingPredicate() {
|
||||||
if(serverConnection.permissions.record)
|
if(serverConnection && serverConnection.permissions &&
|
||||||
|
serverConnection.permissions.record)
|
||||||
return null;
|
return null;
|
||||||
return 'You are not allowed to record';
|
return 'You are not allowed to record';
|
||||||
}
|
}
|
||||||
|
@ -1698,6 +1700,8 @@ commands.unset = {
|
||||||
commands.leave = {
|
commands.leave = {
|
||||||
description: "leave group",
|
description: "leave group",
|
||||||
f: (c, r) => {
|
f: (c, r) => {
|
||||||
|
if(!serverConnection)
|
||||||
|
throw new Error('Not connected');
|
||||||
serverConnection.close();
|
serverConnection.close();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue