Refactor if statement without else
Assign prefix to globalPrefix first, so there is no need for an else statement.
This commit is contained in:
parent
a2b8660735
commit
f884b9bd14
1 changed files with 3 additions and 4 deletions
|
@ -1,10 +1,9 @@
|
||||||
module.exports = function(client, owners, message, globalPrefix){
|
module.exports = function(client, owners, message, globalPrefix){
|
||||||
let prefix;
|
let prefix = globalPrefix;
|
||||||
if (client.serverPrefixes.get(message.guild.id)) {
|
if (client.serverPrefixes.get(message.guild.id)) {
|
||||||
prefix = client.serverPrefixes.get(message.guild.id)
|
prefix = client.serverPrefixes.get(message.guild.id)
|
||||||
} else
|
}
|
||||||
prefix = globalPrefix
|
|
||||||
|
|
||||||
let args = message.content.slice(prefix.length).split(" ")
|
let args = message.content.slice(prefix.length).split(" ")
|
||||||
|
|
||||||
const commandName = args.shift().toLowerCase();
|
const commandName = args.shift().toLowerCase();
|
||||||
|
|
Loading…
Add table
Reference in a new issue