Skip to content
This repository was archived by the owner on Sep 28, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions moonlink.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const { Manager } = require("moonlink.js");
const { version } = require("./package.json");
const Locale = require("./class/Locale");
const LocaleSchema = require("./schemas/Locale");
const PlayingHistorySchema = require("./schemas/PlayingHistory");

/**
*
Expand Down Expand Up @@ -96,6 +97,22 @@ function initializationMoonlink(client) {
]
});
}

try {
if (track.requestedBy && track.sourceName && track.title && track.url && client.user.id && player.guildId && player.voiceChannelId) {
await PlayingHistorySchema.create({
userId: track.requestedBy,
source: track.sourceName,
title: track.title,
url: track.url,
bot: client.user.id,
guildId: player.guildId,
channelId: player.voiceChannelId
});
}
} catch (err) {
console.error(err);
}
} catch (err) {
console.error(err);
}
Expand Down
13 changes: 13 additions & 0 deletions schemas/PlayingHistory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const { model, Schema } = require("mongoose");

module.exports = model("playing_history", new Schema({
userId: String,
source: String,
title: String,
url: String,
bot: String,
guildId: String,
channelId: String
}, {
timestamps: true
}));