From db40c39dfae918d20e35c7880ecd2fb0f1664f1d Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Wed, 21 Oct 2020 22:21:04 +0300 Subject: [PATCH] Snippets are now case-insensitive everywhere --- src/data/snippets.js | 4 ++-- src/modules/snippets.js | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/data/snippets.js b/src/data/snippets.js index 0e4aebc..70cad4e 100644 --- a/src/data/snippets.js +++ b/src/data/snippets.js @@ -8,7 +8,7 @@ const Snippet = require("./Snippet"); */ async function getSnippet(trigger) { const snippet = await knex("snippets") - .where("trigger", trigger) + .where(knex.raw("LOWER(trigger)"), trigger.toLowerCase()) .first(); return (snippet ? new Snippet(snippet) : null); @@ -36,7 +36,7 @@ async function addSnippet(trigger, body, createdBy = 0) { */ async function deleteSnippet(trigger) { return knex("snippets") - .where("trigger", trigger) + .where(knex.raw("LOWER(trigger)"), trigger.toLowerCase()) .delete(); } diff --git a/src/modules/snippets.js b/src/modules/snippets.js index e68d6a3..fa68d9e 100644 --- a/src/modules/snippets.js +++ b/src/modules/snippets.js @@ -1,6 +1,5 @@ const threads = require("../data/threads"); const snippets = require("../data/snippets"); -const config = require("../cfg"); const utils = require("../utils"); const { parseArguments } = require("knub-command-manager");