|
@@ -141,18 +141,17 @@ client.on("message", m => {
|
|
|
|
|
|
if (m.mentions.users.first().id == client.user.id) {
|
|
|
let content = m.cleanContent
|
|
|
- .substring(`@${client.user.username} `.length)
|
|
|
- .toLowerCase();
|
|
|
-
|
|
|
+ .substring(`@${client.user.username} `.length);
|
|
|
+ let lowerCaseContent = content.toLowerCase();
|
|
|
for (let c in commands) {
|
|
|
- if (content.startsWith(c)) {
|
|
|
+ if (lowerCaseContent.startsWith(c)) {
|
|
|
commands[c](m, content);
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (content.length > 0) {
|
|
|
- let parts = content.trim().split(" ");
|
|
|
+ if (lowerCaseContent.length > 0) {
|
|
|
+ let parts = lowerCaseContent.trim().split(" ");
|
|
|
let guide = db
|
|
|
.get("guides")
|
|
|
.maxBy(k => db._.intersection(parts, k.name.split(" ")).length)
|