Skip to content
This repository was archived by the owner on Sep 28, 2024. It is now read-only.
Merged
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
18 changes: 9 additions & 9 deletions moonlink.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@ const PlayingHistorySchema = require("./schemas/PlayingHistory");
async function getLocale(userId) {
let userLocale = "en-US";

try {
if (userId) {
if (typeof userId == "string") {
try {
const data = await LocaleSchema.findOne({
owner: userId
});

if (data && data.locale) userLocale = data.locale;

} catch (err) {
console.error(err);
}
} catch (err) {
console.error(err);
}

return new Locale(userLocale);
Expand Down Expand Up @@ -97,9 +98,8 @@ function initializationMoonlink(client) {
]
});
}

try {
if (track.requestedBy && track.sourceName && track.title && track.url && client.user.id && player.guildId && player.voiceChannelId) {
if (typeof track.requestedBy == "string" && track.sourceName && track.title && track.url && client.user.id && player.guildId && player.voiceChannelId) {
try {
await PlayingHistorySchema.create({
userId: track.requestedBy,
source: track.sourceName,
Expand All @@ -109,9 +109,9 @@ function initializationMoonlink(client) {
guildId: player.guildId,
channelId: player.voiceChannelId
});
} catch (err) {
console.error(err);
}
} catch (err) {
console.error(err);
}
} catch (err) {
console.error(err);
Expand Down