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;