From 2c079eb1738591e64bbefe4ff0a127e04cecdd98 Mon Sep 17 00:00:00 2001 From: Ayden Jahola Date: Sun, 8 Sep 2024 01:28:21 +0100 Subject: [PATCH] urban dictionary: rename the schame from Definitiosn to UrbanDictionary to avoid confusion --- commands/general/urbanDictionary.js | 6 +++--- models/UrbanDictionary.js | 9 ++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/commands/general/urbanDictionary.js b/commands/general/urbanDictionary.js index d0d2292..4242513 100644 --- a/commands/general/urbanDictionary.js +++ b/commands/general/urbanDictionary.js @@ -1,6 +1,6 @@ const { SlashCommandBuilder, EmbedBuilder } = require("discord.js"); const axios = require("axios"); -const Definition = require("../../models/UrbanDictionary"); +const UrbanDictionary = require("../../models/UrbanDictionary"); module.exports = { data: new SlashCommandBuilder() @@ -21,7 +21,7 @@ module.exports = { try { // Check if the term exists in the database - let definition = await Definition.findOne({ term }); + let definition = await UrbanDictionary.findOne({ term }); if (!definition) { // If definition is not found, fetch from the API @@ -50,7 +50,7 @@ module.exports = { } // Save the new definition to the database - definition = new Definition({ + definition = new UrbanDictionary({ term, definition: data.list[0].definition, example: data.list[0].example || "No example provided", diff --git a/models/UrbanDictionary.js b/models/UrbanDictionary.js index 55d0676..48e6723 100644 --- a/models/UrbanDictionary.js +++ b/models/UrbanDictionary.js @@ -1,6 +1,6 @@ const mongoose = require("mongoose"); -const definitionSchema = new mongoose.Schema({ +const UrbanDictionarySchema = new mongoose.Schema({ term: { type: String, required: true, unique: true, trim: true }, definition: { type: String, required: true }, example: { type: String, default: "No example provided" }, @@ -9,6 +9,9 @@ const definitionSchema = new mongoose.Schema({ thumbs_down: { type: Number, default: 0 }, }); -const Definition = mongoose.model("Definition", definitionSchema); +const UrbanDictionary = mongoose.model( + "UrbanDictionary", + UrbanDictionarySchema +); -module.exports = Definition; +module.exports = UrbanDictionary;