trying to handle music

This commit is contained in:
DeSqBlocki
2024-08-02 13:25:06 +02:00
parent a74e19be5a
commit 2925fb59dd
42 changed files with 3708 additions and 1 deletions
+46
View File
@@ -0,0 +1,46 @@
const { EmbedBuilder } = require("discord.js")
const { mClient } = require("../..")
require('dotenv').config()
module.exports = {
name: 'nuts_give_confirm',
description: 'confirm it',
async execute(interaction) {
const from = interaction.user
let temp = await interaction.message.embeds[0].description.split(' ')
const amount = Number(temp[3].split('**')[1])
const to = await interaction.message.guild.members.fetch(temp[6].slice(2,-1))
const db = mClient.db(process.env.M_DB)
const nutsColl = db.collection('nuts')
await nutsColl.findOneAndUpdate({ userID: from.id }, { $inc: { nuts: -amount } }, { upsert: true })
await nutsColl.findOneAndUpdate({ userID: to.id }, { $inc: { nuts: +amount } }, { upsert: true })
const yourBalance = await nutsColl.findOne({ userID: from.id })
const theirBalance = await nutsColl.findOne({ userID: to.id })
const embed = new EmbedBuilder()
.setTitle('Gib Nuss!')
.setDescription(`Willst du wirklich **${amount}** Nüsse an <@${to.id}> senden?`)
.addFields(
{ name: `Your Current Balance`, value: `${yourBalance.nuts} (**-${amount}**)`, inline: true },
{ name: `Your New Balance`, value: `${yourBalance.nuts - amount}`, inline: true },
{ name: '\u200B', value: '\u200B' },
{ name: `Their Current Balance`, value: `${theirBalance.nuts} (**+${amount}**)`, inline: true },
{ name: `Their New Balance`, value: `${theirBalance.nuts + amount}`, inline: true }
)
.setThumbnail(to.displayAvatarURL())
await interaction.update({
embeds: [ embed ]
})
const newEmbed = new EmbedBuilder()
.setTitle('Gib Nuss!')
.setDescription(`Du hast **${amount}** Nuts an <@${to.id}> gesendet!`)
.setFooter({ text: 'Um den gleichen Wert zu senden, klick einfach nochmal auf ✔' })
.setThumbnail(to.user.displayAvatarURL())
await interaction.followUp({
embeds: [ newEmbed ],
components: [],
})
}
}
+42
View File
@@ -0,0 +1,42 @@
const { EmbedBuilder } = require("discord.js")
const { mClient } = require("../..")
module.exports = {
name: 'nuts_give_fake',
description: 'fake it',
async execute(interaction) {
const from = interaction.user
let temp = await interaction.message.embeds[0].description.split(' ')
const amount = Number(temp[3].split('**')[1])
const to = await interaction.message.guild.members.fetch(temp[6].slice(2,-1))
const db = mClient.db(process.env.M_DB)
const nutsColl = db.collection('nuts')
const yourBalance = await nutsColl.findOne({ userID: from.id })
const theirBalance = await nutsColl.findOne({ userID: to.id })
const embed = new EmbedBuilder()
.setTitle('Gib Nuss!')
.setDescription(`Willst du wirklich **${amount}** Nüsse an <@${to.id}> senden?`)
.addFields(
{ name: `Your Current Balance`, value: `${yourBalance.nuts} (**-${amount}**)`, inline: true },
{ name: `Your New Balance`, value: `${yourBalance.nuts - amount}`, inline: true },
{ name: '\u200B', value: '\u200B' },
{ name: `Their Current Balance`, value: `${theirBalance.nuts} (**+${amount}**)`, inline: true },
{ name: `Their New Balance`, value: `${theirBalance.nuts + amount}`, inline: true }
)
.setThumbnail(to.displayAvatarURL())
await interaction.update({
embeds: [ embed ]
})
const newEmbed = new EmbedBuilder()
.setTitle('Du Fieser Gauner!')
.setDescription(`Yee Haw! Was tust du hier?!`)
.setThumbnail(interaction.client.user.displayAvatarURL())
await interaction.followUp({
embeds: [ newEmbed ],
components: [],
})
}
}
+33
View File
@@ -0,0 +1,33 @@
const { EmbedBuilder } = require("discord.js")
const { mClient } = require("../..")
require('dotenv').config()
module.exports = {
name: 'nuts_leaderboard_left',
description: 'navigate a page up',
async execute(interaction) {
const db = mClient.db(process.env.M_DB)
const nutsColl = db.collection('nuts')
const min = 0
let skip = interaction.message.embeds[0].data.description.split('.')
skip = Number(skip[0]) - 6
skip = skip - ( skip % 5)
if ( skip < 4){
skip = 0
}
const nutsData = await nutsColl.find({ nuts: { $gt: 0 } }).sort({ nuts: -1 }).skip(skip).limit(5).toArray()
let fields
nutsData.forEach((data) => {
skip++
fields = (fields ? fields : '') + (`${skip}. <@${data.userID}> : ${data.nuts} Nuts\r\n`)
})
const embed = new EmbedBuilder()
.setTitle('Nuts Leaderboard')
.setThumbnail('https://cdn.discordapp.com/attachments/1152723542836772914/1152940755539722240/pngwing.com.png')
.setDescription(fields.toString());
await interaction.update({
embeds: [embed],
components: [interaction.message.components[0]]
})
}
}
+31
View File
@@ -0,0 +1,31 @@
const { EmbedBuilder } = require("discord.js")
const { mClient } = require("../..")
require('dotenv').config()
module.exports = {
name: 'nuts_leaderboard_right',
description: 'navigate a page down',
async execute(interaction) {
const db = mClient.db(process.env.M_DB)
const nutsColl = db.collection('nuts')
const max = await nutsColl.countDocuments({ nuts: { $gt: 0 } })
let skip = interaction.message.embeds[0].data.description.split('.')
skip = Number(skip[0]) +4
if (skip >= (max - (max % 5))) {
skip = max - (max % 5)
}
const nutsData = await nutsColl.find({ nuts: { $gt: 0 } }).sort({ nuts: -1 }).skip(skip).limit(5).toArray()
let fields
nutsData.forEach((data) => {
skip++
fields = (fields ? fields : '') + (`${skip}. <@${data.userID}> : ${data.nuts} Nuts\r\n`)
})
const embed = new EmbedBuilder()
.setTitle('Nuts Leaderboard')
.setThumbnail('https://cdn.discordapp.com/attachments/1152723542836772914/1152940755539722240/pngwing.com.png')
.setDescription(fields.toString());
await interaction.update({
embeds: [embed],
components: [interaction.message.components[0]]
})
}
}
+41
View File
@@ -0,0 +1,41 @@
const { EmbedBuilder } = require("discord.js")
const { mClient } = require("../..")
require('dotenv').config()
module.exports = {
name: 'nuts_leaderboard_self',
description: 'navigate to your own placement',
async execute(interaction) {
const db = mClient.db(process.env.M_DB)
const nutsColl = db.collection('nuts')
const self = await nutsColl.find({ userID: interaction.user.id }).toArray()
const all = await nutsColl.find({ nuts: { $gt: 0 } }).sort({ nuts: -1 }).toArray()
function findIndex(){
let index = 0
for (let i = 0; i < all.length; i++) {
index++
if (all[i].nuts === self[0].nuts) {
return index
}
}
}
let selfIndex = findIndex()
let skip = selfIndex - ( selfIndex % 5)
const nutsData = await nutsColl.find({ nuts: { $gt: 0 } }).sort({ nuts: -1 }).skip(skip).limit(5).toArray()
let fields
nutsData.forEach((data) => {
skip++
fields = (fields ? fields : '') + (`${skip}. <@${data.userID}> : ${data.nuts} Nuts\r\n`)
})
const embed = new EmbedBuilder()
.setTitle('Nuts Leaderboard')
.setThumbnail('https://cdn.discordapp.com/attachments/1152723542836772914/1152940755539722240/pngwing.com.png')
.setDescription(fields.toString());
await interaction.update({
embeds: [embed],
components: [interaction.message.components[0]]
})
}
}