Compare commits
17 Commits
f1f9d95685
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| bb90ca792c | |||
| 0c84c85b62 | |||
| 0218583d24 | |||
| e2cc63e6c9 | |||
| ad32efb156 | |||
| 466b9708cf | |||
| f41f848ad5 | |||
| 2c596fe23f | |||
| 83c204670d | |||
| d8200e46df | |||
| 9d56ee5d34 | |||
| e2e764c295 | |||
| 6533510481 | |||
| 664224b14e | |||
| e59a863a8d | |||
| 2691653132 | |||
| 5e8fb7e729 |
@@ -0,0 +1,6 @@
|
||||
D_ID=
|
||||
D_Token=
|
||||
D_Prefix=
|
||||
D_GuildID=
|
||||
M_URI=
|
||||
M_DB=
|
||||
@@ -1,5 +1,2 @@
|
||||
.env
|
||||
node_modules
|
||||
To-Do
|
||||
cookies
|
||||
findMessages.js
|
||||
@@ -0,0 +1,59 @@
|
||||
# Arthonor-Neo
|
||||
|
||||
**Moderately Advanced Discord Bot for Friends**
|
||||
|
||||
Arthonor-Neo is a custom Discord bot designed for community interaction and fun. It offers an assortment of commands for economy, social engagement, and server utilities. Suitable for small to medium-sized friend servers.
|
||||
|
||||
---
|
||||
|
||||
## Features
|
||||
|
||||
### Core Interactions
|
||||
- Nut Economy – Earn and spend nuts in server activities
|
||||
- Honor System – Show recognition and respect to users
|
||||
- Quotes – Save and retrieve memorable quotes
|
||||
|
||||
### Community & Events
|
||||
- Automatic Welcome Messages – Greet new members
|
||||
- Birthday System – Track and celebrate birthdays
|
||||
- Automatic Birthday Cards – Personalized greetings on birthdays
|
||||
- Wednesday Frog – Midweek server event
|
||||
- Friday Reminder (Coming Soon)
|
||||
|
||||
---
|
||||
|
||||
## Differences from Version 2.x
|
||||
|
||||
### Legacy Commands (Chat Messages)
|
||||
These have been mostly removed with certain exceptions:
|
||||
|
||||
- Quoteadd has been kept due to the technicaly incompabiltity of replying using slash commands.
|
||||
- Nuts has been kept due to frequent usage
|
||||
|
||||
### Removed
|
||||
- Timers
|
||||
- WGE
|
||||
- Weather commands
|
||||
- GIF commands
|
||||
- Certain developer tools
|
||||
- WOKCommands Core
|
||||
|
||||
### Upgraded to Slash Commands
|
||||
- Nuts
|
||||
- Quotes
|
||||
- Honor
|
||||
- Birthdays
|
||||
- Role Selection
|
||||
- Channel Selection
|
||||
- Meme Commands
|
||||
|
||||
### New and Improved
|
||||
- Interactive Honor Menu
|
||||
- Interactive Quote Menu
|
||||
|
||||
### Database Migration
|
||||
Some structurual changes to the command schema, and removal of predefined schematics
|
||||
|
||||
- Tables renamed with prefixes, e.g. items_, config_, stats_, etc.
|
||||
- Split tables into a relation-ish style
|
||||
- made some data more machine-friendly
|
||||
@@ -1,31 +1,3 @@
|
||||
# Changelog:
|
||||
|
||||
## Nuts:
|
||||
- Nut Stats refactored
|
||||
- Nut Animation fixed
|
||||
|
||||
## Quotes:
|
||||
- Fixed Quote Menu
|
||||
|
||||
## Honors:
|
||||
- Honor Menu fixed
|
||||
- Honors modernized
|
||||
|
||||
## Birthday:
|
||||
- Fixed Boot Event
|
||||
- Fixed Role Management
|
||||
|
||||
## Config:
|
||||
- Role Selection
|
||||
- Channel Selection
|
||||
|
||||
### ToDo:
|
||||
- quotes leaderboard (count)
|
||||
### ToDo?:
|
||||
- quotes filter by channel
|
||||
- event creation + reminder 1h before
|
||||
- 8ball (neue Antworten)
|
||||
- avatar
|
||||
- mittwoch
|
||||
- wetter
|
||||
- WGE (help)
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 242 KiB |
|
After Width: | Height: | Size: 914 KiB |
|
After Width: | Height: | Size: 102 KiB |
|
After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 411 KiB |
|
After Width: | Height: | Size: 371 KiB |
|
Before Width: | Height: | Size: 254 KiB After Width: | Height: | Size: 254 KiB |
|
After Width: | Height: | Size: 176 KiB |
|
After Width: | Height: | Size: 167 KiB |
|
After Width: | Height: | Size: 158 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 68 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 158 KiB After Width: | Height: | Size: 158 KiB |
|
Before Width: | Height: | Size: 536 KiB After Width: | Height: | Size: 536 KiB |
@@ -23,7 +23,7 @@ module.exports = {
|
||||
})
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('Honors Leaderboard')
|
||||
.setThumbnail('https://cdn.discordapp.com/attachments/1152723542836772914/1152940755539722240/pngwing.com.png')
|
||||
.setThumbnail(guild.iconURL({ dynamic: true}))
|
||||
.setDescription(fields.toString())
|
||||
.setColor('#5865F2') // Discord's blurple color
|
||||
.setFooter({ text: 'Use ◄ ► to navigate' });
|
||||
|
||||
@@ -21,7 +21,7 @@ module.exports = {
|
||||
})
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('Honors Leaderboard')
|
||||
.setThumbnail('https://cdn.discordapp.com/attachments/1152723542836772914/1152940755539722240/pngwing.com.png')
|
||||
.setThumbnail(guild.iconURL({ dynamic: true}))
|
||||
.setDescription(fields.toString())
|
||||
.setColor('#5865F2') // Discord's blurple color
|
||||
.setFooter({ text: 'Use ◄ ► to navigate' });
|
||||
|
||||
@@ -31,7 +31,7 @@ module.exports = {
|
||||
})
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('Honors Leaderboard')
|
||||
.setThumbnail('https://cdn.discordapp.com/attachments/1152723542836772914/1152940755539722240/pngwing.com.png')
|
||||
.setThumbnail(guild.iconURL({ dynamic: true}))
|
||||
.setDescription(fields.toString())
|
||||
.setColor('#5865F2') // Discord's blurple color
|
||||
.setFooter({ text: 'Use ◄ ► to navigate' });
|
||||
|
||||
@@ -23,7 +23,7 @@ module.exports = {
|
||||
})
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('Nuts Leaderboard')
|
||||
.setThumbnail('https://cdn.discordapp.com/attachments/1152723542836772914/1152940755539722240/pngwing.com.png')
|
||||
.setThumbnail(guild.iconURL({ dynamic: true}))
|
||||
.setDescription(fields.toString())
|
||||
.setColor('#5865F2') // Discord's blurple color
|
||||
.setFooter({ text: 'Use ◄ ► to navigate' });
|
||||
|
||||
@@ -21,7 +21,7 @@ module.exports = {
|
||||
})
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('Nuts Leaderboard')
|
||||
.setThumbnail('https://cdn.discordapp.com/attachments/1152723542836772914/1152940755539722240/pngwing.com.png')
|
||||
.setThumbnail(guild.iconURL({ dynamic: true}))
|
||||
.setDescription(fields.toString())
|
||||
.setColor('#5865F2') // Discord's blurple color
|
||||
.setFooter({ text: 'Use ◄ ► to navigate' });
|
||||
|
||||
@@ -31,7 +31,7 @@ module.exports = {
|
||||
})
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('Nuts Leaderboard')
|
||||
.setThumbnail('https://cdn.discordapp.com/attachments/1152723542836772914/1152940755539722240/pngwing.com.png')
|
||||
.setThumbnail(guild.iconURL({ dynamic: true}))
|
||||
.setDescription(fields.toString())
|
||||
.setColor('#5865F2') // Discord's blurple color
|
||||
.setFooter({ text: 'Use ◄ ► to navigate' });
|
||||
|
||||
@@ -1,70 +1,19 @@
|
||||
const { EmbedBuilder, ButtonBuilder, ButtonStyle, ActionRowBuilder } = require('discord.js');
|
||||
const { mClient } = require('../..'); // Adjust the path as needed
|
||||
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
|
||||
const { quotesLeaderboard } = require("../../commands/slash/applications/quotes");
|
||||
|
||||
module.exports = {
|
||||
name: 'quotes_leaderboard_right',
|
||||
description: 'Navigate right through the quotes leaderboard',
|
||||
name: 'quotes_leaderboard_left',
|
||||
description: 'Navigate left through the quotes leaderboard',
|
||||
async execute(interaction) {
|
||||
await interaction.deferReply()
|
||||
const db = mClient.db(process.env.M_DB)
|
||||
const quotesColl = db.collection('items_quotes')
|
||||
const maxValue = await quotesColl.countDocuments({ $and: [{ guildID: interaction.guild.id }, { count: { $gt: 0 } }] })
|
||||
await interaction.deferReply();
|
||||
|
||||
let skip = interaction.message.embeds[0].data.fields[0].value.split('.')
|
||||
skip = Number(skip[0]) - 6
|
||||
if (skip >= (maxValue - (maxValue % 5))) {
|
||||
skip = maxValue - (maxValue % 5)
|
||||
}
|
||||
// Parse current page from footer
|
||||
let page = 1;
|
||||
const footerText = interaction.message.embeds[0]?.footer?.text || '';
|
||||
const match = footerText.match(/Page (\d+) of (\d+)/);
|
||||
if (match) page = Number(match[1]);
|
||||
|
||||
const quotesData = await quotesColl.find({ count: { $gt: 0 } }).sort({ count: -1, messageID: -1 }).skip(skip).limit(5).toArray()
|
||||
const fields = []
|
||||
page--; // move to previous page
|
||||
|
||||
const guild = await interaction.client.guilds.fetch(interaction.guild.id)
|
||||
quotesData.forEach(async (data, index) => {
|
||||
|
||||
let channel = await guild.channels.fetch(data.channelID)
|
||||
let message = await channel.messages.fetch(data.messageID)
|
||||
await delay(500)
|
||||
fields.push({
|
||||
name: `\u200b`,
|
||||
value: `${skip + index + 1}. [#${data.messageID}](https://discord.com/channels/${data.guildID}/${data.channelID}/${data.messageID})\r\n**by** <@${data.by}> • ⭐ ${data.count}\r\n${message.content}`
|
||||
})
|
||||
})
|
||||
|
||||
await delay(5000)
|
||||
console.log(fields)
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('- Quotes Leaderboard -')
|
||||
.setThumbnail('https://cdn.discordapp.com/attachments/1152723542836772914/1152940755539722240/pngwing.com.png')
|
||||
.setFields(fields)
|
||||
.setColor('#5865F2') // Discord's blurple color
|
||||
.setFooter({ text: 'Use ◄ ► to navigate' });
|
||||
|
||||
const row = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setLabel('◄')
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
.setCustomId('quotes_leaderboard_left')
|
||||
.setDisabled(skip - 6 < 0)
|
||||
)
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setLabel('X')
|
||||
.setStyle(ButtonStyle.Danger)
|
||||
.setCustomId('abort')
|
||||
)
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setLabel('►')
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
.setCustomId('quotes_leaderboard_right')
|
||||
.setDisabled(skip + 4 > maxValue)
|
||||
)
|
||||
await interaction.editReply({
|
||||
embeds: [embed],
|
||||
components: [row]
|
||||
})
|
||||
await quotesLeaderboard(interaction, page);
|
||||
}
|
||||
};
|
||||
@@ -1,70 +1,19 @@
|
||||
const { EmbedBuilder, ButtonBuilder, ButtonStyle, ActionRowBuilder } = require('discord.js');
|
||||
const { mClient } = require('../..'); // Adjust the path as needed
|
||||
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
|
||||
const { quotesLeaderboard } = require("../../commands/slash/applications/quotes");
|
||||
|
||||
module.exports = {
|
||||
name: 'quotes_leaderboard_right',
|
||||
description: 'Navigate right through the quotes leaderboard',
|
||||
async execute(interaction) {
|
||||
await interaction.deferReply()
|
||||
const db = mClient.db(process.env.M_DB)
|
||||
const quotesColl = db.collection('items_quotes')
|
||||
const maxValue = await quotesColl.countDocuments({ $and: [{ guildID: interaction.guild.id }, { count: { $gt: 0 } }] })
|
||||
await interaction.deferReply();
|
||||
|
||||
let skip = interaction.message.embeds[0].data.fields[0].value.split('.')
|
||||
skip = Number(skip[0]) +4
|
||||
if (skip >= (maxValue - (maxValue % 5))) {
|
||||
skip = maxValue - (maxValue % 5)
|
||||
}
|
||||
// Parse current page from footer
|
||||
let page = 1;
|
||||
const footerText = interaction.message.embeds[0]?.footer?.text || '';
|
||||
const match = footerText.match(/Page (\d+) of (\d+)/);
|
||||
if (match) page = Number(match[1]);
|
||||
|
||||
const quotesData = await quotesColl.find({ count: { $gt: 0 } }).sort({ count: -1, messageID: -1 }).skip(skip).limit(5).toArray()
|
||||
const fields = []
|
||||
page++; // move to next page
|
||||
|
||||
const guild = await interaction.client.guilds.fetch(interaction.guild.id)
|
||||
quotesData.forEach(async (data, index) => {
|
||||
|
||||
let channel = await guild.channels.fetch(data.channelID)
|
||||
let message = await channel.messages.fetch(data.messageID)
|
||||
await delay(500)
|
||||
fields.push({
|
||||
name: `\u200b`,
|
||||
value: `${skip + index + 1}. [#${data.messageID}](https://discord.com/channels/${data.guildID}/${data.channelID}/${data.messageID})\r\n**by** <@${data.by}> • ⭐ ${data.count}\r\n${message.content}`
|
||||
})
|
||||
})
|
||||
|
||||
await delay(5000)
|
||||
console.log(fields)
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('- Quotes Leaderboard -')
|
||||
.setThumbnail('https://cdn.discordapp.com/attachments/1152723542836772914/1152940755539722240/pngwing.com.png')
|
||||
.setFields(fields)
|
||||
.setColor('#5865F2') // Discord's blurple color
|
||||
.setFooter({ text: 'Use ◄ ► to navigate' });
|
||||
|
||||
const row = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setLabel('◄')
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
.setCustomId('quotes_leaderboard_left')
|
||||
.setDisabled(skip - 6 < 0)
|
||||
)
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setLabel('X')
|
||||
.setStyle(ButtonStyle.Danger)
|
||||
.setCustomId('abort')
|
||||
)
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setLabel('►')
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
.setCustomId('quotes_leaderboard_right')
|
||||
.setDisabled(skip + 4 > maxValue)
|
||||
)
|
||||
await interaction.editReply({
|
||||
embeds: [embed],
|
||||
components: [row]
|
||||
})
|
||||
await quotesLeaderboard(interaction, page);
|
||||
}
|
||||
};
|
||||
@@ -15,7 +15,7 @@ module.exports = {
|
||||
|
||||
const db = mClient.db(process.env.M_DB)
|
||||
const quotesColl = db.collection('items_quotes')
|
||||
const quotes = await quotesColl.find({ by: target.id }).toArray()
|
||||
const quotes = await quotesColl.find({ userID: target.id }).toArray()
|
||||
|
||||
var index = Number((await interaction.message.embeds[0].data.title).split(' ')[2].slice(1))
|
||||
if (!index) { index = 0 }
|
||||
@@ -64,7 +64,7 @@ module.exports = {
|
||||
.setURL(messageLink)
|
||||
.setTitle(`- Quote #${index + 1} -`)
|
||||
.setDescription(description)
|
||||
.setFooter({ text: (`${footer} #${found.messageID} <@${found.by}>`) })
|
||||
.setFooter({ text: (`${footer} #${found.messageID} <@${found.userID}>`) })
|
||||
const select = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new UserSelectMenuBuilder()
|
||||
|
||||
@@ -15,7 +15,7 @@ module.exports = {
|
||||
|
||||
const db = mClient.db(process.env.M_DB)
|
||||
const quotesColl = db.collection('items_quotes')
|
||||
const quotes = await quotesColl.find({ by: target.id }).toArray()
|
||||
const quotes = await quotesColl.find({ userID: target.id }).toArray()
|
||||
|
||||
var index = Number((await interaction.message.embeds[0].data.title).split(' ')[2].slice(1))
|
||||
if (!index) { index = 0 }
|
||||
@@ -64,7 +64,7 @@ module.exports = {
|
||||
.setURL(messageLink)
|
||||
.setTitle(`- Quote #${index + 1} -`)
|
||||
.setDescription(description)
|
||||
.setFooter({ text: (`${footer} #${found.messageID} <@${found.by}>`) })
|
||||
.setFooter({ text: (`${footer} #${found.messageID} <@${found.userID}>`) })
|
||||
const select = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new UserSelectMenuBuilder()
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
const ping = require("../../../src/ping")
|
||||
|
||||
module.exports = {
|
||||
name: 'ping',
|
||||
description: 'dev tool',
|
||||
aliases: ['p'],
|
||||
async execute(message, args) {
|
||||
return ping(message, args, 'legacy')
|
||||
}}
|
||||
@@ -1,5 +1,5 @@
|
||||
const { EmbedBuilder } = require('discord.js')
|
||||
const { mClient } = require('../../index')
|
||||
const { mClient } = require('../../../index')
|
||||
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
|
||||
require('dotenv').config()
|
||||
module.exports = {
|
||||
@@ -1,5 +1,5 @@
|
||||
const { EmbedBuilder } = require('discord.js')
|
||||
const { mClient } = require('../../index')
|
||||
const { mClient } = require('../../../index')
|
||||
require('dotenv').config()
|
||||
module.exports = {
|
||||
name: 'nutsCooldown',
|
||||
@@ -0,0 +1,61 @@
|
||||
const { mClient } = require('../../../index')
|
||||
require('dotenv').config()
|
||||
module.exports = {
|
||||
name: 'nuts',
|
||||
description: 'get nuts',
|
||||
aliases: ['n', 'nget', 'nutsget'],
|
||||
async execute(message, args) {
|
||||
const db = mClient.db(process.env.M_DB)
|
||||
const nutsColl = db.collection('items_nuts')
|
||||
const nutsStatsColl = db.collection('stats_nuts')
|
||||
const cdColl = db.collection('items_cooldowns')
|
||||
const cdData = await cdColl.findOne({ userID: message.author.id })
|
||||
|
||||
if (cdData?.cooldown > (Date.now() / 1000)) {
|
||||
return await message.reply({
|
||||
content: `Du kannst erst <t:${Math.floor(cdData?.cooldown)}:R> wieder nussen :(`,
|
||||
})
|
||||
}
|
||||
|
||||
let cd = Math.floor((Date.now() + 3600000) / 1000)
|
||||
await cdColl.findOneAndUpdate({
|
||||
userID: message.author.id
|
||||
}, {
|
||||
$set: {
|
||||
cooldown: cd,
|
||||
application: 'nuts'
|
||||
}
|
||||
}, {
|
||||
upsert: true
|
||||
})
|
||||
|
||||
const amount = Math.floor(Math.random() * 10)
|
||||
|
||||
await nutsColl.findOneAndUpdate({
|
||||
userID: message.author.id
|
||||
}, {
|
||||
$inc: { nuts: amount }
|
||||
}, {
|
||||
upsert: true
|
||||
})
|
||||
|
||||
await nutsStatsColl.findOneAndUpdate(
|
||||
{ userID: message.author.id },
|
||||
{ $inc: { [`stat.${amount}`]: 1 } },
|
||||
{ upsert: true }
|
||||
)
|
||||
|
||||
await nutsStatsColl.findOneAndUpdate(
|
||||
{ userID: "__global" },
|
||||
{ $inc: { [`stat.${amount}`]: 1 } },
|
||||
{ upsert: true }
|
||||
)
|
||||
let content = `Du hast ${amount} Nüsse bekommen! :chestnut:`
|
||||
if (!amount) {
|
||||
content = `Du hast leider keine Nüsse bekommen :(`
|
||||
}
|
||||
return await message.reply({
|
||||
content: content
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
const { EmbedBuilder, MessageFlags } = require('discord.js')
|
||||
const { mClient } = require('../../index')
|
||||
const { EmbedBuilder } = require('discord.js')
|
||||
const { mClient } = require('../../../index')
|
||||
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
|
||||
require('dotenv').config()
|
||||
module.exports = {
|
||||
@@ -58,7 +58,7 @@ module.exports = {
|
||||
if (yourBalance.nuts < amount) {
|
||||
return await message.reply({
|
||||
content: 'Du kannst nicht mehr geben als du hast!',
|
||||
flags: MessageFlags.Ephemeral
|
||||
ephemeral: true
|
||||
})
|
||||
}
|
||||
var content = `Du sendest **${amount}** Nüsse an <@${target.id}>`
|
||||
@@ -1,5 +1,5 @@
|
||||
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js')
|
||||
const { mClient } = require('../../index')
|
||||
const { mClient } = require('../../../index')
|
||||
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
|
||||
require('dotenv').config()
|
||||
module.exports = {
|
||||
@@ -37,7 +37,7 @@ module.exports = {
|
||||
})
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('Nuts Leaderboard')
|
||||
.setThumbnail('https://cdn.discordapp.com/attachments/1152723542836772914/1152940755539722240/pngwing.com.png')
|
||||
.setThumbnail(guild.iconURL({ dynamic: true}))
|
||||
.setDescription(fields.toString())
|
||||
.setColor('#5865F2') // Discord's blurple color
|
||||
.setFooter({ text: 'Use ◄ ► to navigate' });
|
||||
@@ -0,0 +1,76 @@
|
||||
const { EmbedBuilder, MessageFlags } = require("discord.js")
|
||||
const { client, mClient } = require("../../../index")
|
||||
|
||||
module.exports = {
|
||||
name: 'quotesadd',
|
||||
description: 'adds a quote to the database by replying to the message',
|
||||
category: 'Quotes',
|
||||
aliases: ['qadd', 'qa'],
|
||||
async execute(message, args) {
|
||||
const refMessage = message.reference // message to be quoted has been replied to
|
||||
const refMessageId = refMessage.messageId
|
||||
const refChannelId = refMessage.channelId
|
||||
const refGuildId = refMessage.guildId
|
||||
var msgData = {}
|
||||
var refData = {}
|
||||
const quoteGuild = await client.guilds.fetch(refGuildId)
|
||||
const quoteChannel = await quoteGuild.channels.fetch(refChannelId)
|
||||
const quoteMessage = await quoteChannel.messages.fetch(refMessageId)
|
||||
|
||||
msgData = {
|
||||
content: quoteMessage.content,
|
||||
author: await quoteMessage.author,
|
||||
reference: await quoteMessage.reference,
|
||||
embed: await quoteMessage.embeds ? 'embed' : null
|
||||
} // debug
|
||||
if (msgData.reference) {
|
||||
const quoteRefGuild = await client.guilds.fetch(msgData.reference.guildId)
|
||||
const quoteRefChannel = await quoteRefGuild.channels.fetch(msgData.reference.channelId)
|
||||
const quoteRefMessage = await quoteRefChannel.messages.fetch(msgData.reference.messageId)
|
||||
|
||||
|
||||
refData = {
|
||||
content: quoteRefMessage.content,
|
||||
author: await quoteRefMessage.author,
|
||||
embed: await quoteRefMessage.embeds.length > 0 ? 'embed' : null
|
||||
}
|
||||
}
|
||||
|
||||
const db = mClient.db(process.env.M_DB)
|
||||
const quotesColl = db.collection('items_quotes')
|
||||
const found = await quotesColl.findOne({ messageID: quoteMessage.id })
|
||||
if (found) { return await message.reply({ content: 'Quote Already in Database', flags: MessageFlags.Ephemeral }) }
|
||||
await quotesColl.findOneAndUpdate({ messageID: quoteMessage.id }, {
|
||||
$set: {
|
||||
messageID: quoteMessage.id,
|
||||
channelID: quoteChannel.id,
|
||||
guildID: quoteGuild.id,
|
||||
userID: msgData.author.id,
|
||||
count: 0
|
||||
}
|
||||
}, { upsert: true })
|
||||
|
||||
var description = ''
|
||||
if (refData) {
|
||||
description += `> ${refData.author}`
|
||||
if (refData.embed) {
|
||||
description += '*an embed / a command* '
|
||||
} else {
|
||||
description += refData.content
|
||||
}
|
||||
description += `\r\n↳`
|
||||
}
|
||||
const messageLink = `https://discord.com/channels/${quoteGuild.id}/${quoteChannel.id}/${quoteMessage.id}/`
|
||||
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 Added! -`)
|
||||
.setDescription(description)
|
||||
.setFooter({ text: (footer + ' #' + quoteMessage.id) })
|
||||
await message.reply({ embeds: [embed] })
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
const { SlashCommandBuilder, EmbedBuilder, MessageFlags } = require('discord.js')
|
||||
const { mClient } = require('../..')
|
||||
const { mClient } = require('../../../index')
|
||||
const { configDotenv } = require('dotenv')
|
||||
configDotenv()
|
||||
|
||||
@@ -7,7 +7,7 @@ function isValidDate(day, month) {
|
||||
// Define the number of days in each month
|
||||
const daysInMonth = {
|
||||
1: 31, // January
|
||||
2: 28, // February (ignore leap years)
|
||||
2: 28, // February (fuck leap years, me an' the homies hate that)
|
||||
3: 31, // March
|
||||
4: 30, // April
|
||||
5: 31, // May
|
||||
@@ -32,8 +32,22 @@ function isValidDate(day, month) {
|
||||
|
||||
return true;
|
||||
}
|
||||
function getNextBirthdayTimestamp(day, month) {
|
||||
const now = new Date();
|
||||
now.setHours(0, 0, 0, 0);
|
||||
|
||||
async function birthdayAdd(interaction) {
|
||||
const currentYear = now.getFullYear();
|
||||
|
||||
let nextBirthday = new Date(currentYear, month - 1, day);
|
||||
|
||||
// If birthday already passed this year → next year
|
||||
if (nextBirthday < now) {
|
||||
nextBirthday.setFullYear(currentYear + 1);
|
||||
}
|
||||
|
||||
return Math.floor(nextBirthday.getTime() / 1000); // Unix timestamp
|
||||
}
|
||||
async function birthdaySet(interaction) {
|
||||
let target = await interaction.options.getUser('user')
|
||||
let day = await interaction.options.getNumber('day')
|
||||
let month = await interaction.options.getNumber('month')
|
||||
@@ -91,81 +105,39 @@ async function birthdayDelete(interaction) {
|
||||
return interaction.reply({ content: "There was an issue!" })
|
||||
}
|
||||
}
|
||||
async function birthdayEdit(interaction) {
|
||||
let target = await interaction.options.getUser('user')
|
||||
let day = await interaction.options.getNumber('day')
|
||||
let month = await interaction.options.getNumber('month')
|
||||
|
||||
|
||||
if (!isValidDate(day, month)) {
|
||||
return interaction.reply({ content: "Invalid Date", flags: MessageFlags.Ephemeral })
|
||||
}
|
||||
|
||||
const db = mClient.db(process.env.M_DB)
|
||||
const bdayColl = db.collection('items_birthdays')
|
||||
|
||||
const found = await bdayColl.findOne({ userID: target.id })
|
||||
if (!found) {
|
||||
return interaction.reply({ content: "Not yet in Database", flags: MessageFlags.Ephemeral })
|
||||
}
|
||||
|
||||
const data = {
|
||||
guildID: interaction.guild.id,
|
||||
userID: target.id,
|
||||
day: day,
|
||||
month: month
|
||||
}
|
||||
|
||||
const res = await bdayColl.findOneAndUpdate({ userID: target.id }, { $set: data }, { upsert: true })
|
||||
return interaction.reply({ content: "Birthday edited successfully!" })
|
||||
}
|
||||
async function isDateInPast(day, month) {
|
||||
const currentYear = new Date().getFullYear();
|
||||
const inputDate = new Date(currentYear, month - 1, day);
|
||||
const now = new Date();
|
||||
return inputDate < now;
|
||||
}
|
||||
async function makeTimestamp(day, month, year) {
|
||||
const date = new Date(year, month - 1, day);
|
||||
const unixTimestamp = Math.floor(date.getTime() / 1000);
|
||||
return unixTimestamp
|
||||
}
|
||||
function isToday(day, month) {
|
||||
const currentYear = new Date().getFullYear();
|
||||
const inputDate = new Date(currentYear, month - 1, day);
|
||||
const today = new Date();
|
||||
return (
|
||||
inputDate.getDate() === today.getDate() &&
|
||||
inputDate.getMonth() === today.getMonth() &&
|
||||
inputDate.getFullYear() === today.getFullYear()
|
||||
);
|
||||
}
|
||||
async function birthdayGet(interaction) {
|
||||
let target = await interaction.options.getUser('user')
|
||||
const db = mClient.db(process.env.M_DB)
|
||||
const bdayColl = db.collection('items_birthdays')
|
||||
const target = await interaction.options.getUser('user');
|
||||
const db = mClient.db(process.env.M_DB);
|
||||
const bdayColl = db.collection('items_birthdays');
|
||||
|
||||
const found = await bdayColl.findOne({ userID: target.id })
|
||||
const found = await bdayColl.findOne({ userID: target.id });
|
||||
if (!found) {
|
||||
return interaction.reply({ content: "Not in Database!", flags: MessageFlags.Ephemeral })
|
||||
return interaction.reply({
|
||||
content: "Date not in Database!",
|
||||
flags: MessageFlags.Ephemeral
|
||||
});
|
||||
}
|
||||
let unix
|
||||
if(isDateInPast(found.day,found.month)){
|
||||
let nextYear = new Date().getFullYear() + 1
|
||||
unix = await makeTimestamp(found.day,found.month, nextYear)
|
||||
|
||||
const now = new Date();
|
||||
const isToday =
|
||||
now.getDate() === found.day &&
|
||||
now.getMonth() === (found.month - 1);
|
||||
|
||||
let description;
|
||||
|
||||
if (isToday) {
|
||||
description = `IS TODAY! 🥳🎉`;
|
||||
} else {
|
||||
let thisYear = new Date().getFullYear()
|
||||
unix = await makeTimestamp(found.day,found.month, thisYear)
|
||||
}
|
||||
let description = `is on the <t:${unix}:d>\r\n<t:${unix}:R>`
|
||||
if(isToday(found.day, found.month)){
|
||||
description = `IS TODAY!🥳🎉`
|
||||
const unix = getNextBirthdayTimestamp(found.day, found.month);
|
||||
description = `is on the <t:${unix}:d>\n<t:${unix}:R>`;
|
||||
}
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setThumbnail(target.displayAvatarURL())
|
||||
.setTitle(`${target.globalName ? target.globalName: target.username}'s Birthday!`)
|
||||
.setDescription(description)
|
||||
await interaction.reply({ embeds: [embed] })
|
||||
.setTitle(`${target.globalName ?? target.username}'s Birthday...`)
|
||||
.setDescription(description);
|
||||
|
||||
await interaction.reply({ embeds: [embed] });
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
@@ -174,8 +146,8 @@ module.exports = {
|
||||
.setDescription('manage birthdays')
|
||||
.addSubcommand(s =>
|
||||
s
|
||||
.setName('add')
|
||||
.setDescription('adds a birthday')
|
||||
.setName('set')
|
||||
.setDescription('set date to birthday')
|
||||
.addUserOption((option) =>
|
||||
option
|
||||
.setName('user')
|
||||
@@ -204,16 +176,6 @@ module.exports = {
|
||||
option.setName('user').setDescription('user'))
|
||||
.addStringOption((option) =>
|
||||
option.setName('id').setDescription('ID')))
|
||||
.addSubcommand(s =>
|
||||
s
|
||||
.setName('edit')
|
||||
.setDescription('edits a birthday')
|
||||
.addUserOption((option) =>
|
||||
option.setName('user').setDescription('user').setRequired(true))
|
||||
.addNumberOption((option) =>
|
||||
option.setName('day').setDescription('day').setRequired(true))
|
||||
.addNumberOption((option) =>
|
||||
option.setName('month').setDescription('month').setRequired(true)))
|
||||
.addSubcommand(s =>
|
||||
s
|
||||
.setName('get')
|
||||
@@ -222,14 +184,14 @@ module.exports = {
|
||||
option.setName('user').setDescription('user').setRequired(true))),
|
||||
async execute(interaction) {
|
||||
switch (interaction.options._subcommand) {
|
||||
case 'add':
|
||||
case 'set':
|
||||
if (!interaction.member.permissions.has("ADMINISTRATOR")) {
|
||||
return await interaction.reply({
|
||||
content: "Unprivileged Access!",
|
||||
flags: MessageFlags.Ephemeral
|
||||
})
|
||||
}
|
||||
birthdayAdd(interaction)
|
||||
birthdaySet(interaction)
|
||||
break;
|
||||
case 'delete':
|
||||
if (!interaction.member.permissions.has("ADMINISTRATOR")) {
|
||||
@@ -240,15 +202,6 @@ module.exports = {
|
||||
}
|
||||
birthdayDelete(interaction)
|
||||
break;
|
||||
case 'edit':
|
||||
if (!interaction.member.permissions.has("ADMINISTRATOR")) {
|
||||
return await interaction.reply({
|
||||
content: "Unprivileged Access!",
|
||||
flags: MessageFlags.Ephemeral
|
||||
})
|
||||
}
|
||||
birthdayEdit(interaction)
|
||||
break;
|
||||
case 'get':
|
||||
birthdayGet(interaction)
|
||||
break;
|
||||
@@ -1,5 +1,5 @@
|
||||
const { SlashCommandBuilder, Events, MessageFlags } = require('discord.js')
|
||||
const { mClient } = require('../..')
|
||||
const { mClient } = require('../../../index')
|
||||
require('dotenv').config()
|
||||
|
||||
async function channelSet(interaction) {
|
||||
@@ -0,0 +1,11 @@
|
||||
const { SlashCommandBuilder } = require("discord.js");
|
||||
const ping = require("../../../src/ping");
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('ping')
|
||||
.setDescription('dev tool'),
|
||||
async execute(interaction) {
|
||||
return ping(interaction, null, 'slash')
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, UserSelectMenuBuilder, MessageFlags } = require('discord.js')
|
||||
const { mClient } = require('../..')
|
||||
const { mClient } = require('../../../index')
|
||||
require('dotenv').config()
|
||||
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
|
||||
|
||||
@@ -103,7 +103,7 @@ async function honorLeaderboard(interaction) {
|
||||
})
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('- Honors Leaderboard -')
|
||||
.setThumbnail('https://cdn.discordapp.com/attachments/1152723542836772914/1152940755539722240/pngwing.com.png')
|
||||
.setThumbnail(guild.iconURL({ dynamic: true}))
|
||||
.setDescription(fields.toString())
|
||||
.setColor('#5865F2') // Discord's blurple color
|
||||
.setFooter({ text: 'Use ◄ ► to navigate' });
|
||||
@@ -1,7 +1,11 @@
|
||||
const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, MessageFlags } = require('discord.js')
|
||||
const { mClient } = require('../..')
|
||||
const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, MessageFlags, AttachmentBuilder } = require('discord.js')
|
||||
const { mClient } = require('../../../index')
|
||||
require('dotenv').config()
|
||||
|
||||
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
|
||||
|
||||
const asset_path = './assets/Command_Nuts/'
|
||||
|
||||
async function nutsGive(interaction) {
|
||||
async function tradeWindow(buttonID1, buttonID2) {
|
||||
const embed = new EmbedBuilder()
|
||||
@@ -14,7 +18,8 @@ async function nutsGive(interaction) {
|
||||
{ name: `Their Current Balance`, value: `${theirBalance.nuts} (**+${amount}**)`, inline: true },
|
||||
{ name: `Their New Balance`, value: `${theirBalance.nuts + amount}`, inline: true }
|
||||
)
|
||||
.setThumbnail(to.displayAvatarURL())
|
||||
.setThumbnail('attachment://nuts_main.png')
|
||||
|
||||
const row = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
@@ -28,12 +33,14 @@ async function nutsGive(interaction) {
|
||||
.setCustomId(buttonID2)
|
||||
.setStyle(ButtonStyle.Danger)
|
||||
)
|
||||
|
||||
await interaction.reply({
|
||||
embeds: [embed],
|
||||
components: [row],
|
||||
flags: MessageFlags.Ephemeral
|
||||
})
|
||||
}
|
||||
|
||||
const from = interaction.user
|
||||
const to = await interaction.options.getUser('target')
|
||||
var amount = await interaction.options.getNumber('amount')
|
||||
@@ -42,21 +49,26 @@ async function nutsGive(interaction) {
|
||||
const nutsColl = db.collection('items_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!',
|
||||
flags: MessageFlags.Ephemeral
|
||||
})
|
||||
}
|
||||
|
||||
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`
|
||||
@@ -81,6 +93,7 @@ async function nutsCheck(interaction) {
|
||||
|
||||
let title = 'Zähle Nüsse'
|
||||
const embed = new EmbedBuilder()
|
||||
|
||||
for (let i = 0; i < 4; i++) {
|
||||
embed.setTitle(title)
|
||||
await interaction.editReply({
|
||||
@@ -89,14 +102,17 @@ async function nutsCheck(interaction) {
|
||||
title = title + ' .'
|
||||
await delay(500);
|
||||
}
|
||||
|
||||
embed
|
||||
.setTitle(content)
|
||||
.setThumbnail('https://cdn-icons-png.flaticon.com/512/628/628206.png')
|
||||
.setThumbnail('attachment://nuts_main.png')
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [embed]
|
||||
embeds: [embed],
|
||||
files: [`${asset_path}nuts_main.png`]
|
||||
})
|
||||
}
|
||||
|
||||
async function nutsLeaderboard(interaction) {
|
||||
const row = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
@@ -117,35 +133,50 @@ async function nutsLeaderboard(interaction) {
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
.setCustomId('nuts_leaderboard_right')
|
||||
)
|
||||
|
||||
const db = mClient.db(process.env.M_DB)
|
||||
const nutsColl = db.collection('items_nuts')
|
||||
let skip = 0
|
||||
|
||||
const nutsData = await nutsColl.find({ nuts: { $gt: 0 } }).sort({ nuts: -1 }).skip(skip).limit(5).toArray()
|
||||
|
||||
let fields
|
||||
let placements = skip + 1
|
||||
|
||||
nutsData.forEach((data) => {
|
||||
fields = (fields ? fields : '') + (`${placements}. <@${data.userID}> : ${data.nuts} Nuts\r\n`)
|
||||
placements++
|
||||
})
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('Nuts Leaderboard')
|
||||
.setThumbnail('https://cdn.discordapp.com/attachments/1152723542836772914/1152940755539722240/pngwing.com.png')
|
||||
.setThumbnail('attachment://nuts_main.png')
|
||||
.setDescription(fields.toString())
|
||||
.setColor('#5865F2') // Discord's blurple color
|
||||
.setFooter({ text: 'Use ◄ ► to navigate' });
|
||||
.setColor('#5865F2')
|
||||
.setFooter({ text: 'Use ◄ ► to navigate' })
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [embed],
|
||||
components: [row]
|
||||
components: [row],
|
||||
files: [`${asset_path}nuts_main.png`]
|
||||
})
|
||||
}
|
||||
|
||||
async function nutsStats(interaction) {
|
||||
const db = mClient.db(process.env.M_DB);
|
||||
const nStatsColl = db.collection('stats_nuts');
|
||||
var type = interaction?.options?.getString('type') || 'lookup'
|
||||
var target = interaction?.options?.getUser('lookup') || {}
|
||||
|
||||
// fetch user stats
|
||||
const statsDoc = await nStatsColl.findOne({ userID: interaction.user.id });
|
||||
const stat = statsDoc?.stat || {}; // fallback to empty object
|
||||
if (type == 'global') {
|
||||
target.id = '__global'
|
||||
} else if (!target?.id) {
|
||||
target = interaction.user
|
||||
}
|
||||
|
||||
const statsDoc = await nStatsColl.findOne({ userID: target.id });
|
||||
const stat = statsDoc?.stat || {};
|
||||
|
||||
// compute totals
|
||||
const totalCount = Object.values(stat).reduce((a, b) => a + b, 0);
|
||||
const totalNuts = Object.entries(stat).reduce(
|
||||
(sum, [num, count]) => sum + Number(num) * count,
|
||||
@@ -158,18 +189,15 @@ async function nutsStats(interaction) {
|
||||
let nutMax = { number: 0, count: 0 };
|
||||
|
||||
if (rolledNumbers.length > 0) {
|
||||
// initialize to first rolled number
|
||||
nutMin = nutMax = { number: Number(rolledNumbers[0][0]), count: rolledNumbers[0][1] };
|
||||
|
||||
for (const [numStr, count] of rolledNumbers) {
|
||||
const num = Number(numStr);
|
||||
|
||||
// best nut: prefer higher number if counts tie
|
||||
if (count > nutMax.count || (count === nutMax.count && num > nutMax.number)) {
|
||||
nutMax = { number: num, count };
|
||||
}
|
||||
|
||||
// worst nut: prefer lower number if counts tie
|
||||
if (count < nutMin.count || (count === nutMin.count && num < nutMin.number)) {
|
||||
nutMin = { number: num, count };
|
||||
}
|
||||
@@ -178,8 +206,7 @@ async function nutsStats(interaction) {
|
||||
|
||||
const nutAvg = totalCount ? totalNuts / totalCount : 0;
|
||||
|
||||
// dynamically create fields for numbers 0-9
|
||||
const fields = Array.from({ length: 10 }, (_, i) => ({
|
||||
const fields = Array.from({ length: 11 }, (_, i) => ({
|
||||
name: `[${i}]`,
|
||||
value: `x${stat[i] ?? 0}`,
|
||||
inline: true
|
||||
@@ -191,15 +218,18 @@ async function nutsStats(interaction) {
|
||||
`Total Nut Actions: **${totalCount}**\r\n` +
|
||||
`Total Nuts nutted: **${totalNuts}**\r\n` +
|
||||
`Nut Average: **${nutAvg.toFixed(3)}**\r\n` +
|
||||
`Best Nut: **${nutMax.number} (x${nutMax.count})**\r\n` +
|
||||
`Worst Nut: **${nutMin.number} (x${nutMin.count})**`
|
||||
`Most Common Nut: **${nutMax.number} (x${nutMax.count})**\r\n` +
|
||||
`Least Common Nut: **${nutMin.number} (x${nutMin.count})**`
|
||||
)
|
||||
.addFields(fields)
|
||||
.setColor(0x51267)
|
||||
.setTimestamp()
|
||||
.setThumbnail(interaction.guild.iconURL());
|
||||
.setThumbnail('attachment://nuts_main.png')
|
||||
|
||||
await interaction.editReply({ embeds: [embed] });
|
||||
await interaction.editReply({
|
||||
embeds: [embed],
|
||||
files: [`${asset_path}nuts_main.png`]
|
||||
});
|
||||
}
|
||||
|
||||
async function nutsCooldown(interaction) {
|
||||
@@ -208,13 +238,15 @@ async function nutsCooldown(interaction) {
|
||||
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 thumbnail = 'attachment://nuts_main.png'
|
||||
let file = `${asset_path}nuts_main.png`
|
||||
let title = 'Go Nuts!'
|
||||
|
||||
let date = (Date.now() / 1000)
|
||||
if (cooldown.cooldown > date) {
|
||||
content = `<t:${cooldown.cooldown}:R> kannst du wieder nussen! ;)`
|
||||
thumbnail = 'https://cdn.discordapp.com/attachments/1152723542836772914/1152987472788193361/No-nuts-PhotoRoom.png-PhotoRoom.png'
|
||||
thumbnail = 'attachment://nuts_onCD.avif'
|
||||
file = `${asset_path}nuts_onCD.avif`
|
||||
title = 'To Nut or Not to Nut...'
|
||||
}
|
||||
|
||||
@@ -224,10 +256,12 @@ async function nutsCooldown(interaction) {
|
||||
.setDescription(content)
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [embed]
|
||||
embeds: [embed],
|
||||
files: [file]
|
||||
})
|
||||
}
|
||||
async function nutsNut(interaction) {
|
||||
|
||||
async function nutsNut(interaction, quickMode) {
|
||||
const db = mClient.db(process.env.M_DB)
|
||||
const nutsColl = db.collection('items_nuts')
|
||||
const cdColl = db.collection('items_cooldowns')
|
||||
@@ -235,85 +269,99 @@ async function nutsNut(interaction) {
|
||||
|
||||
const cdData = await cdColl.findOne({ userID: interaction.user.id })
|
||||
const embed = new EmbedBuilder()
|
||||
.setImage('https://e7.pngegg.com/pngimages/1011/894/png-clipart-gift-christmas-box-mystery-gift-box-holidays-box-thumbnail.png')
|
||||
|
||||
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'
|
||||
const assets = {
|
||||
high: 'attachment://nuts_high.jpg',
|
||||
normal: 'attachment://nuts_normal.jpg',
|
||||
low: 'attachment://nuts_low.jpg',
|
||||
none: 'attachment://nuts_none.avif',
|
||||
onCD: 'attachment://nuts_onCD.avif',
|
||||
box: 'attachment://nuts_box.png',
|
||||
explosion: 'attachment://nuts_explosion.gif'
|
||||
}
|
||||
let image
|
||||
if (!cdData || cdData.cooldown < (Date.now() / 1000)) {
|
||||
let cd = Math.floor((Date.now() + 3600000) / 1000)
|
||||
|
||||
// Helper for singular/plural
|
||||
const formatNut = (amount) => `${amount} ${amount === 1 ? 'Nuss' : 'Nüsse'}`
|
||||
|
||||
// check cooldown
|
||||
if (cdData?.cooldown > Date.now() / 1000) {
|
||||
// on cooldown
|
||||
embed.setTitle('To Nut or Not to Nut...')
|
||||
embed.setDescription(`<t:${Math.floor(cdData.cooldown)}:R> kannst du wieder nussen! ;)`)
|
||||
embed.setThumbnail(assets.onCD)
|
||||
|
||||
return interaction.editReply({
|
||||
embeds: [embed],
|
||||
files: [`${asset_path}nuts_onCD.avif`]
|
||||
})
|
||||
}
|
||||
// set 1 hour cooldown
|
||||
const cd = Math.floor((Date.now() + 3600000) / 1000)
|
||||
await cdColl.findOneAndUpdate({
|
||||
userID: interaction.user.id
|
||||
}, {
|
||||
$set: { cooldown: cd }
|
||||
$set: {
|
||||
cooldown: cd,
|
||||
application: 'nuts'
|
||||
}
|
||||
}, {
|
||||
upsert: true
|
||||
})
|
||||
|
||||
// generate nut amount
|
||||
const amount = Math.floor(Math.random() * 10)
|
||||
|
||||
await nutsColl.findOneAndUpdate({
|
||||
userID: interaction.user.id
|
||||
}, {
|
||||
$inc: { nuts: amount }
|
||||
}, {
|
||||
upsert: true
|
||||
})
|
||||
// update nuts and stats
|
||||
await nutsColl.findOneAndUpdate(
|
||||
{ userID: interaction.user.id },
|
||||
{ $inc: { nuts: amount } },
|
||||
{ upsert: true }
|
||||
)
|
||||
|
||||
await nutsStatsColl.findOneAndUpdate({
|
||||
userID: interaction.user.id
|
||||
}, {
|
||||
$inc: { [`stat.${amount}`]: 1 }
|
||||
}, {
|
||||
upsert: true
|
||||
}
|
||||
);
|
||||
await nutsStatsColl.findOneAndUpdate(
|
||||
{ userID: interaction.user.id },
|
||||
{ $inc: { [`stat.${amount}`]: 1 } },
|
||||
{ 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"]
|
||||
await delay(1000)
|
||||
embed.setDescription(content)
|
||||
embed.setThumbnail(image)
|
||||
return await interaction.editReply({
|
||||
embeds: [embed]
|
||||
})
|
||||
await nutsStatsColl.findOneAndUpdate(
|
||||
{ userID: "__global" },
|
||||
{ $inc: { [`stat.${amount}`]: 1 } },
|
||||
{ upsert: true }
|
||||
)
|
||||
|
||||
|
||||
if (quickMode) {
|
||||
return interaction.editReply({ content: `Du hast ${formatNut(amount)} bekommen! :chestnut:` })
|
||||
}
|
||||
|
||||
// pseudo animation
|
||||
embed.setImage(assets.box)
|
||||
await interaction.editReply({
|
||||
embeds: [embed]
|
||||
embeds: [embed],
|
||||
files: [`${asset_path}nuts_box.png`]
|
||||
})
|
||||
await delay(1000)
|
||||
embed.setImage('https://i.pinimg.com/originals/9d/58/37/9d5837c6f0cb8b18be6ddd1e2742472a.gif')
|
||||
await delay(1337)
|
||||
embed.setImage(assets.explosion)
|
||||
await interaction.editReply({
|
||||
embeds: [embed]
|
||||
embeds: [embed],
|
||||
files: [`${asset_path}nuts_explosion.gif`]
|
||||
})
|
||||
await delay(1337)
|
||||
|
||||
await delay(1000)
|
||||
embed.setDescription(content)
|
||||
embed.setImage(image)
|
||||
await interaction.editReply({
|
||||
embeds: [embed]
|
||||
let assetFile
|
||||
if (amount === 0) assetFile = assets.none
|
||||
else if (amount > 8) assetFile = assets.high
|
||||
else if (amount > 4) assetFile = assets.normal
|
||||
else assetFile = assets.low
|
||||
|
||||
embed.setTitle(`Du hast ${formatNut(amount)} bekommen!`)
|
||||
embed.setThumbnail(assetFile)
|
||||
embed.setImage(null)
|
||||
|
||||
return interaction.editReply({
|
||||
embeds: [embed],
|
||||
files: [`${asset_path}${assetFile.split('://')[1]}`]
|
||||
})
|
||||
|
||||
|
||||
@@ -340,7 +388,20 @@ module.exports = {
|
||||
.addSubcommand(s =>
|
||||
s
|
||||
.setName('stats')
|
||||
.setDescription('wie viele Nüsse wurden genusst, Genosse?'))
|
||||
.setDescription('wie viele Nüsse wurden genusst, Genosse?')
|
||||
.addStringOption(o =>
|
||||
o.setName('type')
|
||||
.setDescription('set type to global or user')
|
||||
.addChoices(
|
||||
{ name: 'global', value: 'global' },
|
||||
{ name: 'user', value: 'user' }
|
||||
),)
|
||||
.addUserOption(o =>
|
||||
o.setName('lookup')
|
||||
.setDescription('look up specific user nut statistic')
|
||||
)
|
||||
)
|
||||
|
||||
.addSubcommand(s =>
|
||||
s
|
||||
.setName('cooldown')
|
||||
@@ -348,7 +409,12 @@ module.exports = {
|
||||
.addSubcommand(s =>
|
||||
s
|
||||
.setName('nut')
|
||||
.setDescription('willst du nuss?')),
|
||||
.setDescription('willst du nuss?'))
|
||||
.addSubcommand(s =>
|
||||
s.setName('quick')
|
||||
.setDescription('A quick nut, mlord?')
|
||||
|
||||
),
|
||||
async execute(interaction) {
|
||||
switch (interaction.options._subcommand) {
|
||||
case 'give':
|
||||
@@ -372,7 +438,11 @@ module.exports = {
|
||||
break;
|
||||
case 'nut':
|
||||
await interaction.deferReply()
|
||||
nutsNut(interaction)
|
||||
nutsNut(interaction, false)
|
||||
break;
|
||||
case 'quick':
|
||||
await interaction.deferReply()
|
||||
nutsNut(interaction, true)
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -3,11 +3,12 @@ Random By Year?
|
||||
Counter (Leaderboard)
|
||||
*/
|
||||
const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, UserSelectMenuBuilder, MessageFlags } = require('discord.js')
|
||||
const { mClient } = require('../..')
|
||||
const { mClient } = require('../../../index')
|
||||
require('dotenv').config()
|
||||
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
|
||||
|
||||
async function quotesAdd(interaction) {
|
||||
|
||||
const messageLink = await interaction.options.getString('link')
|
||||
//regex for message link
|
||||
const regex = /^https:\/\/discord\.com\/channels\/\d+\/\d+\/\d+$/
|
||||
@@ -56,7 +57,7 @@ async function quotesAdd(interaction) {
|
||||
messageID: messageID,
|
||||
channelID: channelID,
|
||||
guildID: guildID,
|
||||
by: msgData.author.id,
|
||||
userID: msgData.author.id,
|
||||
count: 0
|
||||
}
|
||||
}, { upsert: true })
|
||||
@@ -163,7 +164,7 @@ async function quotesRandom(interaction) {
|
||||
if (user) {
|
||||
rdm = await quotesColl.aggregate([
|
||||
{
|
||||
$match: { by: user.id },
|
||||
$match: { userID: user.id },
|
||||
}, {
|
||||
$sample: { size: 1 }
|
||||
}
|
||||
@@ -176,7 +177,7 @@ async function quotesRandom(interaction) {
|
||||
]).toArray()
|
||||
}
|
||||
const found = rdm[0]
|
||||
if (!found) { return await interaction.reply({ content: 'Database Empty', flags: MessageFlags.Ephemeral }) }
|
||||
if (!found) { return await interaction.reply({ content: 'No Entry Found.', flags: MessageFlags.Ephemeral }) }
|
||||
const guild = await interaction.client.guilds.fetch(found.guildID)
|
||||
const channel = await guild.channels.fetch(found.channelID)
|
||||
const message = await channel.messages.fetch(found.messageID)
|
||||
@@ -267,71 +268,87 @@ async function quotesList(interaction) {
|
||||
})
|
||||
|
||||
}
|
||||
async function quotesLeaderboard(interaction) {
|
||||
const db = mClient.db(process.env.M_DB)
|
||||
const quotesColl = db.collection('items_quotes')
|
||||
let skip = 0
|
||||
const minValue = 0
|
||||
const maxValue = await quotesColl.countDocuments({ $and: [{ guildID: interaction.guild.id }, { count: { $gt: 0 } }] })
|
||||
async function quotesLeaderboard(interaction, page = 1, limit = 5) {
|
||||
const db = mClient.db(process.env.M_DB);
|
||||
const quotesColl = db.collection('items_quotes');
|
||||
|
||||
const quotesData = await quotesColl.find({}).sort({ count: -1, messageID: -1 }).skip(skip).limit(5).toArray()
|
||||
const fields = []
|
||||
// Total quotes in the guild
|
||||
const totalQuotes = await quotesColl.countDocuments({ guildID: interaction.guild.id, count: { $gte: 0 } });
|
||||
const totalPages = Math.ceil(totalQuotes / limit);
|
||||
|
||||
const guild = await interaction.client.guilds.fetch(interaction.guild.id)
|
||||
quotesData.forEach(async (data, index) => {
|
||||
// Clamp page
|
||||
if (page < 1) page = 1;
|
||||
if (page > totalPages) page = totalPages;
|
||||
|
||||
let channel = await guild.channels.fetch(data.channelID)
|
||||
let message = await channel.messages.fetch(data.messageID)
|
||||
const skip = (page - 1) * limit;
|
||||
|
||||
await delay(500)
|
||||
let timestamp = new Date(message.createdTimestamp)
|
||||
fields.push({
|
||||
name: `${index + 1}.`,//`\u200b` ,
|
||||
value: `[#${data.messageID}](https://discord.com/channels/${data.guildID}/${data.channelID}/${data.messageID})\r\n**by** <@${data.by}> • ⭐ ${data.count}\r\n_Posted on **${timestamp}**_\r\n${message.content}`
|
||||
// Fetch quotes for this page
|
||||
const quotesData = await quotesColl
|
||||
.find({ guildID: interaction.guild.id, count: { $gte: 0 } })
|
||||
.sort({ count: -1, messageID: -1 })
|
||||
.skip(skip)
|
||||
.limit(limit)
|
||||
.toArray();
|
||||
|
||||
// Fallback if no quotes exist
|
||||
if (!quotesData.length) {
|
||||
return interaction.editReply({ content: 'No quotes found for this server yet!', components: [] });
|
||||
}
|
||||
|
||||
const guild = await interaction.client.guilds.fetch(interaction.guild.id);
|
||||
|
||||
// Fetch all messages concurrently
|
||||
const fields = await Promise.all(
|
||||
quotesData.map(async (data, index) => {
|
||||
try {
|
||||
const channel = await guild.channels.fetch(data.channelID);
|
||||
const message = await channel.messages.fetch(data.messageID);
|
||||
const timestamp = new Date(message.createdTimestamp).toLocaleString('en-US', {
|
||||
dateStyle: 'medium',
|
||||
timeStyle: 'short'
|
||||
});
|
||||
|
||||
return {
|
||||
name: `${skip + index + 1}.`,
|
||||
value: `[#${data.messageID}](https://discord.com/channels/${data.guildID}/${data.channelID}/${data.messageID})\n**by** <@${data.userID}> • ⭐ ${data.count}\n_Posted on **${timestamp}**_\n${message.content}`
|
||||
};
|
||||
} catch {
|
||||
return {
|
||||
name: `${skip + index + 1}.`,
|
||||
value: 'Message unavailable.'
|
||||
};
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
})
|
||||
|
||||
|
||||
await delay(5000)
|
||||
console.log(fields)
|
||||
quotesData.sort((a,b) => {
|
||||
const numA = parseInt(a.name);
|
||||
const numB = parseInt(b.name);
|
||||
return numA - numB;
|
||||
})
|
||||
console.log(fields)
|
||||
|
||||
// Build embed
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('- Quotes Leaderboard -')
|
||||
.setThumbnail('https://cdn.discordapp.com/attachments/1152723542836772914/1152940755539722240/pngwing.com.png')
|
||||
.setThumbnail(guild.iconURL({ dynamic: true }))
|
||||
.setFields(fields)
|
||||
.setColor('#5865F2') // Discord's blurple color
|
||||
.setFooter({ text: `Use ◄ ► to navigate\r\n${skip}` });
|
||||
.setColor('#5865F2')
|
||||
.setFooter({ text: `Use ◄ ► to navigate • Page ${page} of ${totalPages}` });
|
||||
|
||||
// Build buttons
|
||||
const row = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setLabel('◄')
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
.setCustomId('quotes_leaderboard_left')
|
||||
)
|
||||
.addComponents(
|
||||
.setDisabled(page === 1),
|
||||
new ButtonBuilder()
|
||||
.setLabel('X')
|
||||
.setStyle(ButtonStyle.Danger)
|
||||
.setCustomId('abort')
|
||||
)
|
||||
.addComponents(
|
||||
.setCustomId('abort'),
|
||||
new ButtonBuilder()
|
||||
.setLabel('►')
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
.setCustomId('quotes_leaderboard_right')
|
||||
)
|
||||
await interaction.editReply({
|
||||
embeds: [embed],
|
||||
components: [row]
|
||||
})
|
||||
.setDisabled(page === totalPages)
|
||||
);
|
||||
|
||||
await interaction.editReply({ embeds: [embed], components: [row] });
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
@@ -341,7 +358,7 @@ module.exports = {
|
||||
.addSubcommand(s =>
|
||||
s
|
||||
.setName('add')
|
||||
.setDescription('add a new quote')
|
||||
.setDescription('add a new quote either by replying to a message or inserting the message link')
|
||||
.addStringOption(o => o.setName('link').setDescription('insert message link').setRequired(true)))
|
||||
.addSubcommand(s =>
|
||||
s
|
||||
@@ -392,4 +409,6 @@ module.exports = {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
module.exports.quotesLeaderboard = quotesLeaderboard
|
||||
@@ -0,0 +1,48 @@
|
||||
const { SlashCommandBuilder } = require("discord.js");
|
||||
|
||||
function askMyBalls() {
|
||||
var answers = [
|
||||
'Absolut, so wie die Authorität unserer Göttin!',
|
||||
'Unterschätze es nicht, genauso wie Roberts sexual frustration',
|
||||
'Ich zedaz so',
|
||||
'Ohne Zweifel',
|
||||
'Definitiv, Alter',
|
||||
'Microsoft Outlook gut',
|
||||
'Das Sternzeichen von Yeesh leuchtet heute stark dafür',
|
||||
'Mit "Support-Desk am Freitagabend" - Wahrscheinlichkeit',
|
||||
'Ist die Nase von Julius wunderschön und lang?',
|
||||
'So wahr wie Laviis Zeichnkünste',
|
||||
'nein...ja... vielleicht?',
|
||||
'Frag mich nachher nochmal',
|
||||
'Die Kalkulationen sind leicht off, ich aber nicht ;)',
|
||||
'Ich sag es dir ein ander Mal',
|
||||
'Ohne schwere Zeiten, würden wir die guten Zeiten nie schätzen',
|
||||
'Genauso schlecht wie eine Ketzerei gegen den Olymp',
|
||||
'Hat der Fuchs uns jemals verraten?...**hust**',
|
||||
'Mein Outlook ist abgeschmiert, mist',
|
||||
'Ich bezweifle es. A propos, zweifel nicht an den Götter und ihren Priester!',
|
||||
'Meine Quellen sagen.... WARNUNG! Artikel 17: Die betroffene Person hat das Recht, von dem Verantwortlichen zu verlangen, dass sie betreffende personenbezogene Daten unverzüglich gelöscht werden, und der Verantwortliche ist verpflichtet, personenbezogene Daten unverzüglich zu löschen, sofern einer der folgenden Gründe zutrifft **ERROR ERROR ERROR**?'
|
||||
]
|
||||
const r = Math.floor(Math.random() * answers.length)
|
||||
|
||||
return answers[r]
|
||||
}
|
||||
|
||||
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('8ball')
|
||||
.setDescription('dont ask me anything')
|
||||
.addSubcommand(s =>
|
||||
s.setName('ask')
|
||||
.setDescription('what do you want to know?')
|
||||
.addStringOption(
|
||||
o => o.setName('question').setDescription('ask away!').setRequired(true))
|
||||
),
|
||||
async execute(interaction) {
|
||||
await interaction.deferReply()
|
||||
await delay(2000)
|
||||
await interaction.editReply(askMyBalls())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
const { SlashCommandBuilder, EmbedBuilder, AttachmentBuilder } = require("discord.js");
|
||||
|
||||
async function doggoPet(interaction) {
|
||||
|
||||
const responses = [
|
||||
'*loving growl*',
|
||||
'Danke, das habe ich gebraucht.',
|
||||
'Ein bisschen tiefer.',
|
||||
'Ja, genau dort!'
|
||||
]
|
||||
var r = Math.floor(Math.random() * responses.length)
|
||||
|
||||
const filePath = `assets/Command_Doggo/doggo.jpg`;
|
||||
|
||||
const attachment = new AttachmentBuilder(filePath);
|
||||
const embed = new EmbedBuilder()
|
||||
.setDescription(responses[r])
|
||||
.setColor(0x51267)
|
||||
.setTimestamp()
|
||||
.setImage(`attachment://doggo.jpg`);
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [embed],
|
||||
files: [attachment]
|
||||
})
|
||||
}
|
||||
async function doggoFeed(interaction) {
|
||||
await interaction.editReply({
|
||||
content: 'WIP placeholder'
|
||||
})
|
||||
}
|
||||
async function doggoWalk(interaction) {
|
||||
await interaction.editReply({
|
||||
content: 'WIP placeholder'
|
||||
})
|
||||
}
|
||||
async function doggoPlay(interaction) {
|
||||
await interaction.editReply({
|
||||
content: 'WIP placeholder'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('doggo')
|
||||
.setDescription('who is a good boi?')
|
||||
.addSubcommand(s =>
|
||||
s.setName('pet')
|
||||
.setDescription('beeg scratch')
|
||||
)
|
||||
.addSubcommand(s =>
|
||||
s.setName('feed')
|
||||
.setDescription('tastge')
|
||||
)
|
||||
.addSubcommand(s =>
|
||||
s.setName('walk')
|
||||
.setDescription('walkies')
|
||||
)
|
||||
.addSubcommand(s =>
|
||||
s.setName('play')
|
||||
.setDescription('fun time')
|
||||
),
|
||||
async execute(interaction) {
|
||||
await interaction.deferReply()
|
||||
switch (interaction.options._subcommand) {
|
||||
case 'pet':
|
||||
doggoPet(interaction)
|
||||
break;
|
||||
case 'feed':
|
||||
doggoFeed(interaction)
|
||||
break;
|
||||
case 'walk':
|
||||
doggoWalk(interaction)
|
||||
break;
|
||||
case 'play':
|
||||
doggoPlay(interaction)
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
const { SlashCommandBuilder, AttachmentBuilder, EmbedBuilder } = require('discord.js');
|
||||
const fs = require('fs/promises');
|
||||
const path = require('path');
|
||||
|
||||
async function makeDay() {
|
||||
const date = new Date();
|
||||
|
||||
const tage = [
|
||||
'sonntag',
|
||||
'montag',
|
||||
'dienstag',
|
||||
'mittwoch',
|
||||
'donnerstag',
|
||||
'freitag',
|
||||
'samstag'
|
||||
];
|
||||
|
||||
const text = {
|
||||
montag: 'Es ist Montag meine Münmler!',
|
||||
mittwoch: 'Es ist Mittwoch meine Kerle!',
|
||||
donnerstag: 'Es ist nicht mehr Mittwoch meine Kerle!',
|
||||
freitag: 'Es ist Freitag meine Kerl*innen!',
|
||||
default: 'Es ist nicht Mittwoch, meine Kerle...'
|
||||
};
|
||||
|
||||
const today = tage[date.getDay()];
|
||||
|
||||
let files;
|
||||
try {
|
||||
files = await fs.readdir('assets/Command_Mittwoch');
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return { filename: 'nicht_mittwoch', content: text.default };
|
||||
}
|
||||
|
||||
const available = files.map(f => path.parse(f).name);
|
||||
|
||||
if (available.includes(today)) {
|
||||
return {
|
||||
filename: today,
|
||||
content: text[today] || text.default
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
filename: 'nicht_mittwoch',
|
||||
content: text.default
|
||||
};
|
||||
}
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('mittwoch')
|
||||
.setDescription('mittwoch vibes'),
|
||||
|
||||
async execute(interaction) {
|
||||
const { filename, content } = await makeDay();
|
||||
|
||||
const filePath = `assets/Command_Mittwoch/${filename}.jpg`;
|
||||
|
||||
const attachment = new AttachmentBuilder(filePath);
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle(content)
|
||||
.setColor(0x51267)
|
||||
.setTimestamp()
|
||||
.setImage(`attachment://${filename}.jpg`);
|
||||
|
||||
await interaction.reply({
|
||||
embeds: [embed],
|
||||
files: [attachment]
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -46,7 +46,7 @@ module.exports = {
|
||||
|
||||
// Draw Initial Image
|
||||
const background = await loadImage(
|
||||
path.join(__dirname, '../assets/bdbanner.png')
|
||||
path.join(__dirname, '../assets/Event_Birthday/bdbanner.png')
|
||||
);
|
||||
let x = 0;
|
||||
let y = 0;
|
||||
|
||||
@@ -35,7 +35,7 @@ module.exports = {
|
||||
// Fetch birthday role
|
||||
const bdayRoleColl = db.collection('config_roles');
|
||||
const bdayRoleEntry = await bdayRoleColl.findOne({ guildID: guild.id });
|
||||
const birthdayRoleID = bdayRoleEntry.roleID;
|
||||
const birthdayRoleID = bdayRoleEntry?.roleID;
|
||||
|
||||
if (!birthdayRoleID) {
|
||||
console.warn("No birthday role configured in DB");
|
||||
@@ -54,7 +54,7 @@ module.exports = {
|
||||
console.error(`Failed to add birthday role to ${member.user.tag}:`, err)
|
||||
);
|
||||
console.log(`Added birthday role to ${member.user.tag}`);
|
||||
client.emit('Birthday', member);
|
||||
//client.emit('Birthday', member);
|
||||
} else {
|
||||
// Default fallback: remove birthday role if present
|
||||
if (member.roles.cache.has(birthdayRoleID)) {
|
||||
|
||||
@@ -36,7 +36,7 @@ module.exports = {
|
||||
|
||||
// Draw Initial Image
|
||||
const background = await loadImage(
|
||||
path.join(__dirname, '../assets/background.png')
|
||||
path.join(__dirname, '../assets/Event_MemberJoin/background.png')
|
||||
);
|
||||
let x = 0;
|
||||
let y = 0;
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
const fs = require('node:fs')
|
||||
const path = require('node:path')
|
||||
module.exports = (client) => {
|
||||
const legacyFoldersPath = path.join(__dirname, '../commands/legacy');
|
||||
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`)
|
||||
}
|
||||
@@ -5,7 +5,7 @@ const path = require('node:path')
|
||||
|
||||
module.exports = (client) => {
|
||||
let commands = [] // only used for REST API
|
||||
const foldersPath = path.join(__dirname, '../commands');
|
||||
const foldersPath = path.join(__dirname, '../commands/slash');
|
||||
const commandFolders = fs.readdirSync(foldersPath);
|
||||
for (const folder of commandFolders) {
|
||||
// Grab all the command files from the commands directory you created earlier
|
||||
@@ -1,29 +0,0 @@
|
||||
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`)
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
const { mClient } = require('../../index')
|
||||
require('dotenv').config()
|
||||
module.exports = {
|
||||
name: 'nuts',
|
||||
description: 'get nuts',
|
||||
aliases: ['n', 'nget', 'nutsget'],
|
||||
async execute(message, args) {
|
||||
const db = mClient.db(process.env.M_DB)
|
||||
const nutsColl = db.collection('items_nuts')
|
||||
const cdColl = db.collection('items_cooldowns')
|
||||
|
||||
const cdData = await cdColl.findOne({ userID: message.author.id })
|
||||
|
||||
if (!cdData || cdData.cooldown < Date.now() / 1000) {
|
||||
let cd = Math.floor((Date.now() + 3600000) / 1000)
|
||||
await cdColl.findOneAndUpdate({
|
||||
userID: message.author.id
|
||||
}, {
|
||||
$set: { cooldown: cd }
|
||||
}, {
|
||||
upsert: true
|
||||
})
|
||||
|
||||
const amount = Math.floor(Math.random() * 10)
|
||||
|
||||
await nutsColl.findOneAndUpdate({
|
||||
userID: message.author.id
|
||||
}, {
|
||||
$inc: { nuts: amount }
|
||||
}, {
|
||||
upsert: true
|
||||
})
|
||||
|
||||
let content = `Du hast ${amount} Nüsse bekommen! :chestnut:`
|
||||
if (!amount) {
|
||||
content = `Du hast leider keine Nüsse bekommen :(`
|
||||
}
|
||||
return await message.reply({
|
||||
content: content
|
||||
})
|
||||
} else {
|
||||
return await message.reply({
|
||||
content: `Du kannst erst <t:${Math.floor(cdData?.cooldown / 1000)}:R> wieder nussen :(`,
|
||||
})
|
||||
}
|
||||
},
|
||||
};
|
||||
@@ -1,58 +0,0 @@
|
||||
const { EmbedBuilder } = require('discord.js')
|
||||
const { mClient } = require('../../index')
|
||||
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
|
||||
require('dotenv').config()
|
||||
module.exports = {
|
||||
name: 'nutsstats',
|
||||
description: 'shows nuts statistic',
|
||||
aliases: ['nstat', 'ns'],
|
||||
async execute(message, args) {
|
||||
const db = mClient.db(process.env.M_DB)
|
||||
const nStatsColl = db.collection('stats_nuts')
|
||||
const stats = await nStatsColl.find({}).sort({ amount: 1 }).toArray()
|
||||
let nutMin = {
|
||||
count: 0,
|
||||
amount: 0
|
||||
}
|
||||
let nutMax = {
|
||||
count: 0,
|
||||
amount: 0
|
||||
}
|
||||
let totalNuts = 0
|
||||
let totalCount = 0
|
||||
stats.forEach(stat => {
|
||||
totalCount += stat.count
|
||||
totalNuts += (stat.count * stat.amount)
|
||||
if (nutMin.count > stat.count) { nutMin = stat }
|
||||
if (nutMax.count < stat.count) { nutMax = stat }
|
||||
})
|
||||
let nutAvg = totalNuts / totalCount
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle("Nut Statistic")
|
||||
.setDescription(
|
||||
`Total Nut Actions: **${totalCount}**\r\n
|
||||
Total Nuts nutted: **${totalNuts}**\r\n
|
||||
Nut Average: **${nutAvg.toFixed(3)}**\r\n
|
||||
Best Nut: **${nutMax.amount}**\r\n
|
||||
Worst Nut: **${nutMin.amount}**`
|
||||
)
|
||||
.addFields(
|
||||
{ name: '[0]', value: `x${stats[0].count}`, inline: true },
|
||||
{ name: '[1]', value: `x${stats[1].count}`, inline: true },
|
||||
{ name: '[2]', value: `x${stats[2].count}`, inline: true },
|
||||
{ name: '[3]', value: `x${stats[3].count}`, inline: true },
|
||||
{ name: '[4]', value: `x${stats[4].count}`, inline: true },
|
||||
{ name: '[5]', value: `x${stats[5].count}`, inline: true },
|
||||
{ name: '[6]', value: `x${stats[6].count}`, inline: true },
|
||||
{ name: '[7]', value: `x${stats[7].count}`, inline: true },
|
||||
{ name: '[8]', value: `x${stats[8].count}`, inline: true },
|
||||
{ name: '[9]', value: `x${stats[9].count}`, inline: true }
|
||||
)
|
||||
.setColor(0x51267)
|
||||
.setTimestamp()
|
||||
.setThumbnail(message.guild.iconURL())
|
||||
await message.reply({
|
||||
embeds: [embed]
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
module.exports = {
|
||||
name: 'ping',
|
||||
description: 'returns pong!',
|
||||
aliases: [''],
|
||||
async execute(message, args) {
|
||||
message.reply('pong!')
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ module.exports = {
|
||||
const target = await interaction.guild.members.fetch(interaction.members.keys().next().value)
|
||||
const db = mClient.db(process.env.M_DB)
|
||||
const quotesColl = db.collection('items_quotes')
|
||||
const quotes = await quotesColl.find({ by: target.id }).toArray()
|
||||
const quotes = await quotesColl.find({ userID: target.id }).toArray()
|
||||
const member = interaction.message.guild.members.cache.get(target.user.id)
|
||||
const memberRoles = member.roles.cache
|
||||
.filter((roles) => roles.id !== interaction.message.guild.id)
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
module.exports =
|
||||
function ping(interface, args, type){
|
||||
if (type = 'legacy'){
|
||||
// type = legacy
|
||||
interface.reply('pang!')
|
||||
} else {
|
||||
interface.reply('pong!')
|
||||
}
|
||||
}
|
||||