Compare commits
21 Commits
564216ee8a
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| bb90ca792c | |||
| 0c84c85b62 | |||
| 0218583d24 | |||
| e2cc63e6c9 | |||
| ad32efb156 | |||
| 466b9708cf | |||
| f41f848ad5 | |||
| 2c596fe23f | |||
| 83c204670d | |||
| d8200e46df | |||
| 9d56ee5d34 | |||
| e2e764c295 | |||
| 6533510481 | |||
| 664224b14e | |||
| e59a863a8d | |||
| 2691653132 | |||
| 5e8fb7e729 | |||
| f1f9d95685 | |||
| 6d8d8402a5 | |||
| 202d0ef7bb | |||
| d26b5e5c56 |
@@ -0,0 +1,6 @@
|
|||||||
|
D_ID=
|
||||||
|
D_Token=
|
||||||
|
D_Prefix=
|
||||||
|
D_GuildID=
|
||||||
|
M_URI=
|
||||||
|
M_DB=
|
||||||
@@ -1,5 +1,2 @@
|
|||||||
.env
|
.env
|
||||||
node_modules
|
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,9 +1,3 @@
|
|||||||
- quotes leaderboard (count)
|
### ToDo?:
|
||||||
- quotes filter by channel
|
- quotes filter by channel
|
||||||
- event creation + reminder 1h before
|
- event creation + reminder 1h before
|
||||||
- birthday role
|
|
||||||
- 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 |
|
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()
|
const embed = new EmbedBuilder()
|
||||||
.setTitle('Honors Leaderboard')
|
.setTitle('Honors Leaderboard')
|
||||||
.setThumbnail('https://cdn.discordapp.com/attachments/1152723542836772914/1152940755539722240/pngwing.com.png')
|
.setThumbnail(guild.iconURL({ dynamic: true}))
|
||||||
.setDescription(fields.toString())
|
.setDescription(fields.toString())
|
||||||
.setColor('#5865F2') // Discord's blurple color
|
.setColor('#5865F2') // Discord's blurple color
|
||||||
.setFooter({ text: 'Use ◄ ► to navigate' });
|
.setFooter({ text: 'Use ◄ ► to navigate' });
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ module.exports = {
|
|||||||
})
|
})
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setTitle('Honors Leaderboard')
|
.setTitle('Honors Leaderboard')
|
||||||
.setThumbnail('https://cdn.discordapp.com/attachments/1152723542836772914/1152940755539722240/pngwing.com.png')
|
.setThumbnail(guild.iconURL({ dynamic: true}))
|
||||||
.setDescription(fields.toString())
|
.setDescription(fields.toString())
|
||||||
.setColor('#5865F2') // Discord's blurple color
|
.setColor('#5865F2') // Discord's blurple color
|
||||||
.setFooter({ text: 'Use ◄ ► to navigate' });
|
.setFooter({ text: 'Use ◄ ► to navigate' });
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ module.exports = {
|
|||||||
})
|
})
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setTitle('Honors Leaderboard')
|
.setTitle('Honors Leaderboard')
|
||||||
.setThumbnail('https://cdn.discordapp.com/attachments/1152723542836772914/1152940755539722240/pngwing.com.png')
|
.setThumbnail(guild.iconURL({ dynamic: true}))
|
||||||
.setDescription(fields.toString())
|
.setDescription(fields.toString())
|
||||||
.setColor('#5865F2') // Discord's blurple color
|
.setColor('#5865F2') // Discord's blurple color
|
||||||
.setFooter({ text: 'Use ◄ ► to navigate' });
|
.setFooter({ text: 'Use ◄ ► to navigate' });
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ module.exports = {
|
|||||||
})
|
})
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setTitle('Nuts Leaderboard')
|
.setTitle('Nuts Leaderboard')
|
||||||
.setThumbnail('https://cdn.discordapp.com/attachments/1152723542836772914/1152940755539722240/pngwing.com.png')
|
.setThumbnail(guild.iconURL({ dynamic: true}))
|
||||||
.setDescription(fields.toString())
|
.setDescription(fields.toString())
|
||||||
.setColor('#5865F2') // Discord's blurple color
|
.setColor('#5865F2') // Discord's blurple color
|
||||||
.setFooter({ text: 'Use ◄ ► to navigate' });
|
.setFooter({ text: 'Use ◄ ► to navigate' });
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ module.exports = {
|
|||||||
})
|
})
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setTitle('Nuts Leaderboard')
|
.setTitle('Nuts Leaderboard')
|
||||||
.setThumbnail('https://cdn.discordapp.com/attachments/1152723542836772914/1152940755539722240/pngwing.com.png')
|
.setThumbnail(guild.iconURL({ dynamic: true}))
|
||||||
.setDescription(fields.toString())
|
.setDescription(fields.toString())
|
||||||
.setColor('#5865F2') // Discord's blurple color
|
.setColor('#5865F2') // Discord's blurple color
|
||||||
.setFooter({ text: 'Use ◄ ► to navigate' });
|
.setFooter({ text: 'Use ◄ ► to navigate' });
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ module.exports = {
|
|||||||
})
|
})
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setTitle('Nuts Leaderboard')
|
.setTitle('Nuts Leaderboard')
|
||||||
.setThumbnail('https://cdn.discordapp.com/attachments/1152723542836772914/1152940755539722240/pngwing.com.png')
|
.setThumbnail(guild.iconURL({ dynamic: true}))
|
||||||
.setDescription(fields.toString())
|
.setDescription(fields.toString())
|
||||||
.setColor('#5865F2') // Discord's blurple color
|
.setColor('#5865F2') // Discord's blurple color
|
||||||
.setFooter({ text: 'Use ◄ ► to navigate' });
|
.setFooter({ text: 'Use ◄ ► to navigate' });
|
||||||
|
|||||||
@@ -1,70 +1,19 @@
|
|||||||
const { EmbedBuilder, ButtonBuilder, ButtonStyle, ActionRowBuilder } = require('discord.js');
|
const { quotesLeaderboard } = require("../../commands/slash/applications/quotes");
|
||||||
const { mClient } = require('../..'); // Adjust the path as needed
|
|
||||||
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'quotes_leaderboard_right',
|
name: 'quotes_leaderboard_left',
|
||||||
description: 'Navigate right through the quotes leaderboard',
|
description: 'Navigate left through the quotes leaderboard',
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
await interaction.deferReply()
|
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 } }] })
|
|
||||||
|
|
||||||
let skip = interaction.message.embeds[0].data.fields[0].value.split('.')
|
// Parse current page from footer
|
||||||
skip = Number(skip[0]) - 6
|
let page = 1;
|
||||||
if (skip >= (maxValue - (maxValue % 5))) {
|
const footerText = interaction.message.embeds[0]?.footer?.text || '';
|
||||||
skip = maxValue - (maxValue % 5)
|
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()
|
page--; // move to previous page
|
||||||
const fields = []
|
|
||||||
|
|
||||||
const guild = await interaction.client.guilds.fetch(interaction.guild.id)
|
await quotesLeaderboard(interaction, page);
|
||||||
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]
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1,70 +1,19 @@
|
|||||||
const { EmbedBuilder, ButtonBuilder, ButtonStyle, ActionRowBuilder } = require('discord.js');
|
const { quotesLeaderboard } = require("../../commands/slash/applications/quotes");
|
||||||
const { mClient } = require('../..'); // Adjust the path as needed
|
|
||||||
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'quotes_leaderboard_right',
|
name: 'quotes_leaderboard_right',
|
||||||
description: 'Navigate right through the quotes leaderboard',
|
description: 'Navigate right through the quotes leaderboard',
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
await interaction.deferReply()
|
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 } }] })
|
|
||||||
|
|
||||||
let skip = interaction.message.embeds[0].data.fields[0].value.split('.')
|
// Parse current page from footer
|
||||||
skip = Number(skip[0]) +4
|
let page = 1;
|
||||||
if (skip >= (maxValue - (maxValue % 5))) {
|
const footerText = interaction.message.embeds[0]?.footer?.text || '';
|
||||||
skip = maxValue - (maxValue % 5)
|
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()
|
page++; // move to next page
|
||||||
const fields = []
|
|
||||||
|
|
||||||
const guild = await interaction.client.guilds.fetch(interaction.guild.id)
|
await quotesLeaderboard(interaction, page);
|
||||||
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]
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -15,7 +15,7 @@ module.exports = {
|
|||||||
|
|
||||||
const db = mClient.db(process.env.M_DB)
|
const db = mClient.db(process.env.M_DB)
|
||||||
const quotesColl = db.collection('items_quotes')
|
const quotesColl = db.collection('items_quotes')
|
||||||
const quotes = await quotesColl.find({ by: target.id }).toArray()
|
const quotes = await quotesColl.find({ userID: target.id }).toArray()
|
||||||
|
|
||||||
var index = Number((await interaction.message.embeds[0].data.title).split(' ')[2].slice(1))
|
var index = Number((await interaction.message.embeds[0].data.title).split(' ')[2].slice(1))
|
||||||
if (!index) { index = 0 }
|
if (!index) { index = 0 }
|
||||||
@@ -64,7 +64,7 @@ module.exports = {
|
|||||||
.setURL(messageLink)
|
.setURL(messageLink)
|
||||||
.setTitle(`- Quote #${index + 1} -`)
|
.setTitle(`- Quote #${index + 1} -`)
|
||||||
.setDescription(description)
|
.setDescription(description)
|
||||||
.setFooter({ text: (`${footer} #${found.messageID} <@${found.by}>`) })
|
.setFooter({ text: (`${footer} #${found.messageID} <@${found.userID}>`) })
|
||||||
const select = new ActionRowBuilder()
|
const select = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new UserSelectMenuBuilder()
|
new UserSelectMenuBuilder()
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ module.exports = {
|
|||||||
|
|
||||||
const db = mClient.db(process.env.M_DB)
|
const db = mClient.db(process.env.M_DB)
|
||||||
const quotesColl = db.collection('items_quotes')
|
const quotesColl = db.collection('items_quotes')
|
||||||
const quotes = await quotesColl.find({ by: target.id }).toArray()
|
const quotes = await quotesColl.find({ userID: target.id }).toArray()
|
||||||
|
|
||||||
var index = Number((await interaction.message.embeds[0].data.title).split(' ')[2].slice(1))
|
var index = Number((await interaction.message.embeds[0].data.title).split(' ')[2].slice(1))
|
||||||
if (!index) { index = 0 }
|
if (!index) { index = 0 }
|
||||||
@@ -64,7 +64,7 @@ module.exports = {
|
|||||||
.setURL(messageLink)
|
.setURL(messageLink)
|
||||||
.setTitle(`- Quote #${index + 1} -`)
|
.setTitle(`- Quote #${index + 1} -`)
|
||||||
.setDescription(description)
|
.setDescription(description)
|
||||||
.setFooter({ text: (`${footer} #${found.messageID} <@${found.by}>`) })
|
.setFooter({ text: (`${footer} #${found.messageID} <@${found.userID}>`) })
|
||||||
const select = new ActionRowBuilder()
|
const select = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new UserSelectMenuBuilder()
|
new UserSelectMenuBuilder()
|
||||||
|
|||||||
@@ -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 { EmbedBuilder } = require('discord.js')
|
||||||
const { mClient } = require('../../index')
|
const { mClient } = require('../../../index')
|
||||||
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
|
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
|
||||||
require('dotenv').config()
|
require('dotenv').config()
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
const { EmbedBuilder } = require('discord.js')
|
const { EmbedBuilder } = require('discord.js')
|
||||||
const { mClient } = require('../../index')
|
const { mClient } = require('../../../index')
|
||||||
require('dotenv').config()
|
require('dotenv').config()
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'nutsCooldown',
|
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 { EmbedBuilder } = require('discord.js')
|
||||||
const { mClient } = require('../../index')
|
const { mClient } = require('../../../index')
|
||||||
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
|
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
|
||||||
require('dotenv').config()
|
require('dotenv').config()
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@@ -58,7 +58,7 @@ module.exports = {
|
|||||||
if (yourBalance.nuts < amount) {
|
if (yourBalance.nuts < amount) {
|
||||||
return await message.reply({
|
return await message.reply({
|
||||||
content: 'Du kannst nicht mehr geben als du hast!',
|
content: 'Du kannst nicht mehr geben als du hast!',
|
||||||
flags: MessageFlags.Ephemeral
|
ephemeral: true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
var content = `Du sendest **${amount}** Nüsse an <@${target.id}>`
|
var content = `Du sendest **${amount}** Nüsse an <@${target.id}>`
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js')
|
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)); }
|
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
|
||||||
require('dotenv').config()
|
require('dotenv').config()
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@@ -37,7 +37,7 @@ module.exports = {
|
|||||||
})
|
})
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setTitle('Nuts Leaderboard')
|
.setTitle('Nuts Leaderboard')
|
||||||
.setThumbnail('https://cdn.discordapp.com/attachments/1152723542836772914/1152940755539722240/pngwing.com.png')
|
.setThumbnail(guild.iconURL({ dynamic: true}))
|
||||||
.setDescription(fields.toString())
|
.setDescription(fields.toString())
|
||||||
.setColor('#5865F2') // Discord's blurple color
|
.setColor('#5865F2') // Discord's blurple color
|
||||||
.setFooter({ text: 'Use ◄ ► to navigate' });
|
.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 { SlashCommandBuilder, EmbedBuilder, MessageFlags } = require('discord.js')
|
||||||
const { mClient } = require('../..')
|
const { mClient } = require('../../../index')
|
||||||
const { configDotenv } = require('dotenv')
|
const { configDotenv } = require('dotenv')
|
||||||
configDotenv()
|
configDotenv()
|
||||||
|
|
||||||
@@ -7,7 +7,7 @@ function isValidDate(day, month) {
|
|||||||
// Define the number of days in each month
|
// Define the number of days in each month
|
||||||
const daysInMonth = {
|
const daysInMonth = {
|
||||||
1: 31, // January
|
1: 31, // January
|
||||||
2: 28, // February (ignore leap years)
|
2: 28, // February (fuck leap years, me an' the homies hate that)
|
||||||
3: 31, // March
|
3: 31, // March
|
||||||
4: 30, // April
|
4: 30, // April
|
||||||
5: 31, // May
|
5: 31, // May
|
||||||
@@ -32,8 +32,22 @@ function isValidDate(day, month) {
|
|||||||
|
|
||||||
return true;
|
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 target = await interaction.options.getUser('user')
|
||||||
let day = await interaction.options.getNumber('day')
|
let day = await interaction.options.getNumber('day')
|
||||||
let month = await interaction.options.getNumber('month')
|
let month = await interaction.options.getNumber('month')
|
||||||
@@ -91,81 +105,39 @@ async function birthdayDelete(interaction) {
|
|||||||
return interaction.reply({ content: "There was an issue!" })
|
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) {
|
async function birthdayGet(interaction) {
|
||||||
let target = await interaction.options.getUser('user')
|
const target = await interaction.options.getUser('user');
|
||||||
const db = mClient.db(process.env.M_DB)
|
const db = mClient.db(process.env.M_DB);
|
||||||
const bdayColl = db.collection('items_birthdays')
|
const bdayColl = db.collection('items_birthdays');
|
||||||
|
|
||||||
const found = await bdayColl.findOne({ userID: target.id })
|
const found = await bdayColl.findOne({ userID: target.id });
|
||||||
if (!found) {
|
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)){
|
const now = new Date();
|
||||||
let nextYear = new Date().getFullYear() + 1
|
const isToday =
|
||||||
unix = await makeTimestamp(found.day,found.month, nextYear)
|
now.getDate() === found.day &&
|
||||||
|
now.getMonth() === (found.month - 1);
|
||||||
|
|
||||||
|
let description;
|
||||||
|
|
||||||
|
if (isToday) {
|
||||||
|
description = `IS TODAY! 🥳🎉`;
|
||||||
} else {
|
} else {
|
||||||
let thisYear = new Date().getFullYear()
|
const unix = getNextBirthdayTimestamp(found.day, found.month);
|
||||||
unix = await makeTimestamp(found.day,found.month, thisYear)
|
description = `is on the <t:${unix}:d>\n<t:${unix}:R>`;
|
||||||
}
|
|
||||||
let description = `is on the <t:${unix}:d>\r\n<t:${unix}:R>`
|
|
||||||
if(isToday(found.day, found.month)){
|
|
||||||
description = `IS TODAY!🥳🎉`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setThumbnail(target.displayAvatarURL())
|
.setThumbnail(target.displayAvatarURL())
|
||||||
.setTitle(`${target.globalName ? target.globalName: target.username}'s Birthday!`)
|
.setTitle(`${target.globalName ?? target.username}'s Birthday...`)
|
||||||
.setDescription(description)
|
.setDescription(description);
|
||||||
await interaction.reply({ embeds: [embed] })
|
|
||||||
|
await interaction.reply({ embeds: [embed] });
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@@ -174,8 +146,8 @@ module.exports = {
|
|||||||
.setDescription('manage birthdays')
|
.setDescription('manage birthdays')
|
||||||
.addSubcommand(s =>
|
.addSubcommand(s =>
|
||||||
s
|
s
|
||||||
.setName('add')
|
.setName('set')
|
||||||
.setDescription('adds a birthday')
|
.setDescription('set date to birthday')
|
||||||
.addUserOption((option) =>
|
.addUserOption((option) =>
|
||||||
option
|
option
|
||||||
.setName('user')
|
.setName('user')
|
||||||
@@ -204,16 +176,6 @@ module.exports = {
|
|||||||
option.setName('user').setDescription('user'))
|
option.setName('user').setDescription('user'))
|
||||||
.addStringOption((option) =>
|
.addStringOption((option) =>
|
||||||
option.setName('id').setDescription('ID')))
|
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 =>
|
.addSubcommand(s =>
|
||||||
s
|
s
|
||||||
.setName('get')
|
.setName('get')
|
||||||
@@ -222,14 +184,14 @@ module.exports = {
|
|||||||
option.setName('user').setDescription('user').setRequired(true))),
|
option.setName('user').setDescription('user').setRequired(true))),
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
switch (interaction.options._subcommand) {
|
switch (interaction.options._subcommand) {
|
||||||
case 'add':
|
case 'set':
|
||||||
if (!interaction.member.permissions.has("ADMINISTRATOR")) {
|
if (!interaction.member.permissions.has("ADMINISTRATOR")) {
|
||||||
return await interaction.reply({
|
return await interaction.reply({
|
||||||
content: "Unprivileged Access!",
|
content: "Unprivileged Access!",
|
||||||
flags: MessageFlags.Ephemeral
|
flags: MessageFlags.Ephemeral
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
birthdayAdd(interaction)
|
birthdaySet(interaction)
|
||||||
break;
|
break;
|
||||||
case 'delete':
|
case 'delete':
|
||||||
if (!interaction.member.permissions.has("ADMINISTRATOR")) {
|
if (!interaction.member.permissions.has("ADMINISTRATOR")) {
|
||||||
@@ -240,15 +202,6 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
birthdayDelete(interaction)
|
birthdayDelete(interaction)
|
||||||
break;
|
break;
|
||||||
case 'edit':
|
|
||||||
if (!interaction.member.permissions.has("ADMINISTRATOR")) {
|
|
||||||
return await interaction.reply({
|
|
||||||
content: "Unprivileged Access!",
|
|
||||||
flags: MessageFlags.Ephemeral
|
|
||||||
})
|
|
||||||
}
|
|
||||||
birthdayEdit(interaction)
|
|
||||||
break;
|
|
||||||
case 'get':
|
case 'get':
|
||||||
birthdayGet(interaction)
|
birthdayGet(interaction)
|
||||||
break;
|
break;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
const { SlashCommandBuilder, Events, MessageFlags } = require('discord.js')
|
const { SlashCommandBuilder, Events, MessageFlags } = require('discord.js')
|
||||||
const { mClient } = require('../..')
|
const { mClient } = require('../../../index')
|
||||||
require('dotenv').config()
|
require('dotenv').config()
|
||||||
|
|
||||||
async function channelSet(interaction) {
|
async function channelSet(interaction) {
|
||||||
@@ -24,6 +24,7 @@ async function channelSet(interaction) {
|
|||||||
content: `Set <#${channel.id}> as ${purpose} channel!`, flags: MessageFlags.Ephemeral
|
content: `Set <#${channel.id}> as ${purpose} channel!`, flags: MessageFlags.Ephemeral
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function channelSimulate(interaction) {
|
async function channelSimulate(interaction) {
|
||||||
const purpose = interaction.options.getString('purpose')
|
const purpose = interaction.options.getString('purpose')
|
||||||
switch (purpose) {
|
switch (purpose) {
|
||||||
@@ -44,6 +45,7 @@ async function channelSimulate(interaction) {
|
|||||||
}
|
}
|
||||||
return interaction.reply({ content: 'Done.', flags: MessageFlags.Ephemeral })
|
return interaction.reply({ content: 'Done.', flags: MessageFlags.Ephemeral })
|
||||||
}
|
}
|
||||||
|
|
||||||
async function roleSet(interaction) {
|
async function roleSet(interaction) {
|
||||||
const guild = interaction.guild
|
const guild = interaction.guild
|
||||||
const purpose = interaction.options.getString('purpose')
|
const purpose = interaction.options.getString('purpose')
|
||||||
@@ -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 { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, UserSelectMenuBuilder, MessageFlags } = require('discord.js')
|
||||||
const { mClient } = require('../..')
|
const { mClient } = require('../../../index')
|
||||||
require('dotenv').config()
|
require('dotenv').config()
|
||||||
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
|
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ async function honorLeaderboard(interaction) {
|
|||||||
})
|
})
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setTitle('- Honors Leaderboard -')
|
.setTitle('- Honors Leaderboard -')
|
||||||
.setThumbnail('https://cdn.discordapp.com/attachments/1152723542836772914/1152940755539722240/pngwing.com.png')
|
.setThumbnail(guild.iconURL({ dynamic: true}))
|
||||||
.setDescription(fields.toString())
|
.setDescription(fields.toString())
|
||||||
.setColor('#5865F2') // Discord's blurple color
|
.setColor('#5865F2') // Discord's blurple color
|
||||||
.setFooter({ text: 'Use ◄ ► to navigate' });
|
.setFooter({ text: 'Use ◄ ► to navigate' });
|
||||||
@@ -171,21 +171,24 @@ async function honorMenu(interaction) {
|
|||||||
const row = new ActionRowBuilder()
|
const row = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setLabel('Honor')
|
|
||||||
.setEmoji(`<:honorhigh:748176295535443968>`)
|
.setEmoji(`<:honorhigh:748176295535443968>`)
|
||||||
.setCustomId('honor_menu_honor')
|
.setCustomId('honor_menu_honor')
|
||||||
.setStyle(ButtonStyle.Primary)
|
.setStyle(ButtonStyle.Success)
|
||||||
)
|
)
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setLabel('Dishonor')
|
|
||||||
.setEmoji(`<:honorlow:748176295132790786>`)
|
.setEmoji(`<:honorlow:748176295132790786>`)
|
||||||
.setCustomId('honor_menu_dishonor')
|
.setCustomId('honor_menu_dishonor')
|
||||||
.setStyle(ButtonStyle.Primary)
|
.setStyle(ButtonStyle.Danger)
|
||||||
|
)
|
||||||
|
.addComponents(
|
||||||
|
new ButtonBuilder()
|
||||||
|
.setEmoji(`❌`)
|
||||||
|
.setCustomId('abort')
|
||||||
|
.setStyle(ButtonStyle.Secondary)
|
||||||
)
|
)
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setLabel('History')
|
|
||||||
.setEmoji('📜')
|
.setEmoji('📜')
|
||||||
.setCustomId('honor_menu_history')
|
.setCustomId('honor_menu_history')
|
||||||
.setStyle(ButtonStyle.Secondary)
|
.setStyle(ButtonStyle.Secondary)
|
||||||
@@ -1,7 +1,11 @@
|
|||||||
const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, MessageFlags } = require('discord.js')
|
const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, MessageFlags, AttachmentBuilder } = require('discord.js')
|
||||||
const { mClient } = require('../..')
|
const { mClient } = require('../../../index')
|
||||||
require('dotenv').config()
|
require('dotenv').config()
|
||||||
|
|
||||||
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
|
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
|
||||||
|
|
||||||
|
const asset_path = './assets/Command_Nuts/'
|
||||||
|
|
||||||
async function nutsGive(interaction) {
|
async function nutsGive(interaction) {
|
||||||
async function tradeWindow(buttonID1, buttonID2) {
|
async function tradeWindow(buttonID1, buttonID2) {
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
@@ -14,7 +18,8 @@ async function nutsGive(interaction) {
|
|||||||
{ name: `Their Current Balance`, value: `${theirBalance.nuts} (**+${amount}**)`, inline: true },
|
{ name: `Their Current Balance`, value: `${theirBalance.nuts} (**+${amount}**)`, inline: true },
|
||||||
{ name: `Their New 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()
|
const row = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
@@ -28,12 +33,14 @@ async function nutsGive(interaction) {
|
|||||||
.setCustomId(buttonID2)
|
.setCustomId(buttonID2)
|
||||||
.setStyle(ButtonStyle.Danger)
|
.setStyle(ButtonStyle.Danger)
|
||||||
)
|
)
|
||||||
|
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
embeds: [embed],
|
embeds: [embed],
|
||||||
components: [row],
|
components: [row],
|
||||||
flags: MessageFlags.Ephemeral
|
flags: MessageFlags.Ephemeral
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const from = interaction.user
|
const from = interaction.user
|
||||||
const to = await interaction.options.getUser('target')
|
const to = await interaction.options.getUser('target')
|
||||||
var amount = await interaction.options.getNumber('amount')
|
var amount = await interaction.options.getNumber('amount')
|
||||||
@@ -42,21 +49,26 @@ async function nutsGive(interaction) {
|
|||||||
const nutsColl = db.collection('items_nuts')
|
const nutsColl = db.collection('items_nuts')
|
||||||
const yourBalance = await nutsColl.findOne({ userID: from.id })
|
const yourBalance = await nutsColl.findOne({ userID: from.id })
|
||||||
const theirBalance = await nutsColl.findOne({ userID: to.id })
|
const theirBalance = await nutsColl.findOne({ userID: to.id })
|
||||||
|
|
||||||
if (amount <= 0) {
|
if (amount <= 0) {
|
||||||
amount = yourBalance.nuts
|
amount = yourBalance.nuts
|
||||||
return tradeWindow('nuts_give_fake', 'abort')
|
return tradeWindow('nuts_give_fake', 'abort')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (yourBalance.nuts < amount) {
|
if (yourBalance.nuts < amount) {
|
||||||
return await interaction.reply({
|
return await interaction.reply({
|
||||||
content: 'Du kannst nicht mehr geben als du hast!',
|
content: 'Du kannst nicht mehr geben als du hast!',
|
||||||
flags: MessageFlags.Ephemeral
|
flags: MessageFlags.Ephemeral
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return tradeWindow('nuts_give_confirm', 'abort')
|
return tradeWindow('nuts_give_confirm', 'abort')
|
||||||
}
|
}
|
||||||
|
|
||||||
async function nutsCheck(interaction) {
|
async function nutsCheck(interaction) {
|
||||||
let target = interaction.options.getUser('target')
|
let target = interaction.options.getUser('target')
|
||||||
let addressing
|
let addressing
|
||||||
|
|
||||||
if (!target) {
|
if (!target) {
|
||||||
target = interaction.user
|
target = interaction.user
|
||||||
addressing = `Du hast`
|
addressing = `Du hast`
|
||||||
@@ -81,6 +93,7 @@ async function nutsCheck(interaction) {
|
|||||||
|
|
||||||
let title = 'Zähle Nüsse'
|
let title = 'Zähle Nüsse'
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
|
|
||||||
for (let i = 0; i < 4; i++) {
|
for (let i = 0; i < 4; i++) {
|
||||||
embed.setTitle(title)
|
embed.setTitle(title)
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
@@ -89,14 +102,17 @@ async function nutsCheck(interaction) {
|
|||||||
title = title + ' .'
|
title = title + ' .'
|
||||||
await delay(500);
|
await delay(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
embed
|
embed
|
||||||
.setTitle(content)
|
.setTitle(content)
|
||||||
.setThumbnail('https://cdn-icons-png.flaticon.com/512/628/628206.png')
|
.setThumbnail('attachment://nuts_main.png')
|
||||||
|
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [embed]
|
embeds: [embed],
|
||||||
|
files: [`${asset_path}nuts_main.png`]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function nutsLeaderboard(interaction) {
|
async function nutsLeaderboard(interaction) {
|
||||||
const row = new ActionRowBuilder()
|
const row = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
@@ -117,88 +133,120 @@ async function nutsLeaderboard(interaction) {
|
|||||||
.setStyle(ButtonStyle.Primary)
|
.setStyle(ButtonStyle.Primary)
|
||||||
.setCustomId('nuts_leaderboard_right')
|
.setCustomId('nuts_leaderboard_right')
|
||||||
)
|
)
|
||||||
|
|
||||||
const db = mClient.db(process.env.M_DB)
|
const db = mClient.db(process.env.M_DB)
|
||||||
const nutsColl = db.collection('items_nuts')
|
const nutsColl = db.collection('items_nuts')
|
||||||
let skip = 0
|
let skip = 0
|
||||||
|
|
||||||
const nutsData = await nutsColl.find({ nuts: { $gt: 0 } }).sort({ nuts: -1 }).skip(skip).limit(5).toArray()
|
const nutsData = await nutsColl.find({ nuts: { $gt: 0 } }).sort({ nuts: -1 }).skip(skip).limit(5).toArray()
|
||||||
|
|
||||||
let fields
|
let fields
|
||||||
let placements = skip + 1
|
let placements = skip + 1
|
||||||
|
|
||||||
nutsData.forEach((data) => {
|
nutsData.forEach((data) => {
|
||||||
fields = (fields ? fields : '') + (`${placements}. <@${data.userID}> : ${data.nuts} Nuts\r\n`)
|
fields = (fields ? fields : '') + (`${placements}. <@${data.userID}> : ${data.nuts} Nuts\r\n`)
|
||||||
|
placements++
|
||||||
})
|
})
|
||||||
|
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setTitle('Nuts Leaderboard')
|
.setTitle('Nuts Leaderboard')
|
||||||
.setThumbnail('https://cdn.discordapp.com/attachments/1152723542836772914/1152940755539722240/pngwing.com.png')
|
.setThumbnail('attachment://nuts_main.png')
|
||||||
.setDescription(fields.toString())
|
.setDescription(fields.toString())
|
||||||
.setColor('#5865F2') // Discord's blurple color
|
.setColor('#5865F2')
|
||||||
.setFooter({ text: 'Use ◄ ► to navigate' });
|
.setFooter({ text: 'Use ◄ ► to navigate' })
|
||||||
|
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [embed],
|
embeds: [embed],
|
||||||
components: [row]
|
components: [row],
|
||||||
|
files: [`${asset_path}nuts_main.png`]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function nutsStats(interaction) {
|
async function nutsStats(interaction) {
|
||||||
const db = mClient.db(process.env.M_DB)
|
const db = mClient.db(process.env.M_DB);
|
||||||
const nStatsColl = db.collection('stats_nuts')
|
const nStatsColl = db.collection('stats_nuts');
|
||||||
const stats = await nStatsColl.find({}).sort({ amount: 1 }).toArray()
|
var type = interaction?.options?.getString('type') || 'lookup'
|
||||||
let nutMin = {
|
var target = interaction?.options?.getUser('lookup') || {}
|
||||||
count: 0,
|
|
||||||
amount: 0
|
if (type == 'global') {
|
||||||
|
target.id = '__global'
|
||||||
|
} else if (!target?.id) {
|
||||||
|
target = interaction.user
|
||||||
}
|
}
|
||||||
let nutMax = {
|
|
||||||
count: 0,
|
const statsDoc = await nStatsColl.findOne({ userID: target.id });
|
||||||
amount: 0
|
const stat = statsDoc?.stat || {};
|
||||||
|
|
||||||
|
const totalCount = Object.values(stat).reduce((a, b) => a + b, 0);
|
||||||
|
const totalNuts = Object.entries(stat).reduce(
|
||||||
|
(sum, [num, count]) => sum + Number(num) * count,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
|
const rolledNumbers = Object.entries(stat).filter(([_, count]) => count > 0);
|
||||||
|
|
||||||
|
let nutMin = { number: 0, count: 0 };
|
||||||
|
let nutMax = { number: 0, count: 0 };
|
||||||
|
|
||||||
|
if (rolledNumbers.length > 0) {
|
||||||
|
nutMin = nutMax = { number: Number(rolledNumbers[0][0]), count: rolledNumbers[0][1] };
|
||||||
|
|
||||||
|
for (const [numStr, count] of rolledNumbers) {
|
||||||
|
const num = Number(numStr);
|
||||||
|
|
||||||
|
if (count > nutMax.count || (count === nutMax.count && num > nutMax.number)) {
|
||||||
|
nutMax = { number: num, count };
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count < nutMin.count || (count === nutMin.count && num < nutMin.number)) {
|
||||||
|
nutMin = { number: num, count };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
let totalNuts = 0
|
|
||||||
let totalCount = 0
|
const nutAvg = totalCount ? totalNuts / totalCount : 0;
|
||||||
stats.forEach(stat => {
|
|
||||||
totalCount += stat.count
|
const fields = Array.from({ length: 11 }, (_, i) => ({
|
||||||
totalNuts += (stat.count * stat.amount)
|
name: `[${i}]`,
|
||||||
if (nutMin.count > stat.count) { nutMin = stat }
|
value: `x${stat[i] ?? 0}`,
|
||||||
if (nutMax.count < stat.count) { nutMax = stat }
|
inline: true
|
||||||
})
|
}));
|
||||||
let nutAvg = totalNuts / totalCount
|
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setTitle("Nut Statistic")
|
.setTitle("Nut Statistic")
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`Total Nut Actions: **${totalCount}**\r\n
|
`Total Nut Actions: **${totalCount}**\r\n` +
|
||||||
Total Nuts nutted: **${totalNuts}**\r\n
|
`Total Nuts nutted: **${totalNuts}**\r\n` +
|
||||||
Nut Average: **${nutAvg.toFixed(3)}**\r\n
|
`Nut Average: **${nutAvg.toFixed(3)}**\r\n` +
|
||||||
Best Nut: **${nutMax.amount}**\r\n
|
`Most Common Nut: **${nutMax.number} (x${nutMax.count})**\r\n` +
|
||||||
Worst Nut: **${nutMin.amount}**`
|
`Least Common Nut: **${nutMin.number} (x${nutMin.count})**`
|
||||||
)
|
|
||||||
.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 }
|
|
||||||
)
|
)
|
||||||
|
.addFields(fields)
|
||||||
.setColor(0x51267)
|
.setColor(0x51267)
|
||||||
.setTimestamp()
|
.setTimestamp()
|
||||||
.setThumbnail(interaction.guild.iconURL())
|
.setThumbnail('attachment://nuts_main.png')
|
||||||
|
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [embed]
|
embeds: [embed],
|
||||||
})
|
files: [`${asset_path}nuts_main.png`]
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function nutsCooldown(interaction) {
|
async function nutsCooldown(interaction) {
|
||||||
const db = mClient.db(process.env.M_DB)
|
const db = mClient.db(process.env.M_DB)
|
||||||
const nutsColl = db.collection('items_cooldowns')
|
const nutsColl = db.collection('items_cooldowns')
|
||||||
const cooldown = await nutsColl.findOne({ userID: interaction.user.id })
|
const cooldown = await nutsColl.findOne({ userID: interaction.user.id })
|
||||||
|
|
||||||
let content = `Du kannst wieder nussen! :)`
|
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 title = 'Go Nuts!'
|
||||||
|
|
||||||
let date = (Date.now() / 1000)
|
let date = (Date.now() / 1000)
|
||||||
if (cooldown.cooldown > date) {
|
if (cooldown.cooldown > date) {
|
||||||
content = `<t:${cooldown.cooldown}:R> kannst du wieder nussen! ;)`
|
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...'
|
title = 'To Nut or Not to Nut...'
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,85 +256,112 @@ async function nutsCooldown(interaction) {
|
|||||||
.setDescription(content)
|
.setDescription(content)
|
||||||
|
|
||||||
await interaction.editReply({
|
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 db = mClient.db(process.env.M_DB)
|
||||||
const nutsColl = db.collection('items_nuts')
|
const nutsColl = db.collection('items_nuts')
|
||||||
const cdColl = db.collection('items_cooldowns')
|
const cdColl = db.collection('items_cooldowns')
|
||||||
|
const nutsStatsColl = db.collection('stats_nuts')
|
||||||
|
|
||||||
const cdData = await cdColl.findOne({ userID: interaction.user.id })
|
const cdData = await cdColl.findOne({ userID: interaction.user.id })
|
||||||
const embed = new EmbedBuilder()
|
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')
|
|
||||||
|
|
||||||
let content
|
const assets = {
|
||||||
const images = {
|
high: 'attachment://nuts_high.jpg',
|
||||||
"high": "https://as2.ftcdn.net/v2/jpg/02/24/65/39/1000_F_224653943_r3xltiwJsK6am0mGZE5DTWk1yocUwHLd.jpg",
|
normal: 'attachment://nuts_normal.jpg',
|
||||||
"normal": 'https://c8.alamy.com/comp/PPPBXK/surprised-pecan-nuts-pile-on-plate-cartoon-PPPBXK.jpg',
|
low: 'attachment://nuts_low.jpg',
|
||||||
"low": 'https://as2.ftcdn.net/v2/jpg/02/24/65/37/1000_F_224653769_ceJk0tq9UT1hSu5FIVUi7BeaN4ucSZGv.jpg',
|
none: 'attachment://nuts_none.avif',
|
||||||
"none": 'https://cdn4.vectorstock.com/i/1000x1000/87/08/afraid-pecan-nuts-pile-on-plate-cartoon-vector-22028708.jpg',
|
onCD: 'attachment://nuts_onCD.avif',
|
||||||
"onCD": 'https://cdn.discordapp.com/attachments/1152723542836772914/1152987472788193361/No-nuts-PhotoRoom.png-PhotoRoom.png'
|
box: 'attachment://nuts_box.png',
|
||||||
|
explosion: 'attachment://nuts_explosion.gif'
|
||||||
}
|
}
|
||||||
let image
|
|
||||||
if (!cdData || cdData.cooldown < (Date.now() / 1000)) {
|
// Helper for singular/plural
|
||||||
let cd = Math.floor((Date.now() + 3600000) / 1000)
|
const formatNut = (amount) => `${amount} ${amount === 1 ? 'Nuss' : 'Nüsse'}`
|
||||||
await cdColl.findOneAndUpdate({
|
|
||||||
userID: interaction.user.id
|
// check cooldown
|
||||||
}, {
|
if (cdData?.cooldown > Date.now() / 1000) {
|
||||||
$set: { cooldown: cd }
|
// on cooldown
|
||||||
}, {
|
embed.setTitle('To Nut or Not to Nut...')
|
||||||
upsert: true
|
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`]
|
||||||
})
|
})
|
||||||
|
}
|
||||||
const amount = Math.floor(Math.random() * 10)
|
// set 1 hour cooldown
|
||||||
|
const cd = Math.floor((Date.now() + 3600000) / 1000)
|
||||||
await nutsColl.findOneAndUpdate({
|
await cdColl.findOneAndUpdate({
|
||||||
userID: interaction.user.id
|
userID: interaction.user.id
|
||||||
}, {
|
}, {
|
||||||
$inc: { nuts: amount }
|
$set: {
|
||||||
}, {
|
cooldown: cd,
|
||||||
upsert: true
|
application: 'nuts'
|
||||||
})
|
|
||||||
|
|
||||||
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 :(`
|
upsert: true
|
||||||
image = images["onCD"]
|
})
|
||||||
await delay(1000)
|
|
||||||
embed.setDescription(content)
|
// generate nut amount
|
||||||
embed.setThumbnail(image)
|
const amount = Math.floor(Math.random() * 10)
|
||||||
return await interaction.editReply({
|
|
||||||
embeds: [embed]
|
// 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: "__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({
|
await interaction.editReply({
|
||||||
embeds: [embed]
|
embeds: [embed],
|
||||||
|
files: [`${asset_path}nuts_box.png`]
|
||||||
})
|
})
|
||||||
await delay(1000)
|
await delay(1337)
|
||||||
embed.setThumbnail('https://i.pinimg.com/originals/9d/58/37/9d5837c6f0cb8b18be6ddd1e2742472a.gif')
|
embed.setImage(assets.explosion)
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [embed]
|
embeds: [embed],
|
||||||
|
files: [`${asset_path}nuts_explosion.gif`]
|
||||||
})
|
})
|
||||||
|
await delay(1337)
|
||||||
|
|
||||||
await delay(1000)
|
let assetFile
|
||||||
embed.setDescription(content)
|
if (amount === 0) assetFile = assets.none
|
||||||
embed.setThumbnail(image)
|
else if (amount > 8) assetFile = assets.high
|
||||||
await interaction.editReply({
|
else if (amount > 4) assetFile = assets.normal
|
||||||
embeds: [embed]
|
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]}`]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@@ -313,7 +388,20 @@ module.exports = {
|
|||||||
.addSubcommand(s =>
|
.addSubcommand(s =>
|
||||||
s
|
s
|
||||||
.setName('stats')
|
.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 =>
|
.addSubcommand(s =>
|
||||||
s
|
s
|
||||||
.setName('cooldown')
|
.setName('cooldown')
|
||||||
@@ -321,7 +409,12 @@ module.exports = {
|
|||||||
.addSubcommand(s =>
|
.addSubcommand(s =>
|
||||||
s
|
s
|
||||||
.setName('nut')
|
.setName('nut')
|
||||||
.setDescription('willst du nuss?')),
|
.setDescription('willst du nuss?'))
|
||||||
|
.addSubcommand(s =>
|
||||||
|
s.setName('quick')
|
||||||
|
.setDescription('A quick nut, mlord?')
|
||||||
|
|
||||||
|
),
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
switch (interaction.options._subcommand) {
|
switch (interaction.options._subcommand) {
|
||||||
case 'give':
|
case 'give':
|
||||||
@@ -345,10 +438,14 @@ module.exports = {
|
|||||||
break;
|
break;
|
||||||
case 'nut':
|
case 'nut':
|
||||||
await interaction.deferReply()
|
await interaction.deferReply()
|
||||||
nutsNut(interaction)
|
nutsNut(interaction, false)
|
||||||
|
break;
|
||||||
|
case 'quick':
|
||||||
|
await interaction.deferReply()
|
||||||
|
nutsNut(interaction, true)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,11 +3,12 @@ Random By Year?
|
|||||||
Counter (Leaderboard)
|
Counter (Leaderboard)
|
||||||
*/
|
*/
|
||||||
const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, UserSelectMenuBuilder, MessageFlags } = require('discord.js')
|
const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, UserSelectMenuBuilder, MessageFlags } = require('discord.js')
|
||||||
const { mClient } = require('../..')
|
const { mClient } = require('../../../index')
|
||||||
require('dotenv').config()
|
require('dotenv').config()
|
||||||
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
|
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
|
||||||
|
|
||||||
async function quotesAdd(interaction) {
|
async function quotesAdd(interaction) {
|
||||||
|
|
||||||
const messageLink = await interaction.options.getString('link')
|
const messageLink = await interaction.options.getString('link')
|
||||||
//regex for message link
|
//regex for message link
|
||||||
const regex = /^https:\/\/discord\.com\/channels\/\d+\/\d+\/\d+$/
|
const regex = /^https:\/\/discord\.com\/channels\/\d+\/\d+\/\d+$/
|
||||||
@@ -56,7 +57,7 @@ async function quotesAdd(interaction) {
|
|||||||
messageID: messageID,
|
messageID: messageID,
|
||||||
channelID: channelID,
|
channelID: channelID,
|
||||||
guildID: guildID,
|
guildID: guildID,
|
||||||
by: msgData.author.id,
|
userID: msgData.author.id,
|
||||||
count: 0
|
count: 0
|
||||||
}
|
}
|
||||||
}, { upsert: true })
|
}, { upsert: true })
|
||||||
@@ -163,7 +164,7 @@ async function quotesRandom(interaction) {
|
|||||||
if (user) {
|
if (user) {
|
||||||
rdm = await quotesColl.aggregate([
|
rdm = await quotesColl.aggregate([
|
||||||
{
|
{
|
||||||
$match: { by: user.id },
|
$match: { userID: user.id },
|
||||||
}, {
|
}, {
|
||||||
$sample: { size: 1 }
|
$sample: { size: 1 }
|
||||||
}
|
}
|
||||||
@@ -176,7 +177,7 @@ async function quotesRandom(interaction) {
|
|||||||
]).toArray()
|
]).toArray()
|
||||||
}
|
}
|
||||||
const found = rdm[0]
|
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 guild = await interaction.client.guilds.fetch(found.guildID)
|
||||||
const channel = await guild.channels.fetch(found.channelID)
|
const channel = await guild.channels.fetch(found.channelID)
|
||||||
const message = await channel.messages.fetch(found.messageID)
|
const message = await channel.messages.fetch(found.messageID)
|
||||||
@@ -267,71 +268,87 @@ async function quotesList(interaction) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
async function quotesLeaderboard(interaction) {
|
async function quotesLeaderboard(interaction, page = 1, limit = 5) {
|
||||||
const db = mClient.db(process.env.M_DB)
|
const db = mClient.db(process.env.M_DB);
|
||||||
const quotesColl = db.collection('items_quotes')
|
const quotesColl = db.collection('items_quotes');
|
||||||
let skip = 0
|
|
||||||
const minValue = 0
|
|
||||||
const maxValue = await quotesColl.countDocuments({ $and: [{ guildID: interaction.guild.id }, { count: { $gt: 0 } }] })
|
|
||||||
|
|
||||||
const quotesData = await quotesColl.find({}).sort({ count: -1, messageID: -1 }).skip(skip).limit(5).toArray()
|
|
||||||
const fields = []
|
|
||||||
|
|
||||||
const guild = await interaction.client.guilds.fetch(interaction.guild.id)
|
// Total quotes in the guild
|
||||||
quotesData.forEach(async (data, index) => {
|
const totalQuotes = await quotesColl.countDocuments({ guildID: interaction.guild.id, count: { $gte: 0 } });
|
||||||
|
const totalPages = Math.ceil(totalQuotes / limit);
|
||||||
|
|
||||||
let channel = await guild.channels.fetch(data.channelID)
|
// Clamp page
|
||||||
let message = await channel.messages.fetch(data.messageID)
|
if (page < 1) page = 1;
|
||||||
|
if (page > totalPages) page = totalPages;
|
||||||
await delay(500)
|
|
||||||
let timestamp = new Date(message.createdTimestamp)
|
const skip = (page - 1) * limit;
|
||||||
fields.push({
|
|
||||||
name: `${index + 1}.`,//`\u200b` ,
|
// Fetch quotes for this page
|
||||||
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}`
|
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()
|
const embed = new EmbedBuilder()
|
||||||
.setTitle('- Quotes Leaderboard -')
|
.setTitle('- Quotes Leaderboard -')
|
||||||
.setThumbnail('https://cdn.discordapp.com/attachments/1152723542836772914/1152940755539722240/pngwing.com.png')
|
.setThumbnail(guild.iconURL({ dynamic: true }))
|
||||||
.setFields(fields)
|
.setFields(fields)
|
||||||
.setColor('#5865F2') // Discord's blurple color
|
.setColor('#5865F2')
|
||||||
.setFooter({ text: `Use ◄ ► to navigate\r\n${skip}` });
|
.setFooter({ text: `Use ◄ ► to navigate • Page ${page} of ${totalPages}` });
|
||||||
|
|
||||||
|
// Build buttons
|
||||||
const row = new ActionRowBuilder()
|
const row = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setLabel('◄')
|
.setLabel('◄')
|
||||||
.setStyle(ButtonStyle.Primary)
|
.setStyle(ButtonStyle.Primary)
|
||||||
.setCustomId('quotes_leaderboard_left')
|
.setCustomId('quotes_leaderboard_left')
|
||||||
)
|
.setDisabled(page === 1),
|
||||||
.addComponents(
|
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setLabel('X')
|
.setLabel('X')
|
||||||
.setStyle(ButtonStyle.Danger)
|
.setStyle(ButtonStyle.Danger)
|
||||||
.setCustomId('abort')
|
.setCustomId('abort'),
|
||||||
)
|
|
||||||
.addComponents(
|
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setLabel('►')
|
.setLabel('►')
|
||||||
.setStyle(ButtonStyle.Primary)
|
.setStyle(ButtonStyle.Primary)
|
||||||
.setCustomId('quotes_leaderboard_right')
|
.setCustomId('quotes_leaderboard_right')
|
||||||
)
|
.setDisabled(page === totalPages)
|
||||||
await interaction.editReply({
|
);
|
||||||
embeds: [embed],
|
|
||||||
components: [row]
|
await interaction.editReply({ embeds: [embed], components: [row] });
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@@ -341,7 +358,7 @@ module.exports = {
|
|||||||
.addSubcommand(s =>
|
.addSubcommand(s =>
|
||||||
s
|
s
|
||||||
.setName('add')
|
.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)))
|
.addStringOption(o => o.setName('link').setDescription('insert message link').setRequired(true)))
|
||||||
.addSubcommand(s =>
|
.addSubcommand(s =>
|
||||||
s
|
s
|
||||||
@@ -392,4 +409,6 @@ module.exports = {
|
|||||||
break;
|
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
|
// Draw Initial Image
|
||||||
const background = await loadImage(
|
const background = await loadImage(
|
||||||
path.join(__dirname, '../assets/bdbanner.png')
|
path.join(__dirname, '../assets/Event_Birthday/bdbanner.png')
|
||||||
);
|
);
|
||||||
let x = 0;
|
let x = 0;
|
||||||
let y = 0;
|
let y = 0;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ module.exports = {
|
|||||||
// Fetch birthday role
|
// Fetch birthday role
|
||||||
const bdayRoleColl = db.collection('config_roles');
|
const bdayRoleColl = db.collection('config_roles');
|
||||||
const bdayRoleEntry = await bdayRoleColl.findOne({ guildID: guild.id });
|
const bdayRoleEntry = await bdayRoleColl.findOne({ guildID: guild.id });
|
||||||
const birthdayRoleID = bdayRoleEntry.roleID;
|
const birthdayRoleID = bdayRoleEntry?.roleID;
|
||||||
|
|
||||||
if (!birthdayRoleID) {
|
if (!birthdayRoleID) {
|
||||||
console.warn("No birthday role configured in DB");
|
console.warn("No birthday role configured in DB");
|
||||||
@@ -54,7 +54,7 @@ module.exports = {
|
|||||||
console.error(`Failed to add birthday role to ${member.user.tag}:`, err)
|
console.error(`Failed to add birthday role to ${member.user.tag}:`, err)
|
||||||
);
|
);
|
||||||
console.log(`Added birthday role to ${member.user.tag}`);
|
console.log(`Added birthday role to ${member.user.tag}`);
|
||||||
client.emit('Birthday', member);
|
//client.emit('Birthday', member);
|
||||||
} else {
|
} else {
|
||||||
// Default fallback: remove birthday role if present
|
// Default fallback: remove birthday role if present
|
||||||
if (member.roles.cache.has(birthdayRoleID)) {
|
if (member.roles.cache.has(birthdayRoleID)) {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ module.exports = {
|
|||||||
|
|
||||||
// Draw Initial Image
|
// Draw Initial Image
|
||||||
const background = await loadImage(
|
const background = await loadImage(
|
||||||
path.join(__dirname, '../assets/background.png')
|
path.join(__dirname, '../assets/Event_MemberJoin/background.png')
|
||||||
);
|
);
|
||||||
let x = 0;
|
let x = 0;
|
||||||
let y = 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) => {
|
module.exports = (client) => {
|
||||||
let commands = [] // only used for REST API
|
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);
|
const commandFolders = fs.readdirSync(foldersPath);
|
||||||
for (const folder of commandFolders) {
|
for (const folder of commandFolders) {
|
||||||
// Grab all the command files from the commands directory you created earlier
|
// 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 target = await interaction.guild.members.fetch(interaction.members.keys().next().value)
|
||||||
const db = mClient.db(process.env.M_DB)
|
const db = mClient.db(process.env.M_DB)
|
||||||
const quotesColl = db.collection('items_quotes')
|
const quotesColl = db.collection('items_quotes')
|
||||||
const quotes = await quotesColl.find({ by: target.id }).toArray()
|
const quotes = await quotesColl.find({ userID: target.id }).toArray()
|
||||||
const member = interaction.message.guild.members.cache.get(target.user.id)
|
const member = interaction.message.guild.members.cache.get(target.user.id)
|
||||||
const memberRoles = member.roles.cache
|
const memberRoles = member.roles.cache
|
||||||
.filter((roles) => roles.id !== interaction.message.guild.id)
|
.filter((roles) => roles.id !== interaction.message.guild.id)
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
module.exports =
|
||||||
|
function ping(interface, args, type){
|
||||||
|
if (type = 'legacy'){
|
||||||
|
// type = legacy
|
||||||
|
interface.reply('pang!')
|
||||||
|
} else {
|
||||||
|
interface.reply('pong!')
|
||||||
|
}
|
||||||
|
}
|
||||||