Skip to content

Commit

Permalink
dependenciy fiddling
Browse files Browse the repository at this point in the history
  • Loading branch information
Niceygy committed Sep 1, 2024
1 parent 2402aee commit 3ed0013
Show file tree
Hide file tree
Showing 4 changed files with 1,023 additions and 2,935 deletions.
39 changes: 0 additions & 39 deletions database/mongodb.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ const welcomeToggleModel = new mongoose.model(
"welcomeToggle",
schemas.welcomeToggleSchema
);
const ignoredChannelModel = new mongoose.model(
"ignoredChannel",
schemas.addIgnoredChannelSchema
);
//END modules

/**
Expand Down Expand Up @@ -305,39 +301,6 @@ const saveBannedWordToggle = async (guildID, BWToggle) => {
});
};

const addIgnoredChannel = async (guildID, channelID) => {
if (!connected || !db) {
await connectToDB();
} //connect
const newIgnoredChannel = await ignoredChannelModel({
guildID: guildID,
channelID: channelID,
});
await newIgnoredChannel.save((err) => {
if (err) {
console.error(err);
console.log("error!");
return false;
}
return true;
});
};

async function checkIgnoredChannel(guildId, channelId) {
if (!connected || !db) {
await connectToDB();
}

const ignoredChannelJSON = await ignoredChannelModel.findOne({
guildId,
channelId,
});
if (ignoredChannelJSON == null) {
return false;
} else {
return true;
}
}

module.exports = {
saveXP,
Expand All @@ -350,8 +313,6 @@ module.exports = {
getLogToggle,
getBannedWordToggle,
saveBannedWordToggle,
addIgnoredChannel,
checkIgnoredChannel,
saveWelcomeToggle,
checkBW,
getWelcomeToggle,
Expand Down
23 changes: 16 additions & 7 deletions database/schema.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,50 @@
const mongoose = require("mongoose");


export const LvlSchema = new mongoose.Schema({
const LvlSchema = new mongoose.Schema({
userId: Number,
xp: Number,
level: Number,
});

export const AWSchema = new mongoose.Schema({
const AWSchema = new mongoose.Schema({
guildId: Number,
userId: Number,
warns: Number,
});

export const bannedWordsSchema = new mongoose.Schema({
const bannedWordsSchema = new mongoose.Schema({
word: String,
});

export const loggingToggleSchema = new mongoose.Schema({
const loggingToggleSchema = new mongoose.Schema({
guildId: Number,
toggle: Boolean,
});

export const BWToggleSchema = new mongoose.Schema({
BWToggleSchema = new mongoose.Schema({
guildID: Number,
toggle: Boolean,
});

export const welcomeToggleSchema = new mongoose.Schema({
const welcomeToggleSchema = new mongoose.Schema({
guildId: Number,
toggle: Boolean,
webhookUrl: String,
welcomeMsg: String,
leaveMsg: String,
});

export const addIgnoredChannelSchema = new mongoose.Schema({
const addIgnoredChannelSchema = new mongoose.Schema({
guildID: Number,
channelID: Number,
});

module.exports = {
LvlSchema,
AWSchema,
bannedWordsSchema,
loggingToggleSchema,
BWToggleSchema,
welcomeToggleSchema,
};
Loading

0 comments on commit 3ed0013

Please sign in to comment.