mirror of
https://github.com/aydenjahola/discord-multipurpose-bot.git
synced 2024-11-21 16:25:55 +00:00
urban dictionary: rename the schame from Definitiosn to UrbanDictionary to avoid confusion
This commit is contained in:
parent
80563bcb9f
commit
2c079eb173
2 changed files with 9 additions and 6 deletions
|
@ -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",
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue