Snippets are now case-insensitive everywhere

cshd
Dragory 2020-10-21 22:21:04 +03:00
parent 90dd35194c
commit db40c39dfa
No known key found for this signature in database
GPG Key ID: 5F387BA66DF8AAC1
2 changed files with 2 additions and 3 deletions

View File

@ -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();
}

View File

@ -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");