This commit is contained in:
2019-04-04 23:08:17 +11:00
parent 1a5c576dcf
commit 2c990d6bdb

View File

@@ -51,10 +51,10 @@ class Commands {
var cachedcommand = new CachedCommand(reqcommand.alias[z], items[i]) var cachedcommand = new CachedCommand(reqcommand.alias[z], items[i])
client.cachedcommands.push(cachedcommand) client.cachedcommands.push(cachedcommand)
} }
} catch (error) { } catch (error) {
console.log('error with:' + items[i]) console.log('error with:' + items[i])
console.error(error) console.error(error)
} }
} }
@@ -92,22 +92,29 @@ client.on("message", (msg) => {
}) })
function onMessage(msg, again = true) { function onMessage(msg, again = true) {
if (client.cachedserversettings.filter(function (server) { if (msg.channel.type = "dm") {
return server.guildID == msg.guild.id doCommand(msg, "")
}).length == 0) }
client.database.get_setting("prefix", msg.guild.id).then(prefix => { else {
client.cachedserversettings.push(new cachedsettings(msg.guild.id, prefix))
doCommand(msg, prefix) if (client.cachedserversettings.filter(function (server) {
}).catch(err => {
if (again == true) {
client.database.set_setting(msg.guild.id, "prefix", "~")
onMessage(msg, false)
}
})
else
doCommand(msg, client.cachedserversettings.filter(function (server) {
return server.guildID == msg.guild.id return server.guildID == msg.guild.id
})[0].getPrefix()) }).length == 0)
client.database.get_setting("prefix", msg.guild.id).then(prefix => {
client.cachedserversettings.push(new cachedsettings(msg.guild.id, prefix))
doCommand(msg, prefix)
}).catch(err => {
if (again == true) {
client.database.set_setting(msg.guild.id, "prefix", "~")
onMessage(msg, false)
}
})
else
doCommand(msg, client.cachedserversettings.filter(function (server) {
return server.guildID == msg.guild.id
})[0].getPrefix())
}
} }
function doCommand(msg, prefix) { function doCommand(msg, prefix) {