Compare commits
3 Commits
e2cc63e6c9
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| bb90ca792c | |||
| 0c84c85b62 | |||
| 0218583d24 |
@@ -15,7 +15,7 @@ module.exports = {
|
|||||||
|
|
||||||
const db = mClient.db(process.env.M_DB)
|
const db = mClient.db(process.env.M_DB)
|
||||||
const quotesColl = db.collection('items_quotes')
|
const quotesColl = db.collection('items_quotes')
|
||||||
const quotes = await quotesColl.find({ by: target.id }).toArray()
|
const quotes = await quotesColl.find({ userID: target.id }).toArray()
|
||||||
|
|
||||||
var index = Number((await interaction.message.embeds[0].data.title).split(' ')[2].slice(1))
|
var index = Number((await interaction.message.embeds[0].data.title).split(' ')[2].slice(1))
|
||||||
if (!index) { index = 0 }
|
if (!index) { index = 0 }
|
||||||
@@ -64,7 +64,7 @@ module.exports = {
|
|||||||
.setURL(messageLink)
|
.setURL(messageLink)
|
||||||
.setTitle(`- Quote #${index + 1} -`)
|
.setTitle(`- Quote #${index + 1} -`)
|
||||||
.setDescription(description)
|
.setDescription(description)
|
||||||
.setFooter({ text: (`${footer} #${found.messageID} <@${found.by}>`) })
|
.setFooter({ text: (`${footer} #${found.messageID} <@${found.userID}>`) })
|
||||||
const select = new ActionRowBuilder()
|
const select = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new UserSelectMenuBuilder()
|
new UserSelectMenuBuilder()
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ module.exports = {
|
|||||||
|
|
||||||
const db = mClient.db(process.env.M_DB)
|
const db = mClient.db(process.env.M_DB)
|
||||||
const quotesColl = db.collection('items_quotes')
|
const quotesColl = db.collection('items_quotes')
|
||||||
const quotes = await quotesColl.find({ by: target.id }).toArray()
|
const quotes = await quotesColl.find({ userID: target.id }).toArray()
|
||||||
|
|
||||||
var index = Number((await interaction.message.embeds[0].data.title).split(' ')[2].slice(1))
|
var index = Number((await interaction.message.embeds[0].data.title).split(' ')[2].slice(1))
|
||||||
if (!index) { index = 0 }
|
if (!index) { index = 0 }
|
||||||
@@ -64,7 +64,7 @@ module.exports = {
|
|||||||
.setURL(messageLink)
|
.setURL(messageLink)
|
||||||
.setTitle(`- Quote #${index + 1} -`)
|
.setTitle(`- Quote #${index + 1} -`)
|
||||||
.setDescription(description)
|
.setDescription(description)
|
||||||
.setFooter({ text: (`${footer} #${found.messageID} <@${found.by}>`) })
|
.setFooter({ text: (`${footer} #${found.messageID} <@${found.userID}>`) })
|
||||||
const select = new ActionRowBuilder()
|
const select = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new UserSelectMenuBuilder()
|
new UserSelectMenuBuilder()
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ module.exports = {
|
|||||||
async execute(message, args) {
|
async execute(message, args) {
|
||||||
const db = mClient.db(process.env.M_DB)
|
const db = mClient.db(process.env.M_DB)
|
||||||
const nutsColl = db.collection('items_nuts')
|
const nutsColl = db.collection('items_nuts')
|
||||||
|
const nutsStatsColl = db.collection('stats_nuts')
|
||||||
const cdColl = db.collection('items_cooldowns')
|
const cdColl = db.collection('items_cooldowns')
|
||||||
|
|
||||||
const cdData = await cdColl.findOne({ userID: message.author.id })
|
const cdData = await cdColl.findOne({ userID: message.author.id })
|
||||||
|
|
||||||
if (cdData || cdData?.cooldown > (Date.now() / 1000)) {
|
if (cdData?.cooldown > (Date.now() / 1000)) {
|
||||||
return await message.reply({
|
return await message.reply({
|
||||||
content: `Du kannst erst <t:${Math.floor(cdData?.cooldown)}:R> wieder nussen :(`,
|
content: `Du kannst erst <t:${Math.floor(cdData?.cooldown)}:R> wieder nussen :(`,
|
||||||
})
|
})
|
||||||
@@ -39,6 +39,17 @@ module.exports = {
|
|||||||
upsert: true
|
upsert: true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
await nutsStatsColl.findOneAndUpdate(
|
||||||
|
{ userID: message.author.id },
|
||||||
|
{ $inc: { [`stat.${amount}`]: 1 } },
|
||||||
|
{ upsert: true }
|
||||||
|
)
|
||||||
|
|
||||||
|
await nutsStatsColl.findOneAndUpdate(
|
||||||
|
{ userID: "__global" },
|
||||||
|
{ $inc: { [`stat.${amount}`]: 1 } },
|
||||||
|
{ upsert: true }
|
||||||
|
)
|
||||||
let content = `Du hast ${amount} Nüsse bekommen! :chestnut:`
|
let content = `Du hast ${amount} Nüsse bekommen! :chestnut:`
|
||||||
if (!amount) {
|
if (!amount) {
|
||||||
content = `Du hast leider keine Nüsse bekommen :(`
|
content = `Du hast leider keine Nüsse bekommen :(`
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ module.exports = {
|
|||||||
messageID: quoteMessage.id,
|
messageID: quoteMessage.id,
|
||||||
channelID: quoteChannel.id,
|
channelID: quoteChannel.id,
|
||||||
guildID: quoteGuild.id,
|
guildID: quoteGuild.id,
|
||||||
by: msgData.author.id,
|
userID: msgData.author.id,
|
||||||
count: 0
|
count: 0
|
||||||
}
|
}
|
||||||
}, { upsert: true })
|
}, { upsert: true })
|
||||||
|
|||||||
@@ -174,7 +174,6 @@ async function nutsStats(interaction) {
|
|||||||
target = interaction.user
|
target = interaction.user
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(target)
|
|
||||||
const statsDoc = await nStatsColl.findOne({ userID: target.id });
|
const statsDoc = await nStatsColl.findOne({ userID: target.id });
|
||||||
const stat = statsDoc?.stat || {};
|
const stat = statsDoc?.stat || {};
|
||||||
|
|
||||||
@@ -285,7 +284,7 @@ async function nutsNut(interaction, quickMode) {
|
|||||||
const formatNut = (amount) => `${amount} ${amount === 1 ? 'Nuss' : 'Nüsse'}`
|
const formatNut = (amount) => `${amount} ${amount === 1 ? 'Nuss' : 'Nüsse'}`
|
||||||
|
|
||||||
// check cooldown
|
// check cooldown
|
||||||
if (cdData || cdData?.cooldown > Date.now() / 1000) {
|
if (cdData?.cooldown > Date.now() / 1000) {
|
||||||
// on cooldown
|
// on cooldown
|
||||||
embed.setTitle('To Nut or Not to Nut...')
|
embed.setTitle('To Nut or Not to Nut...')
|
||||||
embed.setDescription(`<t:${Math.floor(cdData.cooldown)}:R> kannst du wieder nussen! ;)`)
|
embed.setDescription(`<t:${Math.floor(cdData.cooldown)}:R> kannst du wieder nussen! ;)`)
|
||||||
@@ -296,21 +295,6 @@ async function nutsNut(interaction, quickMode) {
|
|||||||
files: [`${asset_path}nuts_onCD.avif`]
|
files: [`${asset_path}nuts_onCD.avif`]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
embed.setDescription('\u200B')
|
|
||||||
// pseudo animation
|
|
||||||
embed.setThumbnail(assets.box)
|
|
||||||
await interaction.editReply({
|
|
||||||
embeds: [embed],
|
|
||||||
files: [`${asset_path}nuts_box.png`]
|
|
||||||
})
|
|
||||||
await delay(1337)
|
|
||||||
embed.setThumbnail(assets.explosion)
|
|
||||||
await interaction.editReply({
|
|
||||||
embeds: [embed],
|
|
||||||
files: [`${asset_path}nuts_explosion.gif`]
|
|
||||||
})
|
|
||||||
await delay(1337)
|
|
||||||
|
|
||||||
// set 1 hour cooldown
|
// set 1 hour cooldown
|
||||||
const cd = Math.floor((Date.now() + 3600000) / 1000)
|
const cd = Math.floor((Date.now() + 3600000) / 1000)
|
||||||
await cdColl.findOneAndUpdate({
|
await cdColl.findOneAndUpdate({
|
||||||
@@ -346,6 +330,25 @@ async function nutsNut(interaction, quickMode) {
|
|||||||
{ upsert: true }
|
{ upsert: true }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
if (quickMode) {
|
||||||
|
return interaction.editReply({ content: `Du hast ${formatNut(amount)} bekommen! :chestnut:` })
|
||||||
|
}
|
||||||
|
|
||||||
|
// pseudo animation
|
||||||
|
embed.setImage(assets.box)
|
||||||
|
await interaction.editReply({
|
||||||
|
embeds: [embed],
|
||||||
|
files: [`${asset_path}nuts_box.png`]
|
||||||
|
})
|
||||||
|
await delay(1337)
|
||||||
|
embed.setImage(assets.explosion)
|
||||||
|
await interaction.editReply({
|
||||||
|
embeds: [embed],
|
||||||
|
files: [`${asset_path}nuts_explosion.gif`]
|
||||||
|
})
|
||||||
|
await delay(1337)
|
||||||
|
|
||||||
let assetFile
|
let assetFile
|
||||||
if (amount === 0) assetFile = assets.none
|
if (amount === 0) assetFile = assets.none
|
||||||
else if (amount > 8) assetFile = assets.high
|
else if (amount > 8) assetFile = assets.high
|
||||||
@@ -354,15 +357,14 @@ async function nutsNut(interaction, quickMode) {
|
|||||||
|
|
||||||
embed.setTitle(`Du hast ${formatNut(amount)} bekommen!`)
|
embed.setTitle(`Du hast ${formatNut(amount)} bekommen!`)
|
||||||
embed.setThumbnail(assetFile)
|
embed.setThumbnail(assetFile)
|
||||||
|
embed.setImage(null)
|
||||||
if (quickMode) {
|
|
||||||
return interaction.editReply({ content: `Du hast ${formatNut(amount)} bekommen! :chestnut:` })
|
|
||||||
}
|
|
||||||
|
|
||||||
return interaction.editReply({
|
return interaction.editReply({
|
||||||
embeds: [embed],
|
embeds: [embed],
|
||||||
files: [`${asset_path}${assetFile.split('://')[1]}`]
|
files: [`${asset_path}${assetFile.split('://')[1]}`]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
module.exports = {
|
module.exports = {
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
|
|||||||
@@ -310,7 +310,7 @@ async function quotesLeaderboard(interaction, page = 1, limit = 5) {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
name: `${skip + index + 1}.`,
|
name: `${skip + index + 1}.`,
|
||||||
value: `[#${data.messageID}](https://discord.com/channels/${data.guildID}/${data.channelID}/${data.messageID})\n**by** <@${data.by}> • ⭐ ${data.count}\n_Posted on **${timestamp}**_\n${message.content}`
|
value: `[#${data.messageID}](https://discord.com/channels/${data.guildID}/${data.channelID}/${data.messageID})\n**by** <@${data.userID}> • ⭐ ${data.count}\n_Posted on **${timestamp}**_\n${message.content}`
|
||||||
};
|
};
|
||||||
} catch {
|
} catch {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ module.exports = {
|
|||||||
// Fetch birthday role
|
// Fetch birthday role
|
||||||
const bdayRoleColl = db.collection('config_roles');
|
const bdayRoleColl = db.collection('config_roles');
|
||||||
const bdayRoleEntry = await bdayRoleColl.findOne({ guildID: guild.id });
|
const bdayRoleEntry = await bdayRoleColl.findOne({ guildID: guild.id });
|
||||||
const birthdayRoleID = bdayRoleEntry.roleID;
|
const birthdayRoleID = bdayRoleEntry?.roleID;
|
||||||
|
|
||||||
if (!birthdayRoleID) {
|
if (!birthdayRoleID) {
|
||||||
console.warn("No birthday role configured in DB");
|
console.warn("No birthday role configured in DB");
|
||||||
@@ -54,7 +54,7 @@ module.exports = {
|
|||||||
console.error(`Failed to add birthday role to ${member.user.tag}:`, err)
|
console.error(`Failed to add birthday role to ${member.user.tag}:`, err)
|
||||||
);
|
);
|
||||||
console.log(`Added birthday role to ${member.user.tag}`);
|
console.log(`Added birthday role to ${member.user.tag}`);
|
||||||
client.emit('Birthday', member);
|
//client.emit('Birthday', member);
|
||||||
} else {
|
} else {
|
||||||
// Default fallback: remove birthday role if present
|
// Default fallback: remove birthday role if present
|
||||||
if (member.roles.cache.has(birthdayRoleID)) {
|
if (member.roles.cache.has(birthdayRoleID)) {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ module.exports = {
|
|||||||
const target = await interaction.guild.members.fetch(interaction.members.keys().next().value)
|
const target = await interaction.guild.members.fetch(interaction.members.keys().next().value)
|
||||||
const db = mClient.db(process.env.M_DB)
|
const db = mClient.db(process.env.M_DB)
|
||||||
const quotesColl = db.collection('items_quotes')
|
const quotesColl = db.collection('items_quotes')
|
||||||
const quotes = await quotesColl.find({ by: target.id }).toArray()
|
const quotes = await quotesColl.find({ userID: target.id }).toArray()
|
||||||
const member = interaction.message.guild.members.cache.get(target.user.id)
|
const member = interaction.message.guild.members.cache.get(target.user.id)
|
||||||
const memberRoles = member.roles.cache
|
const memberRoles = member.roles.cache
|
||||||
.filter((roles) => roles.id !== interaction.message.guild.id)
|
.filter((roles) => roles.id !== interaction.message.guild.id)
|
||||||
|
|||||||
Reference in New Issue
Block a user