trying to handle music
This commit is contained in:
@@ -1 +1,2 @@
|
|||||||
.env
|
.env
|
||||||
|
node_modules
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
const { Events, ActivityType } = require('discord.js')
|
||||||
|
require('dotenv').config()
|
||||||
|
const { client } = require('./index')
|
||||||
|
const { RepeatMode } = require('distube')
|
||||||
|
const delay = ms => new Promise(res => setTimeout(res, ms));
|
||||||
|
var usersInTartaros = new Set()
|
||||||
|
var joined = false
|
||||||
|
const playlist = `https://www.youtube.com/playlist?list=PLjSh2s1ASTgsSdjCgFbpo18RAYF_dHf46`
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: Events.VoiceStateUpdate,
|
||||||
|
once: false,
|
||||||
|
async execute(oldUser, newUser) {
|
||||||
|
const guild = client.guilds.cache.get(newUser.guild.id)
|
||||||
|
const tartarosChannel = await guild.channels.fetch(process.env.D_TartarosID)
|
||||||
|
|
||||||
|
if (newUser.channelId === tartarosChannel.id && oldUser.channelId != newUser.channelId) {
|
||||||
|
if (newUser.id === '1152718975529140265') {
|
||||||
|
console.log('Bot joined Tartaros!')
|
||||||
|
await newUser.setMute(false)
|
||||||
|
//await newUser.setSuppress(false)
|
||||||
|
console.log(newUser)
|
||||||
|
}
|
||||||
|
|
||||||
|
usersInTartaros.add(newUser.id)
|
||||||
|
console.log(`${usersInTartaros.size} User(s) in Tartaros`)
|
||||||
|
|
||||||
|
if (!joined) {
|
||||||
|
joined = true;
|
||||||
|
await client.distube.voices.join(tartarosChannel)
|
||||||
|
//console.log(await guild.members.me.edit({ mute: false}))
|
||||||
|
|
||||||
|
await delay(3000)
|
||||||
|
//await tartarosChannel.guild.members.me.edit({ mute: false })
|
||||||
|
|
||||||
|
// await client.distube.play(playlist)
|
||||||
|
// const queue = interaction.client.distube.getQueue(interaction.guild)
|
||||||
|
// await queue.setRepeatMode('Queue')
|
||||||
|
// await queue.setVolume(40)
|
||||||
|
console.log('Unmuted')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (oldUser.channelID === tartarosChannel.id && oldUser.channelID != newUser.channelID) {
|
||||||
|
usersInTartaros.delete(oldUser.id)
|
||||||
|
//await client.distube.voices.leave(tartarosChannel)
|
||||||
|
joined = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
const { EmbedBuilder } = require("discord.js")
|
||||||
|
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: 'abort',
|
||||||
|
description: 'abort it',
|
||||||
|
async execute(interaction) {
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setTitle('Aborted')
|
||||||
|
.setDescription('Schließe Menü. . .')
|
||||||
|
|
||||||
|
await interaction.update({
|
||||||
|
embeds: [embed],
|
||||||
|
components: []
|
||||||
|
})
|
||||||
|
await delay(2000).then(interaction.deleteReply())
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js")
|
||||||
|
const { mClient } = require("../..")
|
||||||
|
require('dotenv').config()
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: 'honor_menu_dishonor',
|
||||||
|
description: 'honor menu dishonor button',
|
||||||
|
async execute(interaction) {
|
||||||
|
let description = interaction.message.embeds[0].data.description
|
||||||
|
const target = await interaction.guild.members.fetch(description.split(' ')[0].slice(2, -1))
|
||||||
|
const db = mClient.db(process.env.M_DB)
|
||||||
|
const honorsColl = db.collection('honors')
|
||||||
|
const reason = `[-] Quick Menu Dishonor`
|
||||||
|
const theirHonorLevel = await honorsColl.findOne({ userID: target.id })
|
||||||
|
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setTitle('- Honor Menu WIP -')
|
||||||
|
.setDescription(`Willst du wirklich <@${target.id}> einen **Dishonor** geben?\r\n[Grund: ${reason}]`)
|
||||||
|
.addFields({
|
||||||
|
name: 'Current Honor Level', value: `${theirHonorLevel?.honors ?? 0} (**-1**)`
|
||||||
|
})
|
||||||
|
.setThumbnail(target.displayAvatarURL())
|
||||||
|
const row = new ActionRowBuilder()
|
||||||
|
.addComponents(
|
||||||
|
new ButtonBuilder()
|
||||||
|
.setLabel('✔')
|
||||||
|
.setCustomId('honor_multi_confirm')
|
||||||
|
.setStyle(ButtonStyle.Success)
|
||||||
|
)
|
||||||
|
.addComponents(
|
||||||
|
new ButtonBuilder()
|
||||||
|
.setLabel('✖')
|
||||||
|
.setCustomId('abort')
|
||||||
|
.setStyle(ButtonStyle.Danger)
|
||||||
|
)
|
||||||
|
await interaction.reply({
|
||||||
|
embeds: [embed],
|
||||||
|
components: [row],
|
||||||
|
ephemeral: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js")
|
||||||
|
const { mClient } = require("../..")
|
||||||
|
require('dotenv').config()
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: 'honor_menu_history',
|
||||||
|
description: 'show selected user honor history',
|
||||||
|
async execute(interaction) {
|
||||||
|
let description = interaction.message.embeds[0].data.description
|
||||||
|
const target = await interaction.guild.members.fetch(description.split(' ')[0].slice(2, -1))
|
||||||
|
const db = mClient.db(process.env.M_DB)
|
||||||
|
const reasonsColl = db.collection('honor-reasons')
|
||||||
|
const history = await reasonsColl.findOne({ userID: target.user.id })
|
||||||
|
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setTitle('- Honor History -')
|
||||||
|
.setDescription(`${target} - ${target.user.globalName ?? target.user.username}`)
|
||||||
|
.setThumbnail(target.displayAvatarURL())
|
||||||
|
.setFooter({text: 'Um zurückzukehren, wähle einen Nutzer!'})
|
||||||
|
if(history){
|
||||||
|
let temp = ''
|
||||||
|
history.reasons.forEach(reason => {
|
||||||
|
temp += reason + '\r\n'
|
||||||
|
})
|
||||||
|
embed.setDescription(temp)
|
||||||
|
}
|
||||||
|
const select = await interaction.message.components[0]
|
||||||
|
const row = await interaction.message.components[1]
|
||||||
|
|
||||||
|
await interaction.reply({
|
||||||
|
embeds: [embed],
|
||||||
|
components: [select, row],
|
||||||
|
ephemeral: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
const { EmbedBuilder, ButtonBuilder, ActionRowBuilder, ButtonStyle } = require("discord.js")
|
||||||
|
const { mClient } = require("../..")
|
||||||
|
require('dotenv').config()
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: 'honor_menu_honor',
|
||||||
|
description: 'honor menu honor button',
|
||||||
|
async execute(interaction) {
|
||||||
|
let description = interaction.message.embeds[0].data.description
|
||||||
|
const target = await interaction.guild.members.fetch(description.split(' ')[0].slice(2, -1))
|
||||||
|
const db = mClient.db(process.env.M_DB)
|
||||||
|
const honorsColl = db.collection('honors')
|
||||||
|
const reason = `[+] Quick Menu Honor`
|
||||||
|
const theirHonorLevel = await honorsColl.findOne({ userID: target.id })
|
||||||
|
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setTitle('- Honor Up! -')
|
||||||
|
.setDescription(`Willst du wirklich <@${target.id}> einen **Honor** geben?\r\n[Grund: ${reason}]`)
|
||||||
|
.addFields({
|
||||||
|
name: 'Current Honor Level', value: `${theirHonorLevel?.honors ?? 0} (**+1**)`
|
||||||
|
})
|
||||||
|
.setThumbnail(target.displayAvatarURL())
|
||||||
|
//.setFooter('Honor Level updaten sich nicht automatisch!')
|
||||||
|
const row = new ActionRowBuilder()
|
||||||
|
.addComponents(
|
||||||
|
new ButtonBuilder()
|
||||||
|
.setLabel('✔')
|
||||||
|
.setCustomId('honor_multi_confirm')
|
||||||
|
.setStyle(ButtonStyle.Success)
|
||||||
|
)
|
||||||
|
.addComponents(
|
||||||
|
new ButtonBuilder()
|
||||||
|
.setLabel('✖')
|
||||||
|
.setCustomId('abort')
|
||||||
|
.setStyle(ButtonStyle.Danger)
|
||||||
|
)
|
||||||
|
await interaction.reply({
|
||||||
|
embeds: [embed],
|
||||||
|
components: [row],
|
||||||
|
ephemeral: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
const { EmbedBuilder } = require("discord.js")
|
||||||
|
const { mClient } = require("../..")
|
||||||
|
require('dotenv').config()
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: 'honor_multi_confirm',
|
||||||
|
description: 'confirm it',
|
||||||
|
async execute(interaction) {
|
||||||
|
let temp = await interaction.message.embeds[0].description.split(' ')
|
||||||
|
var honor
|
||||||
|
if (temp[5].slice(2, -2) == 'Honor') {
|
||||||
|
honor = 1
|
||||||
|
} else {
|
||||||
|
honor = -1
|
||||||
|
}
|
||||||
|
const target = await interaction.message.guild.members.fetch(temp[3].slice(2, -1))
|
||||||
|
temp = interaction.message.embeds[0].description.split('\r\n')
|
||||||
|
const reason = `${temp[1].slice(7, -1)}`
|
||||||
|
|
||||||
|
const db = mClient.db(process.env.M_DB)
|
||||||
|
const honorsColl = db.collection('honors')
|
||||||
|
const reasonsColl = db.collection('honor-reasons')
|
||||||
|
const theirHonorLevel = await honorsColl.findOne({ userID: target.id })
|
||||||
|
|
||||||
|
await honorsColl.findOneAndUpdate({ userID: target.id }, { $inc: { honors: honor } }, { upsert: true })
|
||||||
|
await reasonsColl.findOneAndUpdate({ userID: target.id }, { $push: { reasons: reason } }, { upsert: true })
|
||||||
|
|
||||||
|
var description
|
||||||
|
var newTitle
|
||||||
|
var newDescription
|
||||||
|
var newThumbnail
|
||||||
|
|
||||||
|
if (honor == 1) {
|
||||||
|
description = `Willst du wirklich <@${target.id}> einen Honor geben?\r\n[Grund: ${reason}]`
|
||||||
|
newTitle = 'Honor Up!'
|
||||||
|
newDescription = `<@${target.id}> erhält einen Honor!\r\n[Grund: ${reason}]`
|
||||||
|
newThumbnail = "https://cdn.discordapp.com/emojis/748176295535443968.webp"
|
||||||
|
} else {
|
||||||
|
description = `Willst du wirklich <@${target.id}> einen Dishonor geben?\r\n[Grund: ${reason}]`
|
||||||
|
newTitle = 'Honor Down!'
|
||||||
|
newDescription = `<@${target.id}> erhält einen Dishonor!\r\n[Grund: ${reason}]`
|
||||||
|
newThumbnail = "https://cdn.discordapp.com/emojis/748176295132790786.webp"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setTitle('- Honor Menu -')
|
||||||
|
.setDescription(description)
|
||||||
|
.addFields({
|
||||||
|
name: 'Current Honor Level', value: `${theirHonorLevel?.honors ?? 0} ${honor == 1 ? '(**+1**)' : '(**-1**)'}`
|
||||||
|
})
|
||||||
|
.setThumbnail(target.displayAvatarURL())
|
||||||
|
await interaction.update({
|
||||||
|
embeds: [embed]
|
||||||
|
})
|
||||||
|
|
||||||
|
const newEmbed = new EmbedBuilder()
|
||||||
|
.setTitle(newTitle)
|
||||||
|
.setDescription(newDescription)
|
||||||
|
.setThumbnail(newThumbnail)
|
||||||
|
await interaction.followUp({
|
||||||
|
embeds: [newEmbed],
|
||||||
|
components: [],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
const { EmbedBuilder } = require("discord.js")
|
||||||
|
const { mClient } = require("../..")
|
||||||
|
require('dotenv').config()
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: 'honors_leaderboard_left',
|
||||||
|
description: 'navigate a page up',
|
||||||
|
async execute(interaction) {
|
||||||
|
const db = mClient.db(process.env.M_DB)
|
||||||
|
const honorsColl = db.collection('honors')
|
||||||
|
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 honorsData = await honorsColl.find().sort({ honors: -1 }).skip(skip).limit(5).toArray()
|
||||||
|
let fields
|
||||||
|
honorsData.forEach((data) => {
|
||||||
|
skip++
|
||||||
|
fields = (fields ? fields : '') + (`${skip}. <@${data.userID}> : ${data.honors} Honors\r\n`)
|
||||||
|
})
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setTitle('Honors 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]]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
const { EmbedBuilder } = require("discord.js")
|
||||||
|
const { mClient } = require("../..")
|
||||||
|
require('dotenv').config()
|
||||||
|
module.exports = {
|
||||||
|
name: 'honors_leaderboard_right',
|
||||||
|
description: 'navigate a page down',
|
||||||
|
async execute(interaction) {
|
||||||
|
const db = mClient.db(process.env.M_DB)
|
||||||
|
const honorsColl = db.collection('honors')
|
||||||
|
const max = await honorsColl.countDocuments()
|
||||||
|
let skip = interaction.message.embeds[0].data.description.split('.')
|
||||||
|
skip = Number(skip[0]) +4
|
||||||
|
if (skip >= (max - (max % 5))) {
|
||||||
|
skip = max - (max % 5)
|
||||||
|
}
|
||||||
|
const honorsData = await honorsColl.find().sort({ honors: -1 }).skip(skip).limit(5).toArray()
|
||||||
|
let fields
|
||||||
|
honorsData.forEach((data) => {
|
||||||
|
skip++
|
||||||
|
fields = (fields ? fields : '') + (`${skip}. <@${data.userID}> : ${data.honors} Honors\r\n`)
|
||||||
|
})
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setTitle('Honors 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]]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
const { EmbedBuilder } = require("discord.js")
|
||||||
|
const { mClient } = require("../..")
|
||||||
|
require('dotenv').config()
|
||||||
|
module.exports = {
|
||||||
|
name: 'honors_leaderboard_self',
|
||||||
|
description: 'navigate to your own placement',
|
||||||
|
async execute(interaction) {
|
||||||
|
const db = mClient.db(process.env.M_DB)
|
||||||
|
const honorsColl = db.collection('honors')
|
||||||
|
|
||||||
|
const self = await honorsColl.find({ userID: interaction.user.id }).toArray()
|
||||||
|
const all = await honorsColl.find().sort({ honors: -1 }).toArray()
|
||||||
|
|
||||||
|
function findIndex(){
|
||||||
|
let index = 0
|
||||||
|
for (let i = 0; i < all.length; i++) {
|
||||||
|
index++
|
||||||
|
if (all[i].honors === self[0].honors) {
|
||||||
|
return index
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let selfIndex = findIndex()
|
||||||
|
let skip = selfIndex - ( selfIndex % 5)
|
||||||
|
|
||||||
|
const honorsData = await honorsColl.find().sort({ honors: -1 }).skip(skip).limit(5).toArray()
|
||||||
|
let fields
|
||||||
|
honorsData.forEach((data) => {
|
||||||
|
skip++
|
||||||
|
fields = (fields ? fields : '') + (`${skip}. <@${data.userID}> : ${data.honors} Honors\r\n`)
|
||||||
|
})
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setTitle('Honors 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]]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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: [],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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: [],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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]]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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]]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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]]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
module.exports = {
|
||||||
|
name: 'test_button_1',
|
||||||
|
description: 'a test button',
|
||||||
|
execute(interaction){
|
||||||
|
interaction.reply({
|
||||||
|
content: 'Success'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,272 @@
|
|||||||
|
const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, UserSelectMenuBuilder } = require('discord.js')
|
||||||
|
const { mClient } = require('../..')
|
||||||
|
require('dotenv').config()
|
||||||
|
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
|
||||||
|
|
||||||
|
async function honorHoner(interaction) {
|
||||||
|
const db = mClient.db(process.env.M_DB)
|
||||||
|
const honorsColl = db.collection('honors')
|
||||||
|
|
||||||
|
const target = await interaction.options.getUser('target')
|
||||||
|
const reason = `[+] ${await interaction.options.getString('reason') ?? 'No reason provided'}`
|
||||||
|
|
||||||
|
const theirHonorLevel = await honorsColl.findOne({ userID: target.id })
|
||||||
|
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setTitle('- Honor Up! -')
|
||||||
|
.setDescription(`Willst du wirklich <@${target.id}> einen **Honor** geben?\r\n[Grund: ${reason}]`)
|
||||||
|
.addFields({
|
||||||
|
name: 'Current Honor Level', value: `${theirHonorLevel?.honors ?? 0} (**+1**)`
|
||||||
|
})
|
||||||
|
.setThumbnail(target.displayAvatarURL())
|
||||||
|
const row = new ActionRowBuilder()
|
||||||
|
.addComponents(
|
||||||
|
new ButtonBuilder()
|
||||||
|
.setLabel('✔')
|
||||||
|
.setCustomId('honor_multi_confirm')
|
||||||
|
.setStyle(ButtonStyle.Success)
|
||||||
|
)
|
||||||
|
.addComponents(
|
||||||
|
new ButtonBuilder()
|
||||||
|
.setLabel('✖')
|
||||||
|
.setCustomId('abort')
|
||||||
|
.setStyle(ButtonStyle.Danger)
|
||||||
|
)
|
||||||
|
await interaction.reply({
|
||||||
|
embeds: [embed],
|
||||||
|
components: [row],
|
||||||
|
ephemeral: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
async function honerDishonor(interaction) {
|
||||||
|
const db = mClient.db(process.env.M_DB)
|
||||||
|
const honorsColl = db.collection('honors')
|
||||||
|
|
||||||
|
const target = await interaction.options.getUser('target')
|
||||||
|
const reason = `[-] ${await interaction.options.getString('reason') ?? 'No reason provided'}`
|
||||||
|
const theirHonorLevel = await honorsColl.findOne({ userID: target.id })
|
||||||
|
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setTitle('- Honor Down! -')
|
||||||
|
.setDescription(`Willst du wirklich <@${target.id}> einen **Dishonor** geben?\r\n[Grund: ${reason}]`)
|
||||||
|
.addFields({
|
||||||
|
name: 'Current Honor Level', value: `${theirHonorLevel?.honors ?? 0} (**-1**)`
|
||||||
|
})
|
||||||
|
.setThumbnail(target.displayAvatarURL())
|
||||||
|
const row = new ActionRowBuilder()
|
||||||
|
.addComponents(
|
||||||
|
new ButtonBuilder()
|
||||||
|
.setLabel('✔')
|
||||||
|
.setCustomId('honor_multi_confirm')
|
||||||
|
.setStyle(ButtonStyle.Success)
|
||||||
|
)
|
||||||
|
.addComponents(
|
||||||
|
new ButtonBuilder()
|
||||||
|
.setLabel('✖')
|
||||||
|
.setCustomId('abort')
|
||||||
|
.setStyle(ButtonStyle.Danger)
|
||||||
|
)
|
||||||
|
await interaction.reply({
|
||||||
|
embeds: [embed],
|
||||||
|
components: [row],
|
||||||
|
ephemeral: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
async function honorLeaderboard(interaction) {
|
||||||
|
const row = new ActionRowBuilder()
|
||||||
|
.addComponents(
|
||||||
|
new ButtonBuilder()
|
||||||
|
.setLabel('◄')
|
||||||
|
.setStyle(ButtonStyle.Primary)
|
||||||
|
.setCustomId('honors_leaderboard_left')
|
||||||
|
)
|
||||||
|
.addComponents(
|
||||||
|
new ButtonBuilder()
|
||||||
|
.setLabel('🧑')
|
||||||
|
.setStyle(ButtonStyle.Primary)
|
||||||
|
.setCustomId('honors_leaderboard_self')
|
||||||
|
)
|
||||||
|
.addComponents(
|
||||||
|
new ButtonBuilder()
|
||||||
|
.setLabel('►')
|
||||||
|
.setStyle(ButtonStyle.Primary)
|
||||||
|
.setCustomId('honors_leaderboard_right')
|
||||||
|
)
|
||||||
|
const db = mClient.db(process.env.M_DB)
|
||||||
|
const honorsColl = db.collection('honors')
|
||||||
|
let skip = 0
|
||||||
|
const honorsData = await honorsColl.find({}).sort({ honors: -1 }).skip(skip).limit(5).toArray()
|
||||||
|
let fields
|
||||||
|
let placements = skip + 1
|
||||||
|
honorsData.forEach((data) => {
|
||||||
|
fields = (fields ? fields : '') + (`${placements}. <@${data.userID}> : ${data.honors} Honors\r\n`)
|
||||||
|
})
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setTitle('- Honors Leaderboard -')
|
||||||
|
.setThumbnail('https://cdn.discordapp.com/attachments/1152723542836772914/1152940755539722240/pngwing.com.png')
|
||||||
|
.setDescription(fields.toString());
|
||||||
|
await interaction.editReply({
|
||||||
|
embeds: [embed],
|
||||||
|
components: [row]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
async function honorHistory(interaction) {
|
||||||
|
var target = interaction.options.getUser('target')
|
||||||
|
if (!target) { target = interaction.user }
|
||||||
|
const db = mClient.db(process.env.M_DB)
|
||||||
|
const reasonsColl = db.collection('honor-reasons')
|
||||||
|
var history = await reasonsColl.findOne({ userID: target.id })
|
||||||
|
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setTitle('- Honor History -')
|
||||||
|
.setThumbnail(target.displayAvatarURL())
|
||||||
|
|
||||||
|
if (history) {
|
||||||
|
let temp = ''
|
||||||
|
history.reasons.forEach(reason => {
|
||||||
|
temp += reason + '\r\n'
|
||||||
|
})
|
||||||
|
embed.setDescription(temp)
|
||||||
|
}
|
||||||
|
await interaction.editReply({ embeds: [embed] })
|
||||||
|
}
|
||||||
|
async function honorCheck(interaction) {
|
||||||
|
var target = interaction.options.getUser('target')
|
||||||
|
if (!target) { target = interaction.user }
|
||||||
|
const db = mClient.db(process.env.M_DB)
|
||||||
|
const honorsColl = db.collection('honors')
|
||||||
|
var honors = await honorsColl.findOne({ userID: target.id })
|
||||||
|
honors = honors?.honors ?? 0
|
||||||
|
|
||||||
|
if (!honors) {
|
||||||
|
content = 'Choose a goddamn side!'
|
||||||
|
} else {
|
||||||
|
if (honors === -20) {
|
||||||
|
content = 'They are is at max Dishonor Level! <:lowhonor:748176295132790786> <:lowhonor:748176295132790786> <:lowhonor:748176295132790786>\n```' + `You don't get to live a bad life and have good things happen to you. - Arthur M.` + '```'
|
||||||
|
} else if (honors === 20) {
|
||||||
|
content = 'They are at max Honor Level! <:highhonor:748176295535443968> <:highhonor:748176295535443968> <:highhonor:748176295535443968>'
|
||||||
|
} else if (honors > 0) {
|
||||||
|
content = 'real good, boah, REAL GOOD! <:highhonor:748176295535443968>'
|
||||||
|
} else if (honors < 0) {
|
||||||
|
content = 'What happened to Loyalty?! <:lowhonor:748176295132790786>'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setTitle('- Honor Check -')
|
||||||
|
.setDescription(`${target} has an Honor Level of **${honors}**!`)
|
||||||
|
.setThumbnail(target.displayAvatarURL())
|
||||||
|
.addFields({ name: '\u200B', value: `*${content}*` })
|
||||||
|
|
||||||
|
await interaction.editReply({
|
||||||
|
embeds: [embed]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
async function honorMenu(interaction) {
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setTitle('- Honor Menu WIP! -')
|
||||||
|
.setDescription('- Choose someone from the Select Menu below\r\n- Choose Honor Dishonor, or History\r\n- Confirm your Selection')
|
||||||
|
.setThumbnail(interaction.guild.iconURL())
|
||||||
|
const row = new ActionRowBuilder()
|
||||||
|
.addComponents(
|
||||||
|
new ButtonBuilder()
|
||||||
|
.setLabel('Honor')
|
||||||
|
.setEmoji(`<:honorhigh:748176295535443968>`)
|
||||||
|
.setCustomId('honor_menu_honor')
|
||||||
|
.setStyle(ButtonStyle.Primary)
|
||||||
|
)
|
||||||
|
.addComponents(
|
||||||
|
new ButtonBuilder()
|
||||||
|
.setLabel('Dishonor')
|
||||||
|
.setEmoji(`<:honorlow:748176295132790786>`)
|
||||||
|
.setCustomId('honor_menu_dishonor')
|
||||||
|
.setStyle(ButtonStyle.Primary)
|
||||||
|
)
|
||||||
|
.addComponents(
|
||||||
|
new ButtonBuilder()
|
||||||
|
.setLabel('History')
|
||||||
|
.setEmoji('📜')
|
||||||
|
.setCustomId('honor_menu_history')
|
||||||
|
.setStyle(ButtonStyle.Secondary)
|
||||||
|
)
|
||||||
|
const select = new ActionRowBuilder()
|
||||||
|
.addComponents(
|
||||||
|
new UserSelectMenuBuilder()
|
||||||
|
.setCustomId('honor_menu_mentionable')
|
||||||
|
.setPlaceholder('Select a User')
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
await interaction.reply({
|
||||||
|
embeds: [embed],
|
||||||
|
components: [select, row],
|
||||||
|
ephemeral: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
module.exports = {
|
||||||
|
data: new SlashCommandBuilder()
|
||||||
|
.setName('honors')
|
||||||
|
.setDescription('rund um den honor')
|
||||||
|
.addSubcommand(s =>
|
||||||
|
s
|
||||||
|
.setName('honor')
|
||||||
|
.setDescription('honor someone')
|
||||||
|
.addUserOption(o => o.setName('target').setDescription('wer wird gehonored?').setRequired(true))
|
||||||
|
.addStringOption(o => o.setName('reason').setDescription('reason?'))
|
||||||
|
)
|
||||||
|
.addSubcommand(s =>
|
||||||
|
s
|
||||||
|
.setName('dishonor')
|
||||||
|
.setDescription('dishonor someone')
|
||||||
|
.addUserOption(o => o.setName('target').setDescription('wer wird gehonored?').setRequired(true))
|
||||||
|
.addStringOption(o => o.setName('reason').setDescription('reason?'))
|
||||||
|
)
|
||||||
|
.addSubcommand(s =>
|
||||||
|
s
|
||||||
|
.setName('check')
|
||||||
|
.setDescription("check someone's honor level")
|
||||||
|
.addUserOption(o => o.setName('target').setDescription('wer wird gehonored?'))
|
||||||
|
)
|
||||||
|
.addSubcommand(s =>
|
||||||
|
s
|
||||||
|
.setName('history')
|
||||||
|
.setDescription("check someone's honor history")
|
||||||
|
.addUserOption(o => o.setName('target').setDescription('von wem?'))
|
||||||
|
)
|
||||||
|
.addSubcommand(s =>
|
||||||
|
s
|
||||||
|
.setName('leaderboard')
|
||||||
|
.setDescription("check who's got the most honor")
|
||||||
|
)
|
||||||
|
.addSubcommand(s =>
|
||||||
|
s
|
||||||
|
.setName('menu')
|
||||||
|
.setDescription('WIP universal honor menu'))
|
||||||
|
,
|
||||||
|
async execute(interaction) {
|
||||||
|
switch (interaction.options._subcommand) {
|
||||||
|
case 'honor':
|
||||||
|
honorHoner(interaction)
|
||||||
|
break;
|
||||||
|
case 'dishonor':
|
||||||
|
honerDishonor(interaction)
|
||||||
|
break;
|
||||||
|
case 'leaderboard':
|
||||||
|
await interaction.deferReply()
|
||||||
|
honorLeaderboard(interaction)
|
||||||
|
break;
|
||||||
|
case 'history':
|
||||||
|
await interaction.deferReply()
|
||||||
|
honorHistory(interaction)
|
||||||
|
break;
|
||||||
|
case 'check':
|
||||||
|
await interaction.deferReply()
|
||||||
|
honorCheck(interaction)
|
||||||
|
break;
|
||||||
|
case 'menu':
|
||||||
|
honorMenu(interaction)
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,165 @@
|
|||||||
|
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
|
||||||
|
const { configDotenv } = require("dotenv");
|
||||||
|
configDotenv
|
||||||
|
|
||||||
|
async function musicJoin(interaction) {
|
||||||
|
const voiceChannel = await interaction.guild.channels.fetch(process.env.D_RealTartarosID)
|
||||||
|
await interaction.client.distube.voices.join(voiceChannel)
|
||||||
|
await voiceChannel.guild.members.me.edit({ mute: false })
|
||||||
|
await interaction.reply({
|
||||||
|
content: `Joined ${voiceChannel}`,
|
||||||
|
ephemeral: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
async function musicLeave(interaction) {
|
||||||
|
const voiceChannel = await interaction.guild.channels.fetch(process.env.D_RealTartarosID)
|
||||||
|
await interaction.client.distube.voices.leave(voiceChannel)
|
||||||
|
await interaction.reply({
|
||||||
|
content: `Left ${voiceChannel}`,
|
||||||
|
ephemeral: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
async function musicPlay(interaction) {
|
||||||
|
const url = await interaction.options.getString('url')
|
||||||
|
const regex = /^((?:https?:)?\/\/)?((?:www|m)\.)?((?:youtube\.com|youtu.be))(\/(?:[\w\-]+\?v=|embed\/|v\/)?)([\w\-]+)(\S+)?$/gm
|
||||||
|
const voiceChannel = await interaction.member.voice.channel
|
||||||
|
|
||||||
|
if (!url.match(regex)) {
|
||||||
|
return await interaction.editReply({
|
||||||
|
content: `Invalid URL`,
|
||||||
|
ephemeral: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
await interaction.client.distube.play(voiceChannel, url)
|
||||||
|
const queue = interaction.client.distube.getQueue(interaction.guild)
|
||||||
|
const { name, thumbnail } = queue.songs[0]
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setThumbnail(thumbnail)
|
||||||
|
.setTitle(`Added ${name} to Queue`)
|
||||||
|
.setURL(url)
|
||||||
|
await interaction.editReply({
|
||||||
|
embeds: [embed]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
async function musicVolume(interaction) {
|
||||||
|
const queue = interaction.client.distube.getQueue(interaction.guild)
|
||||||
|
if (!queue) {
|
||||||
|
return await interaction.reply({
|
||||||
|
content: `There is nothing in the queue right now!`,
|
||||||
|
ephemeral: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const volume = await interaction.options.getNumber('volume')
|
||||||
|
queue.setVolume(volume)
|
||||||
|
await interaction.reply({
|
||||||
|
content: `Set Volume to ${volume}%`,
|
||||||
|
ephemeral: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
async function musicQueue(interaction) {
|
||||||
|
const queue = interaction.client.distube.getQueue(interaction.guild)
|
||||||
|
if (!queue) {
|
||||||
|
return await interaction.reply({
|
||||||
|
content: `There is nothing in the queue right now!`,
|
||||||
|
ephemeral: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const songs = queue.songs.map((song, i) => `${i === 0 ? 'Playing:' : `${i}.`} ${song.name} - \`${song.formattedDuration}\``)
|
||||||
|
.join('\n')
|
||||||
|
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setTitle(`Server Queue`)
|
||||||
|
.setDescription(songs.toString())
|
||||||
|
await interaction.reply({
|
||||||
|
embeds: [ embed ]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
async function musicSkip(interaction) {
|
||||||
|
const queue = interaction.client.distube.getQueue(interaction.guild)
|
||||||
|
if (!queue) {
|
||||||
|
return await interaction.reply({
|
||||||
|
content: `There is nothing in the queue right now!`,
|
||||||
|
ephemeral: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const song = await queue.skip()
|
||||||
|
await interaction.reply({
|
||||||
|
content: `Skipped! Now playing:\n${song.name}`
|
||||||
|
})
|
||||||
|
} catch (e) {
|
||||||
|
await interaction.reply({
|
||||||
|
content: e
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
module.exports = {
|
||||||
|
data: new SlashCommandBuilder()
|
||||||
|
.setName('music')
|
||||||
|
.setDescription('handles all music related commands')
|
||||||
|
.addSubcommand(s =>
|
||||||
|
s
|
||||||
|
.setName('play')
|
||||||
|
.setDescription('plays music')
|
||||||
|
.addStringOption(o => o.setName('url').setDescription('youtube url').setRequired(true))
|
||||||
|
).addSubcommand(s =>
|
||||||
|
s
|
||||||
|
.setName('join')
|
||||||
|
.setDescription('join default music channel')
|
||||||
|
).addSubcommand(s =>
|
||||||
|
s
|
||||||
|
.setName('leave')
|
||||||
|
.setDescription('leave default music channel')
|
||||||
|
).addSubcommand(s =>
|
||||||
|
s
|
||||||
|
.setName('volume')
|
||||||
|
.setDescription('adjust music volume (default: 50%)')
|
||||||
|
.addNumberOption(o => o.setName('volume').setDescription('choose volume').addChoices(
|
||||||
|
{ name: '100%', value: 100 },
|
||||||
|
{ name: '90%', value: 90 },
|
||||||
|
{ name: '80%', value: 80 },
|
||||||
|
{ name: '70%', value: 70 },
|
||||||
|
{ name: '60%', value: 60 },
|
||||||
|
{ name: '50%', value: 50 },
|
||||||
|
{ name: '40%', value: 40 },
|
||||||
|
{ name: '30%', value: 30 },
|
||||||
|
{ name: '20%', value: 20 },
|
||||||
|
{ name: '10%', value: 10 },
|
||||||
|
{ name: '0%', value: 0 },
|
||||||
|
).setRequired(true))
|
||||||
|
).addSubcommand(s =>
|
||||||
|
s
|
||||||
|
.setName('queue')
|
||||||
|
.setDescription('show current queue')
|
||||||
|
).addSubcommand(s =>
|
||||||
|
s
|
||||||
|
.setName('skip')
|
||||||
|
.setDescription('skip current song')
|
||||||
|
),
|
||||||
|
async execute(interaction) {
|
||||||
|
const subcommand = await interaction.options._subcommand
|
||||||
|
switch (subcommand) {
|
||||||
|
case 'play':
|
||||||
|
interaction.deferReply()
|
||||||
|
musicPlay(interaction)
|
||||||
|
break;
|
||||||
|
case 'join':
|
||||||
|
musicJoin(interaction)
|
||||||
|
break;
|
||||||
|
case 'leave':
|
||||||
|
musicLeave(interaction)
|
||||||
|
break;
|
||||||
|
case 'volume':
|
||||||
|
musicVolume(interaction)
|
||||||
|
break;
|
||||||
|
case 'queue':
|
||||||
|
musicQueue(interaction)
|
||||||
|
break;
|
||||||
|
case 'skip':
|
||||||
|
musicSkip(interaction)
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,345 @@
|
|||||||
|
const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js')
|
||||||
|
const { mClient } = require('../..')
|
||||||
|
require('dotenv').config()
|
||||||
|
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
|
||||||
|
async function nutsGive(interaction) {
|
||||||
|
async function tradeWindow(buttonID1, buttonID2) {
|
||||||
|
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())
|
||||||
|
const row = new ActionRowBuilder()
|
||||||
|
.addComponents(
|
||||||
|
new ButtonBuilder()
|
||||||
|
.setLabel('✔')
|
||||||
|
.setCustomId(buttonID1)
|
||||||
|
.setStyle(ButtonStyle.Success)
|
||||||
|
)
|
||||||
|
.addComponents(
|
||||||
|
new ButtonBuilder()
|
||||||
|
.setLabel('✖')
|
||||||
|
.setCustomId(buttonID2)
|
||||||
|
.setStyle(ButtonStyle.Danger)
|
||||||
|
)
|
||||||
|
await interaction.reply({
|
||||||
|
embeds: [embed],
|
||||||
|
components: [row],
|
||||||
|
ephemeral: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const from = interaction.user
|
||||||
|
const to = await interaction.options.getUser('target')
|
||||||
|
var amount = await interaction.options.getNumber('amount')
|
||||||
|
|
||||||
|
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 })
|
||||||
|
if (amount <= 0) {
|
||||||
|
amount = yourBalance.nuts
|
||||||
|
return tradeWindow('nuts_give_fake', 'abort')
|
||||||
|
}
|
||||||
|
if (yourBalance.nuts < amount) {
|
||||||
|
return await interaction.reply({
|
||||||
|
content: 'Du kannst nicht mehr geben als du hast!',
|
||||||
|
ephemeral: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return tradeWindow('nuts_give_confirm', 'abort')
|
||||||
|
}
|
||||||
|
async function nutsCheck(interaction) {
|
||||||
|
let target = interaction.options.getUser('target')
|
||||||
|
let addressing
|
||||||
|
if (!target) {
|
||||||
|
target = interaction.user
|
||||||
|
addressing = `Du hast`
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!target.globalName) {
|
||||||
|
addressing = `${target.username} hat`
|
||||||
|
} else {
|
||||||
|
addressing = `${target.globalName} hat`
|
||||||
|
}
|
||||||
|
|
||||||
|
const db = mClient.db(process.env.M_DB)
|
||||||
|
const nutsColl = db.collection('nuts')
|
||||||
|
const 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!`
|
||||||
|
}
|
||||||
|
|
||||||
|
let title = 'Zähle Nüsse'
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
for (let i = 0; i < 4; i++) {
|
||||||
|
embed.setTitle(title)
|
||||||
|
await interaction.editReply({
|
||||||
|
embeds: [embed]
|
||||||
|
})
|
||||||
|
title = title + ' .'
|
||||||
|
await delay(500);
|
||||||
|
}
|
||||||
|
embed
|
||||||
|
.setTitle(content)
|
||||||
|
.setThumbnail('https://cdn-icons-png.flaticon.com/512/628/628206.png')
|
||||||
|
|
||||||
|
await interaction.editReply({
|
||||||
|
embeds: [embed]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
async function nutsLeaderboard(interaction) {
|
||||||
|
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('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('https://cdn.discordapp.com/attachments/1152723542836772914/1152940755539722240/pngwing.com.png')
|
||||||
|
.setDescription(fields.toString());
|
||||||
|
await interaction.editReply({
|
||||||
|
embeds: [embed],
|
||||||
|
components: [row]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
async function nutsStats(interaction) {
|
||||||
|
const db = mClient.db(process.env.M_DB)
|
||||||
|
const nStatsColl = db.collection('nut-stats')
|
||||||
|
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(interaction.guild.iconURL())
|
||||||
|
await interaction.editReply({
|
||||||
|
embeds: [embed]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
async function nutsCooldown(interaction) {
|
||||||
|
const db = mClient.db(process.env.M_DB)
|
||||||
|
const nutsColl = db.collection('cooldown')
|
||||||
|
const cooldown = await nutsColl.findOne({ userID: interaction.user.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) {
|
||||||
|
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 interaction.editReply({
|
||||||
|
embeds: [embed]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
async function nutsNut(interaction) {
|
||||||
|
const db = mClient.db(process.env.M_DB)
|
||||||
|
const nutsColl = db.collection('nuts')
|
||||||
|
const cdColl = db.collection('cooldown')
|
||||||
|
|
||||||
|
const cdData = await cdColl.findOne({ userID: interaction.user.id })
|
||||||
|
|
||||||
|
let content
|
||||||
|
const images = {
|
||||||
|
"high": "https://as2.ftcdn.net/v2/jpg/02/24/65/39/1000_F_224653943_r3xltiwJsK6am0mGZE5DTWk1yocUwHLd.jpg",
|
||||||
|
"normal": 'https://c8.alamy.com/comp/PPPBXK/surprised-pecan-nuts-pile-on-plate-cartoon-PPPBXK.jpg',
|
||||||
|
"low": 'https://as2.ftcdn.net/v2/jpg/02/24/65/37/1000_F_224653769_ceJk0tq9UT1hSu5FIVUi7BeaN4ucSZGv.jpg',
|
||||||
|
"none": 'https://cdn4.vectorstock.com/i/1000x1000/87/08/afraid-pecan-nuts-pile-on-plate-cartoon-vector-22028708.jpg',
|
||||||
|
"onCD": 'https://cdn.discordapp.com/attachments/1152723542836772914/1152987472788193361/No-nuts-PhotoRoom.png-PhotoRoom.png'
|
||||||
|
}
|
||||||
|
let image
|
||||||
|
if (!cdData || cdData.cooldown < (Date.now() / 1000)) {
|
||||||
|
let cd = Math.floor((Date.now() + 3600000) / 1000)
|
||||||
|
await cdColl.findOneAndUpdate({
|
||||||
|
userID: interaction.user.id
|
||||||
|
}, {
|
||||||
|
$set: { cooldown: cd }
|
||||||
|
}, {
|
||||||
|
upsert: true
|
||||||
|
})
|
||||||
|
|
||||||
|
const amount = Math.floor(Math.random() * 10)
|
||||||
|
|
||||||
|
await nutsColl.findOneAndUpdate({
|
||||||
|
userID: interaction.user.id
|
||||||
|
}, {
|
||||||
|
$inc: { nuts: amount }
|
||||||
|
}, {
|
||||||
|
upsert: true
|
||||||
|
})
|
||||||
|
|
||||||
|
if (amount) {
|
||||||
|
content = `Du hast **${amount}** Nüsse bekommen!`
|
||||||
|
if (amount > 8) {
|
||||||
|
image = images["high"]
|
||||||
|
} else if (amount > 4) {
|
||||||
|
image = images["normal"]
|
||||||
|
} else {
|
||||||
|
image = images["low"]
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
content = `Du hast leider keine Nüsse bekommen :(`
|
||||||
|
image = images["none"]
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
content = `Du kannst erst <t:${Math.floor(cdData?.cooldown)}:R> wieder nussen :(`
|
||||||
|
image = images["onCD"]
|
||||||
|
}
|
||||||
|
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setThumbnail('https://cdn.discordapp.com/attachments/1152723542836772914/1152991361113538621/png-transparent-subscription-box-label-bag-mysterious-miscellaneous-purple-blue-thumbnail-PhotoRoom.png-PhotoRoom.png')
|
||||||
|
|
||||||
|
await interaction.editReply({
|
||||||
|
embeds: [embed]
|
||||||
|
})
|
||||||
|
await delay(1000)
|
||||||
|
embed.setThumbnail('https://i.pinimg.com/originals/9d/58/37/9d5837c6f0cb8b18be6ddd1e2742472a.gif')
|
||||||
|
await interaction.editReply({
|
||||||
|
embeds: [embed]
|
||||||
|
})
|
||||||
|
|
||||||
|
await delay(1000)
|
||||||
|
embed.setDescription(content)
|
||||||
|
embed.setThumbnail(image)
|
||||||
|
await interaction.editReply({
|
||||||
|
embeds: [embed]
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
module.exports = {
|
||||||
|
data: new SlashCommandBuilder()
|
||||||
|
.setName('nuts')
|
||||||
|
.setDescription('rund um die nuss')
|
||||||
|
.addSubcommand(s =>
|
||||||
|
s
|
||||||
|
.setName('give')
|
||||||
|
.setDescription('gib nuss!!')
|
||||||
|
.addUserOption(o => o.setName('target').setDescription('wer bekommt da nuts?').setRequired(true))
|
||||||
|
.addNumberOption(o => o.setName('amount').setDescription('wie viele?').setRequired(true)))
|
||||||
|
.addSubcommand(s =>
|
||||||
|
s
|
||||||
|
.setName('check')
|
||||||
|
.setDescription('check out deez nuts')
|
||||||
|
.addUserOption(o => o.setName('target').setDescription('check out those nuts!')))
|
||||||
|
.addSubcommand(s =>
|
||||||
|
s
|
||||||
|
.setName('leaderboard')
|
||||||
|
.setDescription('wer hat die dicksten Nüsse?'))
|
||||||
|
.addSubcommand(s =>
|
||||||
|
s
|
||||||
|
.setName('stats')
|
||||||
|
.setDescription('wie viele Nüsse wurden genusst, Genosse?'))
|
||||||
|
.addSubcommand(s =>
|
||||||
|
s
|
||||||
|
.setName('cooldown')
|
||||||
|
.setDescription('wie lange bis ich nussen kann?'))
|
||||||
|
.addSubcommand(s =>
|
||||||
|
s
|
||||||
|
.setName('nut')
|
||||||
|
.setDescription('willst du nuss?')),
|
||||||
|
async execute(interaction) {
|
||||||
|
switch (interaction.options._subcommand) {
|
||||||
|
case 'give':
|
||||||
|
nutsGive(interaction)
|
||||||
|
break;
|
||||||
|
case 'check':
|
||||||
|
await interaction.deferReply()
|
||||||
|
nutsCheck(interaction)
|
||||||
|
break;
|
||||||
|
case 'leaderboard':
|
||||||
|
await interaction.deferReply()
|
||||||
|
nutsLeaderboard(interaction)
|
||||||
|
break;
|
||||||
|
case 'stats':
|
||||||
|
await interaction.deferReply()
|
||||||
|
nutsStats(interaction)
|
||||||
|
break;
|
||||||
|
case 'cooldown':
|
||||||
|
await interaction.deferReply()
|
||||||
|
nutsCooldown(interaction)
|
||||||
|
break;
|
||||||
|
case 'nut':
|
||||||
|
await interaction.deferReply()
|
||||||
|
nutsNut(interaction)
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
/*
|
||||||
|
Add
|
||||||
|
Delete
|
||||||
|
Random
|
||||||
|
Random By Person
|
||||||
|
Direct Search by ID
|
||||||
|
|
||||||
|
Random By Year?
|
||||||
|
List?
|
||||||
|
Counter (Leaderboard?)
|
||||||
|
*/
|
||||||
|
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js')
|
||||||
|
const { mClient } = require('../..')
|
||||||
|
require('dotenv').config()
|
||||||
|
|
||||||
|
async function quotesAdd(interaction) {
|
||||||
|
const messageLink = await interaction.options.getString('link')
|
||||||
|
let temp = messageLink.split('/')
|
||||||
|
let messageID = temp[temp.length - 1]
|
||||||
|
let channelID = temp[temp.length - 2]
|
||||||
|
let guildID = temp[temp.length - 3]
|
||||||
|
|
||||||
|
const guild = await interaction.client.guilds.fetch(guildID)
|
||||||
|
const channel = await guild.channels.fetch(channelID)
|
||||||
|
const message = await channel.messages.fetch(messageID)
|
||||||
|
|
||||||
|
var msgData = {
|
||||||
|
content: message.content,
|
||||||
|
author: await message.author,
|
||||||
|
reference: await message.reference,
|
||||||
|
embed: await message.embeds ? 'embed' : null
|
||||||
|
} // debug
|
||||||
|
if (msgData.reference) {
|
||||||
|
let refMessage = await channel.messages.fetch(msgData.reference.messageId)
|
||||||
|
var refData = {
|
||||||
|
content: refMessage.content,
|
||||||
|
author: await refMessage.author,
|
||||||
|
embed: await refMessage.embeds ? 'embed' : null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const db = mClient.db(process.env.M_DB)
|
||||||
|
const quotesColl = db.collection('quotes')
|
||||||
|
const found = await quotesColl.findOne({ messageID: messageID })
|
||||||
|
if (found) { return await interaction.reply({ content: 'Quote Already in Database', ephemeral: true }) }
|
||||||
|
await quotesColl.findOneAndUpdate({ messageID: messageID }, {
|
||||||
|
$set: {
|
||||||
|
messageID: messageID,
|
||||||
|
channelID: channelID,
|
||||||
|
guildID: guildID
|
||||||
|
}
|
||||||
|
}, { upsert: true })
|
||||||
|
|
||||||
|
var description = ''
|
||||||
|
if (refData) {
|
||||||
|
description += `> ${refData.author}`
|
||||||
|
if (refData.embed) {
|
||||||
|
description += '*an embed / a command* '
|
||||||
|
}
|
||||||
|
description += `\r\n↳`
|
||||||
|
}
|
||||||
|
description += `${msgData.author} ${msgData.content}\r\n\r\n${messageLink}`
|
||||||
|
let timestamp = new Date(message.createdTimestamp)
|
||||||
|
let footer = timestamp.toDateString().toString()
|
||||||
|
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setThumbnail(msgData.author.displayAvatarURL())
|
||||||
|
.setURL(messageLink)
|
||||||
|
.setTitle(`Quote #${messageID} Added!`)
|
||||||
|
.setDescription(description)
|
||||||
|
.setFooter({ text: footer})
|
||||||
|
await interaction.reply({ embeds: [embed] })
|
||||||
|
}
|
||||||
|
async function quotesRemove(interaction) {
|
||||||
|
|
||||||
|
}
|
||||||
|
async function quotesSearch(interaction) {
|
||||||
|
|
||||||
|
}
|
||||||
|
async function quotesRandom(interaction) {
|
||||||
|
|
||||||
|
}
|
||||||
|
async function quotesLeaderboard(interaction) {
|
||||||
|
|
||||||
|
}
|
||||||
|
module.exports = {
|
||||||
|
data: new SlashCommandBuilder()
|
||||||
|
.setName('quotes')
|
||||||
|
.setDescription('quoten pfoten')
|
||||||
|
.addSubcommand(s =>
|
||||||
|
s
|
||||||
|
.setName('add')
|
||||||
|
.setDescription('add a new quote')
|
||||||
|
.addStringOption(o => o.setName('link').setDescription('insert message link').setRequired(true)))
|
||||||
|
.addSubcommand(s =>
|
||||||
|
s
|
||||||
|
.setName('remove')
|
||||||
|
.setDescription('remove a quote')
|
||||||
|
.addStringOption(o => o.setName('id').setDescription('insert message ID').setRequired(true)))
|
||||||
|
.addSubcommand(s =>
|
||||||
|
s
|
||||||
|
.setName('search')
|
||||||
|
.setDescription('search by ID')
|
||||||
|
.addStringOption(o => o.setName('id').setDescription('insert message ID').setRequired(true)))
|
||||||
|
.addSubcommand(s =>
|
||||||
|
s
|
||||||
|
.setName('random')
|
||||||
|
.setDescription('get a random quote')
|
||||||
|
.addUserOption(o => o.setName('target').setDescription('by user')))
|
||||||
|
.addSubcommand(s =>
|
||||||
|
s
|
||||||
|
.setName('leaderboard')
|
||||||
|
.setDescription('see the most used quotes')),
|
||||||
|
async execute(interaction) {
|
||||||
|
switch (interaction.options._subcommand) {
|
||||||
|
case 'add':
|
||||||
|
quotesAdd(interaction)
|
||||||
|
break;
|
||||||
|
case 'remove':
|
||||||
|
quotesRemove(interaction)
|
||||||
|
break;
|
||||||
|
case 'search':
|
||||||
|
quotesSearch(interaction)
|
||||||
|
break;
|
||||||
|
case 'random':
|
||||||
|
quotesRandom(interaction)
|
||||||
|
break;
|
||||||
|
case 'leaderboard':
|
||||||
|
quotesLeaderboard(interaction)
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
const { SlashCommandBuilder } = require('discord.js')
|
||||||
|
module.exports = {
|
||||||
|
data: new SlashCommandBuilder()
|
||||||
|
.setName('ping')
|
||||||
|
.setDescription('returns pong'),
|
||||||
|
async execute(interaction) {
|
||||||
|
await interaction.deferReply()
|
||||||
|
await interaction.editReply('pong!')
|
||||||
|
await interaction.followUp('another pong!')
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
const { Events, ActivityType } = require('discord.js')
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: Events.ClientReady,
|
||||||
|
once: true,
|
||||||
|
async execute(client) {
|
||||||
|
console.log(`Ready! Logged in as ${client.user.tag}`)
|
||||||
|
client.user.setPresence({
|
||||||
|
activities: [{
|
||||||
|
name: 'Red Dead Depression',
|
||||||
|
type: ActivityType.Streaming,
|
||||||
|
url: 'https://twitch.tv/desq_blocki'
|
||||||
|
}],
|
||||||
|
status: 'online'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
const { Events } = require('discord.js')
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: Events.InteractionCreate,
|
||||||
|
once: false,
|
||||||
|
async execute(interaction) {
|
||||||
|
if (interaction.isChatInputCommand()) { commandHandler(interaction) };
|
||||||
|
if (interaction.isButton()) { buttonHandler(interaction) }
|
||||||
|
if (interaction.isMentionableSelectMenu()) { selectMenuHandler(interaction)}
|
||||||
|
if (interaction.isUserSelectMenu()) { selectMenuHandler(interaction) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function commandHandler(interaction) {
|
||||||
|
const command = interaction.client.commands.get(interaction.commandName);
|
||||||
|
|
||||||
|
if (!command) {
|
||||||
|
console.error(`No command matching ${interaction.commandName} was found.`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await command.execute(interaction);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
if (interaction.replied || interaction.deferred) {
|
||||||
|
await interaction.followUp({ content: 'There was an error while executing this command!', ephemeral: true });
|
||||||
|
} else {
|
||||||
|
await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function buttonHandler(interaction) {
|
||||||
|
const button = interaction.client.buttons.get(interaction.customId)
|
||||||
|
if (!button) { return console.error(`No button registered matching ${interaction.customId}.`) }
|
||||||
|
try {
|
||||||
|
await button.execute(interaction);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
if (interaction.replied || interaction.deferred) {
|
||||||
|
await interaction.followUp({ content: 'There was an error while executing this command!', ephemeral: true });
|
||||||
|
} else {
|
||||||
|
await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function selectMenuHandler(interaction) {
|
||||||
|
const selectMenu = interaction.client.selectMenus.get(interaction.customId)
|
||||||
|
if (!selectMenu) { return console.error(`No Select Menu registered matching ${interaction.customId}.`) }
|
||||||
|
try {
|
||||||
|
await selectMenu.execute(interaction);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
if (interaction.replied || interaction.deferred) {
|
||||||
|
await interaction.followUp({ content: 'There was an error while executing this command!', ephemeral: true });
|
||||||
|
} else {
|
||||||
|
await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
const { Events } = require('discord.js')
|
||||||
|
require('dotenv').config()
|
||||||
|
const { client } = require('../index')
|
||||||
|
const prefix = process.env.D_Prefix
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: Events.MessageCreate,
|
||||||
|
once: false,
|
||||||
|
async execute(message) {
|
||||||
|
if (!message.content.startsWith(prefix) || message.author.bot) return;
|
||||||
|
|
||||||
|
const args = message.content.slice(prefix.length).trim().split(/ +/);
|
||||||
|
const cmd = args.shift().toLowerCase();
|
||||||
|
let command = client.legacyCommands.get(cmd)
|
||||||
|
if(!command) command = client.legacyCommands.get(client.aliases.get(cmd))
|
||||||
|
if(!command) return
|
||||||
|
try {
|
||||||
|
client.legacyCommands.get(command.name).execute(message, args)
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
const { Events, ClientVoiceManager } = require("discord.js");
|
||||||
|
const { getVoiceConnection } = require('@discordjs/voice')
|
||||||
|
require('dotenv').config()
|
||||||
|
const { client } = require('../index')
|
||||||
|
const users_in_afk = new Set();
|
||||||
|
const delay = ms => new Promise(res => setTimeout(res, ms));
|
||||||
|
var connected = false;
|
||||||
|
const playlist = `https://www.youtube.com/playlist?list=PLjSh2s1ASTgsSdjCgFbpo18RAYF_dHf46`
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: Events.VoiceStateUpdate,
|
||||||
|
once: false,
|
||||||
|
async execute(oldState, newState) {
|
||||||
|
const guild = client.guilds.cache.get(process.env.D_GuildID)
|
||||||
|
const afk_channel = await guild.channels.fetch(guild.afkChannelId)
|
||||||
|
const real_afk_channel = await guild.channels.fetch(process.env.D_RealTartarosID)
|
||||||
|
const user = await guild.members.fetch(newState.id)
|
||||||
|
|
||||||
|
if(user.id === process.env.D_ID) return;
|
||||||
|
|
||||||
|
// if someone enters the official AFK channel, move them to one where we can play music
|
||||||
|
if (newState.channelId === afk_channel.id) {
|
||||||
|
await delay(1000)
|
||||||
|
|
||||||
|
await user.voice.setChannel(real_afk_channel)
|
||||||
|
users_in_afk.add(newState.id)
|
||||||
|
console.log(`${users_in_afk.size} User(s) in Channel`)
|
||||||
|
|
||||||
|
if (!connected) {
|
||||||
|
connected = true;
|
||||||
|
await client.distube.voices.join(real_afk_channel)
|
||||||
|
await client.distube.play(real_afk_channel, "https://www.youtube.com/watch?v=dQw4w9WgXcQ")
|
||||||
|
const queue = client.distube.getQueue(guild)
|
||||||
|
await queue.setRepeatMode('Queue')
|
||||||
|
await queue.setVolume(40)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if someone leaves the real AFK channel, remove them from cache but wait for rejoiners, then leave if none are here
|
||||||
|
if (oldState.channelId === real_afk_channel.id && oldState.channelId != newState.channelId) {
|
||||||
|
users_in_afk.delete(oldState.id)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (users_in_afk.size === 0) {
|
||||||
|
//leave if empty
|
||||||
|
await client.distube.voices.leave(real_afk_channel)
|
||||||
|
connected = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
const fs = require('node:fs')
|
||||||
|
const path = require('node:path')
|
||||||
|
module.exports = (client) => {
|
||||||
|
const buttonsFoldersPath = path.join(__dirname, '../buttons');
|
||||||
|
const buttonsFolders = fs.readdirSync(buttonsFoldersPath);
|
||||||
|
let buttonCount = 0
|
||||||
|
for (const folder of buttonsFolders) {
|
||||||
|
const buttonsPath = path.join(buttonsFoldersPath, folder);
|
||||||
|
const buttonsFiles = fs.readdirSync(buttonsPath).filter(file => file.endsWith('.js'));
|
||||||
|
for (const file of buttonsFiles) {
|
||||||
|
buttonCount++
|
||||||
|
const filePath = path.join(buttonsPath, file);
|
||||||
|
const button = require(filePath);
|
||||||
|
if ('execute' in button) {
|
||||||
|
client.buttons.set(button.name, button);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(`[${buttonCount}] Button(s) initialized`)
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
// ich hab das einfach _commands genannt, damit es beim Startup als erstes initialisiert wird.
|
||||||
|
const { REST, Routes } = require('discord.js')
|
||||||
|
const fs = require('node:fs')
|
||||||
|
const path = require('node:path')
|
||||||
|
|
||||||
|
module.exports = (client) => {
|
||||||
|
let commands = [] // only used for REST API
|
||||||
|
const foldersPath = path.join(__dirname, '../commands');
|
||||||
|
const commandFolders = fs.readdirSync(foldersPath);
|
||||||
|
for (const folder of commandFolders) {
|
||||||
|
// Grab all the command files from the commands directory you created earlier
|
||||||
|
const commandsPath = path.join(foldersPath, folder);
|
||||||
|
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
|
||||||
|
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
|
||||||
|
for (const file of commandFiles) {
|
||||||
|
const filePath = path.join(commandsPath, file);
|
||||||
|
const command = require(filePath);
|
||||||
|
if ('data' in command && 'execute' in command) {
|
||||||
|
commands.push(command.data.toJSON());
|
||||||
|
client.commands.set(command.data.name, command);
|
||||||
|
} else {
|
||||||
|
console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const rest = new REST().setToken(process.env.D_Token);
|
||||||
|
(async () => {
|
||||||
|
try {
|
||||||
|
console.log(`Started refreshing ${commands.length} application (/) commands.`);
|
||||||
|
// The put method is used to fully refresh all commands in the guild with the current set
|
||||||
|
const data = await rest.put(
|
||||||
|
Routes.applicationGuildCommands(process.env.D_ID, process.env.D_GuildID),
|
||||||
|
{ body: commands },
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(`Successfully reloaded ${data.length} application (/) commands.`);
|
||||||
|
} catch (error) {
|
||||||
|
// And of course, make sure you catch and log any errors!
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
const fs = require('node:fs')
|
||||||
|
const path = require('node:path')
|
||||||
|
module.exports = (client) => {
|
||||||
|
const eventsPath = path.join(__dirname, '../events')
|
||||||
|
const eventFiles = fs.readdirSync(eventsPath).filter(file => file.endsWith('.js'))
|
||||||
|
|
||||||
|
for (const file of eventFiles) {
|
||||||
|
const filePath = path.join(eventsPath, file)
|
||||||
|
const event = require(filePath)
|
||||||
|
if (event.once) {
|
||||||
|
client.once(event.name, (...args) => event.execute(...args))
|
||||||
|
// added client to commomerate global usage
|
||||||
|
} else {
|
||||||
|
client.on(event.name, (...args) => event.execute(...args))
|
||||||
|
// added client to commomerate global usage
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
const fs = require('node:fs')
|
||||||
|
const path = require('node:path')
|
||||||
|
module.exports = (client) => {
|
||||||
|
const legacyFoldersPath = path.join(__dirname, '../legacyCommands');
|
||||||
|
const legacyCommandFolders = fs.readdirSync(legacyFoldersPath);
|
||||||
|
let legacyCount = 0
|
||||||
|
let aliasCount = 0
|
||||||
|
for (const folder of legacyCommandFolders) {
|
||||||
|
const commandsPath = path.join(legacyFoldersPath, folder);
|
||||||
|
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
|
||||||
|
for (const file of commandFiles) {
|
||||||
|
legacyCount++
|
||||||
|
const filePath = path.join(commandsPath, file);
|
||||||
|
const command = require(filePath);
|
||||||
|
if ('execute' in command) {
|
||||||
|
client.legacyCommands.set(command.name, command);
|
||||||
|
}
|
||||||
|
if (command.aliases && Array.isArray(command.aliases)) {
|
||||||
|
command.aliases.forEach(alias => {
|
||||||
|
aliasCount++
|
||||||
|
client.aliases.set(alias, command.name)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(`[${aliasCount}] Aliase(s) initialized`)
|
||||||
|
console.log(`[${legacyCount}] Legacy Command(s) initialized`)
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
const fs = require('node:fs')
|
||||||
|
const path = require('node:path')
|
||||||
|
module.exports = (client) => {
|
||||||
|
const selectMenusFoldersPath = path.join(__dirname, '../selectMenus');
|
||||||
|
const selectMenusFolders = fs.readdirSync(selectMenusFoldersPath);
|
||||||
|
let selectMenuCount = 0
|
||||||
|
for (const folder of selectMenusFolders) {
|
||||||
|
const Path = path.join(selectMenusFoldersPath, folder);
|
||||||
|
const Files = fs.readdirSync(Path).filter(file => file.endsWith('.js'));
|
||||||
|
for (const file of Files) {
|
||||||
|
selectMenuCount++
|
||||||
|
const filePath = path.join(Path, file);
|
||||||
|
const button = require(filePath);
|
||||||
|
if ('execute' in button) {
|
||||||
|
client.selectMenus.set(button.name, button);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(`[${selectMenuCount}] Select Menu(s) initialized`)
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
const { Client, GatewayIntentBits, Collection, Partials } = require('discord.js')
|
||||||
|
const { MongoClient } = require('mongodb')
|
||||||
|
const { DisTube } = require('distube');
|
||||||
|
const { YtDlpPlugin } = require('@distube/yt-dlp')
|
||||||
|
require('dotenv').config()
|
||||||
|
const mClient = new MongoClient(process.env.M_URI)
|
||||||
|
exports.mClient = mClient;
|
||||||
|
const fs = require('node:fs')
|
||||||
|
|
||||||
|
const client = new Client({
|
||||||
|
intents: [
|
||||||
|
GatewayIntentBits.Guilds,
|
||||||
|
GatewayIntentBits.GuildMessages,
|
||||||
|
GatewayIntentBits.GuildPresences,
|
||||||
|
GatewayIntentBits.GuildMessageReactions,
|
||||||
|
GatewayIntentBits.GuildVoiceStates,
|
||||||
|
GatewayIntentBits.DirectMessages,
|
||||||
|
GatewayIntentBits.MessageContent
|
||||||
|
],
|
||||||
|
partials: [Partials.Channel, Partials.Message, Partials.User, Partials.GuildMember, Partials.Reaction]
|
||||||
|
});
|
||||||
|
exports.client = client
|
||||||
|
|
||||||
|
client.commands = new Collection() // slash commands collection
|
||||||
|
client.legacyCommands = new Collection() // legacy commands collection
|
||||||
|
client.aliases = new Collection() // list of command aliases
|
||||||
|
client.buttons = new Collection() // list of buttons
|
||||||
|
client.selectMenus = new Collection() // list of selectMenus
|
||||||
|
|
||||||
|
const distube = new DisTube(client, {
|
||||||
|
plugins: [new YtDlpPlugin({ update: true })],
|
||||||
|
});
|
||||||
|
|
||||||
|
client.distube = distube
|
||||||
|
|
||||||
|
fs.readdirSync('./handlers').forEach((handler) => {
|
||||||
|
require(`./handlers/${handler}`)(client)
|
||||||
|
});
|
||||||
|
|
||||||
|
client.login(process.env.D_Token)
|
||||||
@@ -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('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]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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('cooldown')
|
||||||
|
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) {
|
||||||
|
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]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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('nuts')
|
||||||
|
const cdColl = db.collection('cooldown')
|
||||||
|
|
||||||
|
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 :(`,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
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: '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('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!',
|
||||||
|
ephemeral: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
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] })
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
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('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('https://cdn.discordapp.com/attachments/1152723542836772914/1152940755539722240/pngwing.com.png')
|
||||||
|
.setDescription(fields.toString());
|
||||||
|
await message.reply({
|
||||||
|
embeds: [embed],
|
||||||
|
components: [row]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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('nut-stats')
|
||||||
|
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]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
const { ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js')
|
||||||
|
module.exports = {
|
||||||
|
name: 'interactive',
|
||||||
|
description: 'testing interactive buttons',
|
||||||
|
async execute(message, args) {
|
||||||
|
const row = new ActionRowBuilder()
|
||||||
|
.addComponents(
|
||||||
|
new ButtonBuilder()
|
||||||
|
.setLabel('Test')
|
||||||
|
.setStyle(ButtonStyle.Primary)
|
||||||
|
.setCustomId('test_button_1')
|
||||||
|
)
|
||||||
|
|
||||||
|
await message.reply({ content: 'Here is an interactive button:', components: [row] });
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
module.exports = {
|
||||||
|
name: 'ping',
|
||||||
|
description: 'returns pong!',
|
||||||
|
aliases: [''],
|
||||||
|
async execute(message, args) {
|
||||||
|
message.reply('pong!')
|
||||||
|
}
|
||||||
|
}
|
||||||
Generated
+1475
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"name": "arthonor-3",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "discord companion",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/DeSqBlocki/Arthonor-3.git"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"discord"
|
||||||
|
],
|
||||||
|
"author": "DeSqBlocki",
|
||||||
|
"license": "ISC",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/DeSqBlocki/Arthonor-3/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/DeSqBlocki/Arthonor-3#readme",
|
||||||
|
"dependencies": {
|
||||||
|
"@discordjs/voice": "^0.17.0",
|
||||||
|
"@distube/yt-dlp": "^2.0.1",
|
||||||
|
"discord.js": "^14.15.3",
|
||||||
|
"distube": "^5.0.2",
|
||||||
|
"dotenv": "^16.4.5",
|
||||||
|
"mongodb": "^6.8.0",
|
||||||
|
"node-pre-gyp": "^0.17.0",
|
||||||
|
"nodemon": "^3.1.4",
|
||||||
|
"rebuild": "^0.1.2",
|
||||||
|
"sodium-native": "^4.1.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
const { EmbedBuilder, ActionRowBuilder, MentionableSelectMenuBuilder, UserSelectMenuBuilder, PermissionFlagsBits } = require("discord.js")
|
||||||
|
const { mClient } = require("../..")
|
||||||
|
require('dotenv').config()
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: 'honor_menu_mentionable',
|
||||||
|
description: 'handles honor menu mentionables',
|
||||||
|
async execute(interaction) {
|
||||||
|
const embedData = await interaction.message.embeds[0].data
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
if (!interaction.members) {
|
||||||
|
embed.setTitle(embedData.title)
|
||||||
|
.setThumbnail(embedData.thumbnail.url)
|
||||||
|
.setDescription(embedData.description);
|
||||||
|
} else {
|
||||||
|
var target = await interaction.guild.members.fetch(interaction.members.keys().next().value)
|
||||||
|
var db = mClient.db(process.env.M_DB)
|
||||||
|
var honorsColl = db.collection('honors')
|
||||||
|
var theirHonorLevel = await honorsColl.findOne({ userID: target.id })
|
||||||
|
|
||||||
|
const member = interaction.message.guild.members.cache.get(target.user.id)
|
||||||
|
const memberRoles = member.roles.cache
|
||||||
|
.filter((roles) => roles.id !== interaction.message.guild.id)
|
||||||
|
.map((role) => role.toString())
|
||||||
|
// var userHas = member.permissions.toArray() // Scratched Idea for Menu
|
||||||
|
|
||||||
|
const description = String(`${target} - ${target.user.globalName ?? target.user.username} - ${target.user.id}\r\n\r\n${memberRoles}`).replaceAll(',', ' ')
|
||||||
|
embed.setTitle(`- User Stats -`)
|
||||||
|
.setDescription(description)
|
||||||
|
.addFields({
|
||||||
|
name: 'Current Honor Level:', value: `${theirHonorLevel?.honors ?? 0}`, inline: true
|
||||||
|
})
|
||||||
|
.setFooter({text: 'Honor Level updaten sich nicht automatisch!'})
|
||||||
|
}
|
||||||
|
const select = new ActionRowBuilder()
|
||||||
|
.addComponents(
|
||||||
|
new UserSelectMenuBuilder()
|
||||||
|
.setCustomId('honor_menu_mentionable')
|
||||||
|
.setPlaceholder('Select a User')
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const row = interaction.message.components[1]
|
||||||
|
await interaction.update({
|
||||||
|
embeds: [embed],
|
||||||
|
components: [select, row]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user