moved to subdir

This commit is contained in:
2026-04-06 20:07:58 +02:00
parent f1f9d95685
commit 5e8fb7e729
28 changed files with 83 additions and 77 deletions
+54
View File
@@ -0,0 +1,54 @@
const { EmbedBuilder } = require('discord.js')
const { mClient } = require('../../../index')
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
require('dotenv').config()
module.exports = {
name: 'checknuts',
description: 'get nuts',
aliases: ['chn'],
async execute(message, args) {
var target = message.author
var addressing = `Du hast`
if (args[0]) {
if (!args[0].startsWith('<@' || !args[0].endsWith('>'))) { return message.reply('Invalid User Specification') }
try {
target = await message.guild.members.fetch(args[0].slice(2, -1))
} catch (error) {
return message.reply({
content: `User: ${args[0]} nicht gefunden!`
}).then(async (msg) => {
await delay(4000)
message.delete()
msg.delete()
})
}
if (target.user.id !== message.author.id) {
if (!target.user.globalName) {
addressing = `${target.user.username} hat`
} else {
addressing = `${target.user.globalName} hat`
}
}
}
const db = mClient.db(process.env.M_DB)
const nutsColl = db.collection('items_nuts')
var nutsData = await nutsColl.findOne({ userID: target.id })
let content
if (!nutsData) {
content = `${addressing} noch keine Nüsse gesammelt :(`
} else {
content = `${addressing} bereits **${nutsData.nuts}** Nüsse gesammelt!`
}
const embed = new EmbedBuilder()
.setTitle('Checknuts!')
.setThumbnail(target.displayAvatarURL())
.setDescription(content)
return message.reply({
embeds: [embed]
})
}
}
+31
View File
@@ -0,0 +1,31 @@
const { EmbedBuilder } = require('discord.js')
const { mClient } = require('../../../index')
require('dotenv').config()
module.exports = {
name: 'nutsCooldown',
description: 'shows nut cooldown',
aliases: ['ncd'],
async execute(message, args) {
const db = mClient.db(process.env.M_DB)
const nutsColl = db.collection('items_cooldowns')
const cooldown = await nutsColl.findOne({ userID: message.author.id })
let content = `Du kannst wieder nussen! :)`
let thumbnail = 'https://cdn-icons-png.flaticon.com/512/7451/7451659.png'
let title = 'Go Nuts!'
if (cooldown > 0) {
content = `<t:${cooldown.cooldown}:R> kannst du wieder nussen! ;)`
thumbnail = 'https://cdn.discordapp.com/attachments/1152723542836772914/1152987472788193361/No-nuts-PhotoRoom.png-PhotoRoom.png'
title = 'To Nut or Not to Nut...'
}
const embed = new EmbedBuilder()
.setThumbnail(thumbnail)
.setTitle(title)
.setDescription(content)
await message.reply({
embeds: [embed]
})
}
}
+47
View File
@@ -0,0 +1,47 @@
const { mClient } = require('../../../index')
require('dotenv').config()
module.exports = {
name: 'nuts',
description: 'get nuts',
aliases: ['n', 'nget', 'nutsget'],
async execute(message, args) {
const db = mClient.db(process.env.M_DB)
const nutsColl = db.collection('items_nuts')
const cdColl = db.collection('items_cooldowns')
const cdData = await cdColl.findOne({ userID: message.author.id })
if (!cdData || cdData.cooldown < Date.now() / 1000) {
let cd = Math.floor((Date.now() + 3600000) / 1000)
await cdColl.findOneAndUpdate({
userID: message.author.id
}, {
$set: { cooldown: cd }
}, {
upsert: true
})
const amount = Math.floor(Math.random() * 10)
await nutsColl.findOneAndUpdate({
userID: message.author.id
}, {
$inc: { nuts: amount }
}, {
upsert: true
})
let content = `Du hast ${amount} Nüsse bekommen! :chestnut:`
if (!amount) {
content = `Du hast leider keine Nüsse bekommen :(`
}
return await message.reply({
content: content
})
} else {
return await message.reply({
content: `Du kannst erst <t:${Math.floor(cdData?.cooldown / 1000)}:R> wieder nussen :(`,
})
}
},
};
+78
View File
@@ -0,0 +1,78 @@
const { EmbedBuilder, MessageFlags } = require('discord.js')
const { mClient } = require('../../../index')
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
require('dotenv').config()
module.exports = {
name: 'givenuts',
description: 'give nuts',
aliases: ['gn'],
async execute(message, args) {
const from = message.author
if (args[0] == `<@${message.author.id}>` || !args[0]) {
return message.reply({
content: "Du musst einen anderen User erwähnen"
}).then(async (msg) => {
await delay(4000)
message.delete()
msg.delete()
})
}
if (!args[0].startsWith('<@' || !args[0].endsWith('>'))) { return message.reply('Invalid User Specification') }
try {
target = await message.guild.members.fetch(args[0].slice(2, -1))
} catch (error) {
return message.reply({
content: `User: ${args[0]} nicht gefunden!`
}).then(async (msg) => {
await delay(4000)
message.delete()
msg.delete()
})
}
const to = target
try {
var amount = Number(args[1])
} catch (error) {
console.log(error)
return message.reply({
content: 'Du musst eine Menge angeben!'
}).then(async (msg) => {
await delay(4000)
message.delete()
msg.delete()
})
}
if (!amount) {
return message.reply({content : 'Danke für nichts, du Hu-'})
}
const db = mClient.db(process.env.M_DB)
const nutsColl = db.collection('items_nuts')
const yourBalance = await nutsColl.findOne({ userID: from.id })
if (amount <= 0) {
return await message.reply({
content: `Hier wird nicht geklaut >:(\r\nDas gibt **${yourBalance.nuts}** Abzug!`
})
}
if (yourBalance.nuts < amount) {
return await message.reply({
content: 'Du kannst nicht mehr geben als du hast!',
flags: MessageFlags.Ephemeral
})
}
var content = `Du sendest **${amount}** Nüsse an <@${target.id}>`
if (amount == 1) {
content = `Du sendest **eine** Nuss an <@${target.id}>`
}
await nutsColl.findOneAndUpdate({ userID: from.id }, { $inc: { nuts: -amount } }, { upsert: true })
await nutsColl.findOneAndUpdate({ userID: to.id }, { $inc: { nuts: +amount } }, { upsert: true })
const embed = new EmbedBuilder()
.setTitle('Gib Nuss!')
.setDescription(content)
.setThumbnail(target.displayAvatarURL())
return message.reply({ embeds: [embed] })
}
}
+49
View File
@@ -0,0 +1,49 @@
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js')
const { mClient } = require('../../../index')
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
require('dotenv').config()
module.exports = {
name: 'nutsleaderboard',
description: 'show nuts leaderboard',
aliases: ['nl', 'tn', 'topnuts'],
async execute(message, args) {
const row = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setLabel('◄')
.setStyle(ButtonStyle.Primary)
.setCustomId('nuts_leaderboard_left')
)
.addComponents(
new ButtonBuilder()
.setLabel('🧑')
.setStyle(ButtonStyle.Primary)
.setCustomId('nuts_leaderboard_self')
)
.addComponents(
new ButtonBuilder()
.setLabel('►')
.setStyle(ButtonStyle.Primary)
.setCustomId('nuts_leaderboard_right')
)
const db = mClient.db(process.env.M_DB)
const nutsColl = db.collection('items_nuts')
let skip = 0
const nutsData = await nutsColl.find({ nuts: { $gt: 0 } }).sort({ nuts: -1 }).skip(skip).limit(5).toArray()
let fields
let placements = skip + 1
nutsData.forEach((data) => {
fields = (fields ? fields : '') + (`${placements}. <@${data.userID}> : ${data.nuts} Nuts\r\n`)
})
const embed = new EmbedBuilder()
.setTitle('Nuts Leaderboard')
.setThumbnail(message.guild.iconURL({ dynamic: true}))
.setDescription(fields.toString())
.setColor('#5865F2') // Discord's blurple color
.setFooter({ text: 'Use ◄ ► to navigate' });
await message.reply({
embeds: [embed],
components: [row]
})
}
}
+58
View File
@@ -0,0 +1,58 @@
const { EmbedBuilder } = require('discord.js')
const { mClient } = require('../../../index')
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
require('dotenv').config()
module.exports = {
name: 'nutsstats',
description: 'shows nuts statistic',
aliases: ['nstat', 'ns'],
async execute(message, args) {
const db = mClient.db(process.env.M_DB)
const nStatsColl = db.collection('stats_nuts')
const stats = await nStatsColl.find({}).sort({ amount: 1 }).toArray()
let nutMin = {
count: 0,
amount: 0
}
let nutMax = {
count: 0,
amount: 0
}
let totalNuts = 0
let totalCount = 0
stats.forEach(stat => {
totalCount += stat.count
totalNuts += (stat.count * stat.amount)
if (nutMin.count > stat.count) { nutMin = stat }
if (nutMax.count < stat.count) { nutMax = stat }
})
let nutAvg = totalNuts / totalCount
const embed = new EmbedBuilder()
.setTitle("Nut Statistic")
.setDescription(
`Total Nut Actions: **${totalCount}**\r\n
Total Nuts nutted: **${totalNuts}**\r\n
Nut Average: **${nutAvg.toFixed(3)}**\r\n
Best Nut: **${nutMax.amount}**\r\n
Worst Nut: **${nutMin.amount}**`
)
.addFields(
{ name: '[0]', value: `x${stats[0].count}`, inline: true },
{ name: '[1]', value: `x${stats[1].count}`, inline: true },
{ name: '[2]', value: `x${stats[2].count}`, inline: true },
{ name: '[3]', value: `x${stats[3].count}`, inline: true },
{ name: '[4]', value: `x${stats[4].count}`, inline: true },
{ name: '[5]', value: `x${stats[5].count}`, inline: true },
{ name: '[6]', value: `x${stats[6].count}`, inline: true },
{ name: '[7]', value: `x${stats[7].count}`, inline: true },
{ name: '[8]', value: `x${stats[8].count}`, inline: true },
{ name: '[9]', value: `x${stats[9].count}`, inline: true }
)
.setColor(0x51267)
.setTimestamp()
.setThumbnail(message.guild.iconURL())
await message.reply({
embeds: [embed]
})
}
}
@@ -1,5 +1,5 @@
const { SlashCommandBuilder, EmbedBuilder, MessageFlags } = require('discord.js')
const { mClient } = require('../..')
const { mClient } = require('../../../index')
const { configDotenv } = require('dotenv')
configDotenv()
@@ -32,7 +32,6 @@ function isValidDate(day, month) {
return true;
}
async function birthdayAdd(interaction) {
let target = await interaction.options.getUser('user')
let day = await interaction.options.getNumber('day')
@@ -119,12 +118,6 @@ async function birthdayEdit(interaction) {
const res = await bdayColl.findOneAndUpdate({ userID: target.id }, { $set: data }, { upsert: true })
return interaction.reply({ content: "Birthday edited successfully!" })
}
async function isDateInPast(day, month) {
const currentYear = new Date().getFullYear();
const inputDate = new Date(currentYear, month - 1, day);
const now = new Date();
return inputDate < now;
}
async function makeTimestamp(day, month, year) {
const date = new Date(year, month - 1, day);
const unixTimestamp = Math.floor(date.getTime() / 1000);
@@ -141,31 +134,53 @@ function isToday(day, month) {
);
}
async function birthdayGet(interaction) {
let target = await interaction.options.getUser('user')
const db = mClient.db(process.env.M_DB)
const bdayColl = db.collection('items_birthdays')
const target = await interaction.options.getUser('user');
const db = mClient.db(process.env.M_DB);
const bdayColl = db.collection('items_birthdays');
const found = await bdayColl.findOne({ userID: target.id })
const found = await bdayColl.findOne({ userID: target.id });
if (!found) {
return interaction.reply({ content: "Not in Database!", flags: MessageFlags.Ephemeral })
return interaction.reply({
content: "Not in Database!",
flags: MessageFlags.Ephemeral
});
}
let unix
if(isDateInPast(found.day,found.month)){
let nextYear = new Date().getFullYear() + 1
unix = await makeTimestamp(found.day,found.month, nextYear)
const now = new Date();
const isToday =
now.getDate() === found.day &&
now.getMonth() === (found.month - 1);
let description;
if (isToday) {
description = `IS TODAY! 🥳🎉`;
} else {
let thisYear = new Date().getFullYear()
unix = await makeTimestamp(found.day,found.month, thisYear)
}
let description = `is on the <t:${unix}:d>\r\n<t:${unix}:R>`
if(isToday(found.day, found.month)){
description = `IS TODAY!🥳🎉`
const unix = getNextBirthdayTimestamp(found.day, found.month);
description = `is on the <t:${unix}:d>\n<t:${unix}:R>`;
}
const embed = new EmbedBuilder()
.setThumbnail(target.displayAvatarURL())
.setTitle(`${target.globalName ? target.globalName: target.username}'s Birthday!`)
.setDescription(description)
await interaction.reply({ embeds: [embed] })
.setTitle(`${target.globalName ?? target.username}'s Birthday...`)
.setDescription(description);
await interaction.reply({ embeds: [embed] });
}
function getNextBirthdayTimestamp(day, month) {
const now = new Date();
now.setHours(0, 0, 0, 0);
const currentYear = now.getFullYear();
let nextBirthday = new Date(currentYear, month - 1, day);
// If birthday already passed this year → next year
if (nextBirthday < now) {
nextBirthday.setFullYear(currentYear + 1);
}
return Math.floor(nextBirthday.getTime() / 1000); // Unix timestamp
}
module.exports = {
@@ -1,5 +1,5 @@
const { SlashCommandBuilder, Events, MessageFlags } = require('discord.js')
const { mClient } = require('../..')
const { mClient } = require('../../../index')
require('dotenv').config()
async function channelSet(interaction) {
@@ -1,5 +1,5 @@
const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, UserSelectMenuBuilder, MessageFlags } = require('discord.js')
const { mClient } = require('../..')
const { mClient } = require('../../../index')
require('dotenv').config()
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
@@ -1,5 +1,5 @@
const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, MessageFlags } = require('discord.js')
const { mClient } = require('../..')
const { mClient } = require('../../../index')
require('dotenv').config()
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
async function nutsGive(interaction) {
@@ -128,7 +128,7 @@ async function nutsLeaderboard(interaction) {
})
const embed = new EmbedBuilder()
.setTitle('Nuts Leaderboard')
.setThumbnail('https://cdn.discordapp.com/attachments/1152723542836772914/1152940755539722240/pngwing.com.png')
.setThumbnail(interaction.guild.iconURL({ dynamic: true }))
.setDescription(fields.toString())
.setColor('#5865F2') // Discord's blurple color
.setFooter({ text: 'Use ◄ ► to navigate' });
@@ -3,7 +3,7 @@ Random By Year?
Counter (Leaderboard)
*/
const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, UserSelectMenuBuilder, MessageFlags } = require('discord.js')
const { mClient } = require('../..')
const { mClient } = require('../../../index')
require('dotenv').config()
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
View File
View File
View File
View File
View File
View File