added MemberJoin
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 536 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 158 KiB |
@@ -1,82 +1,82 @@
|
|||||||
const { EmbedBuilder, UserSelectMenuBuilder, ActionRowBuilder } = require("discord.js")
|
const { EmbedBuilder, UserSelectMenuBuilder, ActionRowBuilder } = require("discord.js")
|
||||||
const { mClient } = require("../..")
|
const { mClient } = require("../..")
|
||||||
require('dotenv').config()
|
require('dotenv').config()
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'quotes_list_left',
|
name: 'quotes_list_left',
|
||||||
description: 'navigate left',
|
description: 'navigate left',
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
let oldEmbed = interaction.message.embeds[0].data
|
let oldEmbed = interaction.message.embeds[0].data
|
||||||
if (!oldEmbed.footer) { return interaction.reply({ content: 'Please use a Filter', ephemeral: true }) }
|
if (!oldEmbed.footer) { return interaction.reply({ content: 'Please use a Filter', ephemeral: true }) }
|
||||||
if (oldEmbed.fields && oldEmbed.fields[0].value == 0) { return interaction.reply({ content: 'This User has no Quotes', ephemeral: true }) }
|
if (oldEmbed.fields && oldEmbed.fields[0].value == 0) { return interaction.reply({ content: 'This User has no Quotes', ephemeral: true }) }
|
||||||
|
|
||||||
let userID = interaction.message.embeds[0].data.footer.text.split(' ')[5].slice(2, -1)
|
let userID = interaction.message.embeds[0].data.footer.text.split(' ')[5].slice(2, -1)
|
||||||
const target = await interaction.guild.members.fetch(userID)
|
const target = await interaction.guild.members.fetch(userID)
|
||||||
if (!target) { return interaction.reply({ content: 'Please use a Filter', ephemeral: true }) }
|
if (!target) { return interaction.reply({ content: 'Please use a Filter', ephemeral: true }) }
|
||||||
|
|
||||||
const db = mClient.db(process.env.M_DB)
|
const db = mClient.db(process.env.M_DB)
|
||||||
const quotesColl = db.collection('quotes')
|
const quotesColl = db.collection('quotes')
|
||||||
const quotes = await quotesColl.find({ by: target.id }).toArray()
|
const quotes = await quotesColl.find({ by: 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 }
|
||||||
index = index - 2
|
index = index - 2
|
||||||
if (index < 1) { index = 0 }
|
if (index < 1) { index = 0 }
|
||||||
|
|
||||||
|
|
||||||
const found = quotes[index]
|
const found = quotes[index]
|
||||||
|
|
||||||
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)
|
||||||
|
|
||||||
var msgData = {
|
var msgData = {
|
||||||
content: message.content,
|
content: message.content,
|
||||||
author: await message.author,
|
author: await message.author,
|
||||||
reference: await message.reference,
|
reference: await message.reference,
|
||||||
embed: await message.embeds ? 'embed' : null
|
embed: await message.embeds ? 'embed' : null
|
||||||
} // debug
|
} // debug
|
||||||
if (msgData.reference) {
|
if (msgData.reference) {
|
||||||
let refMessage = await channel.messages.fetch(msgData.reference.messageId)
|
let refMessage = await channel.messages.fetch(msgData.reference.messageId)
|
||||||
var refData = {
|
var refData = {
|
||||||
content: refMessage.content,
|
content: refMessage.content,
|
||||||
author: await refMessage.author,
|
author: await refMessage.author,
|
||||||
embed: await refMessage.embeds.length > 0 ? 'embed' : null
|
embed: await refMessage.embeds.length > 0 ? 'embed' : null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var description = ''
|
var description = ''
|
||||||
if (refData) {
|
if (refData) {
|
||||||
description += `> ${refData.author}`
|
description += `> ${refData.author}`
|
||||||
if (refData.embed) {
|
if (refData.embed) {
|
||||||
description += '*an embed / a command* '
|
description += '*an embed / a command* '
|
||||||
} else {
|
} else {
|
||||||
description += refData.content
|
description += refData.content
|
||||||
}
|
}
|
||||||
description += `\r\n↳`
|
description += `\r\n↳`
|
||||||
}
|
}
|
||||||
let messageLink = `https://discord.com/channels/${found.guildID}/${found.channelID}/${found.messageID}`
|
let messageLink = `https://discord.com/channels/${found.guildID}/${found.channelID}/${found.messageID}`
|
||||||
description += `${msgData.author} ${msgData.content}\r\n\r\n${messageLink}`
|
description += `${msgData.author} ${msgData.content}\r\n\r\n${messageLink}`
|
||||||
let timestamp = new Date(message.createdTimestamp)
|
let timestamp = new Date(message.createdTimestamp)
|
||||||
let footer = timestamp.toDateString().toString()
|
let footer = timestamp.toDateString().toString()
|
||||||
|
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setThumbnail(msgData.author.displayAvatarURL())
|
.setThumbnail(msgData.author.displayAvatarURL())
|
||||||
.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.by}>`) })
|
||||||
const select = new ActionRowBuilder()
|
const select = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new UserSelectMenuBuilder()
|
new UserSelectMenuBuilder()
|
||||||
.setCustomId('quotes_list_mentionable')
|
.setCustomId('quotes_list_mentionable')
|
||||||
.setPlaceholder('Filter By User')
|
.setPlaceholder('Filter By User')
|
||||||
)
|
)
|
||||||
|
|
||||||
const row = interaction.message.components[1]
|
const row = interaction.message.components[1]
|
||||||
await interaction.update({
|
await interaction.update({
|
||||||
embeds: [embed],
|
embeds: [embed],
|
||||||
components: [select, row]
|
components: [select, row]
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,82 +1,82 @@
|
|||||||
const { EmbedBuilder, UserSelectMenuBuilder, ActionRowBuilder } = require("discord.js")
|
const { EmbedBuilder, UserSelectMenuBuilder, ActionRowBuilder } = require("discord.js")
|
||||||
const { mClient } = require("../..")
|
const { mClient } = require("../..")
|
||||||
require('dotenv').config()
|
require('dotenv').config()
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'quotes_list_right',
|
name: 'quotes_list_right',
|
||||||
description: 'navigate right',
|
description: 'navigate right',
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
let oldEmbed = interaction.message.embeds[0].data
|
let oldEmbed = interaction.message.embeds[0].data
|
||||||
if (!oldEmbed.footer) { return interaction.reply({ content: 'Please use a Filter', ephemeral: true }) }
|
if (!oldEmbed.footer) { return interaction.reply({ content: 'Please use a Filter', ephemeral: true }) }
|
||||||
if (oldEmbed.fields && oldEmbed.fields[0].value == 0) { return interaction.reply({ content: 'This User has no Quotes', ephemeral: true }) }
|
if (oldEmbed.fields && oldEmbed.fields[0].value == 0) { return interaction.reply({ content: 'This User has no Quotes', ephemeral: true }) }
|
||||||
|
|
||||||
let userID = interaction.message.embeds[0].data.footer.text.split(' ')[5].slice(2, -1)
|
let userID = interaction.message.embeds[0].data.footer.text.split(' ')[5].slice(2, -1)
|
||||||
const target = await interaction.guild.members.fetch(userID)
|
const target = await interaction.guild.members.fetch(userID)
|
||||||
if (!target) { return interaction.reply({ content: 'Please use a Filter', ephemeral: true }) }
|
if (!target) { return interaction.reply({ content: 'Please use a Filter', ephemeral: true }) }
|
||||||
|
|
||||||
const db = mClient.db(process.env.M_DB)
|
const db = mClient.db(process.env.M_DB)
|
||||||
const quotesColl = db.collection('quotes')
|
const quotesColl = db.collection('quotes')
|
||||||
const quotes = await quotesColl.find({ by: target.id }).toArray()
|
const quotes = await quotesColl.find({ by: 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 }
|
||||||
//if (index >= quotes.length){ return interaction.reply({content: 'Max Quotes Reached', ephemeral: true})}
|
//if (index >= quotes.length){ return interaction.reply({content: 'Max Quotes Reached', ephemeral: true})}
|
||||||
if (index >= quotes.length) { index-- }
|
if (index >= quotes.length) { index-- }
|
||||||
|
|
||||||
// will automatically reflect the next index due to how arrays think
|
// will automatically reflect the next index due to how arrays think
|
||||||
|
|
||||||
const found = quotes[index]
|
const found = quotes[index]
|
||||||
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)
|
||||||
|
|
||||||
var msgData = {
|
var msgData = {
|
||||||
content: message.content,
|
content: message.content,
|
||||||
author: await message.author,
|
author: await message.author,
|
||||||
reference: await message.reference,
|
reference: await message.reference,
|
||||||
embed: await message.embeds ? 'embed' : null
|
embed: await message.embeds ? 'embed' : null
|
||||||
} // debug
|
} // debug
|
||||||
if (msgData.reference) {
|
if (msgData.reference) {
|
||||||
let refMessage = await channel.messages.fetch(msgData.reference.messageId)
|
let refMessage = await channel.messages.fetch(msgData.reference.messageId)
|
||||||
var refData = {
|
var refData = {
|
||||||
content: refMessage.content,
|
content: refMessage.content,
|
||||||
author: await refMessage.author,
|
author: await refMessage.author,
|
||||||
embed: await refMessage.embeds.length > 0 ? 'embed' : null
|
embed: await refMessage.embeds.length > 0 ? 'embed' : null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var description = ''
|
var description = ''
|
||||||
if (refData) {
|
if (refData) {
|
||||||
description += `> ${refData.author}`
|
description += `> ${refData.author}`
|
||||||
if (refData.embed) {
|
if (refData.embed) {
|
||||||
description += '*an embed / a command* '
|
description += '*an embed / a command* '
|
||||||
} else {
|
} else {
|
||||||
description += refData.content
|
description += refData.content
|
||||||
}
|
}
|
||||||
description += `\r\n↳`
|
description += `\r\n↳`
|
||||||
}
|
}
|
||||||
let messageLink = `https://discord.com/channels/${found.guildID}/${found.channelID}/${found.messageID}`
|
let messageLink = `https://discord.com/channels/${found.guildID}/${found.channelID}/${found.messageID}`
|
||||||
description += `${msgData.author} ${msgData.content}\r\n\r\n${messageLink}`
|
description += `${msgData.author} ${msgData.content}\r\n\r\n${messageLink}`
|
||||||
let timestamp = new Date(message.createdTimestamp)
|
let timestamp = new Date(message.createdTimestamp)
|
||||||
let footer = timestamp.toDateString().toString()
|
let footer = timestamp.toDateString().toString()
|
||||||
|
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setThumbnail(msgData.author.displayAvatarURL())
|
.setThumbnail(msgData.author.displayAvatarURL())
|
||||||
.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.by}>`) })
|
||||||
const select = new ActionRowBuilder()
|
const select = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new UserSelectMenuBuilder()
|
new UserSelectMenuBuilder()
|
||||||
.setCustomId('quotes_list_mentionable')
|
.setCustomId('quotes_list_mentionable')
|
||||||
.setPlaceholder('Filter By User')
|
.setPlaceholder('Filter By User')
|
||||||
)
|
)
|
||||||
|
|
||||||
const row = interaction.message.components[1]
|
const row = interaction.message.components[1]
|
||||||
await interaction.update({
|
await interaction.update({
|
||||||
embeds: [embed],
|
embeds: [embed],
|
||||||
components: [select, row]
|
components: [select, row]
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
const { SlashCommandBuilder, Events } = require('discord.js')
|
||||||
|
module.exports = {
|
||||||
|
data: new SlashCommandBuilder()
|
||||||
|
.setName('simjoin')
|
||||||
|
.setDescription('simulates a join event')
|
||||||
|
.addMentionableOption((option) =>
|
||||||
|
option.setName('target').setDescription('user')),
|
||||||
|
async execute(interaction) {
|
||||||
|
|
||||||
|
if(!interaction.member.permissions.has("ADMINISTRATOR")){
|
||||||
|
return await interaction.reply({
|
||||||
|
content: "Unprivileged Access!",
|
||||||
|
ephemeral: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
let target = interaction.options.getMentionable('target')
|
||||||
|
if(!target){
|
||||||
|
target = interaction.member
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if(target.user.username){
|
||||||
|
interaction.client.emit(Events.GuildMemberAdd, target)
|
||||||
|
await interaction.reply({
|
||||||
|
content: "Done!",
|
||||||
|
ephemeral: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
await interaction.reply({
|
||||||
|
content: "Invalid Mentionable!",
|
||||||
|
ephemeral: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
name: 'DistubeError',
|
|
||||||
once: true,
|
|
||||||
async execute(channel, error) {
|
|
||||||
console.log({
|
|
||||||
channel: channel,
|
|
||||||
error: error
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
const { Events } = require('discord.js');
|
||||||
|
const { createCanvas, loadImage } = require('canvas');
|
||||||
|
const path = require('node:path');
|
||||||
|
require('dotenv').configDotenv();
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: Events.GuildMemberAdd,
|
||||||
|
once: false,
|
||||||
|
async execute(member, client) {
|
||||||
|
const guild = client.guilds.cache.get(process.env.D_GuildID);
|
||||||
|
const channel = guild.channels.cache.get(process.env.D_WelcomeID);
|
||||||
|
console.log(`${member.user.username} joined the Server`);
|
||||||
|
|
||||||
|
// Create Canvas
|
||||||
|
let canvasWidth = 600;
|
||||||
|
let canvasHeight = 250;
|
||||||
|
const canvas = new createCanvas(canvasWidth, canvasHeight);
|
||||||
|
const ctx = canvas.getContext('2d');
|
||||||
|
|
||||||
|
// Draw Initial Image
|
||||||
|
const background = await loadImage(
|
||||||
|
path.join(__dirname, '../assets/background.png')
|
||||||
|
);
|
||||||
|
let x = 0;
|
||||||
|
let y = 0;
|
||||||
|
ctx.drawImage(background, x, y);
|
||||||
|
|
||||||
|
// Create Profile Picture
|
||||||
|
const pfp = await loadImage(
|
||||||
|
member.user.displayAvatarURL({
|
||||||
|
extension: 'jpg',
|
||||||
|
size: 64,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
// Draw Profile Picture on Top of Background
|
||||||
|
x = canvas.width / 2 - pfp.width / 2;
|
||||||
|
y = 20;
|
||||||
|
ctx.drawImage(pfp, x, y);
|
||||||
|
|
||||||
|
// Set styles for text
|
||||||
|
ctx.font = '35px sans-serif';
|
||||||
|
ctx.fillStyle = '#ffffff'; // White text
|
||||||
|
ctx.strokeStyle = '#000000'; // Black outline
|
||||||
|
ctx.lineWidth = 3; // Thickness of the outline
|
||||||
|
|
||||||
|
let text = `Willkommen, ${member.user.username}!`;
|
||||||
|
let textWidth = ctx.measureText(text).width;
|
||||||
|
let textX = canvas.width / 2 - textWidth / 2;
|
||||||
|
let textHeight = 35; // Approximate height of the text
|
||||||
|
|
||||||
|
// Draw the text with black outline
|
||||||
|
ctx.strokeText(text, textX, 60 + pfp.height);
|
||||||
|
ctx.fillText(text, textX, 60 + pfp.height);
|
||||||
|
|
||||||
|
ctx.font = '30px sans-serif';
|
||||||
|
text = `auf dem ✨Olymp✨`;
|
||||||
|
textWidth = ctx.measureText(text).width;
|
||||||
|
textX = canvas.width / 2 - textWidth / 2;
|
||||||
|
textHeight = 30; // Approximate height of the text
|
||||||
|
|
||||||
|
// Draw the second line of text with black outline
|
||||||
|
ctx.strokeText(text, textX, 100 + pfp.height);
|
||||||
|
ctx.fillText(text, textX, 100 + pfp.height);
|
||||||
|
|
||||||
|
const banner = canvas.toBuffer();
|
||||||
|
|
||||||
|
channel.send({
|
||||||
|
content: `Bitte guck einmal in die <#850491176540700703> ${member}`,
|
||||||
|
files: [{
|
||||||
|
attachment: banner,
|
||||||
|
name: 'banner.png',
|
||||||
|
description: 'a welcome banner'
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
+2
-2
@@ -8,10 +8,10 @@ module.exports = (client) => {
|
|||||||
const filePath = path.join(eventsPath, file)
|
const filePath = path.join(eventsPath, file)
|
||||||
const event = require(filePath)
|
const event = require(filePath)
|
||||||
if (event.once) {
|
if (event.once) {
|
||||||
client.once(event.name, (...args) => event.execute(...args))
|
client.once(event.name, (...args) => event.execute(...args, client))
|
||||||
// added client to commomerate global usage
|
// added client to commomerate global usage
|
||||||
} else {
|
} else {
|
||||||
client.on(event.name, (...args) => event.execute(...args))
|
client.on(event.name, (...args) => event.execute(...args, client))
|
||||||
// added client to commomerate global usage
|
// added client to commomerate global usage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
const { Client, GatewayIntentBits, Collection, Partials } = require('discord.js')
|
const { Client, GatewayIntentBits, Collection, Partials } = require('discord.js')
|
||||||
const { MongoClient } = require('mongodb')
|
const { MongoClient } = require('mongodb')
|
||||||
const { DisTube } = require('distube');
|
|
||||||
const { YtDlpPlugin } = require('@distube/yt-dlp')
|
|
||||||
require('dotenv').config()
|
require('dotenv').config()
|
||||||
const mClient = new MongoClient(process.env.M_URI)
|
const mClient = new MongoClient(process.env.M_URI)
|
||||||
exports.mClient = mClient;
|
exports.mClient = mClient;
|
||||||
@@ -9,7 +7,8 @@ const fs = require('node:fs')
|
|||||||
|
|
||||||
const client = new Client({
|
const client = new Client({
|
||||||
intents: [
|
intents: [
|
||||||
GatewayIntentBits.Guilds,
|
GatewayIntentBits.Guilds,
|
||||||
|
GatewayIntentBits.GuildMembers,
|
||||||
GatewayIntentBits.GuildMessages,
|
GatewayIntentBits.GuildMessages,
|
||||||
GatewayIntentBits.GuildPresences,
|
GatewayIntentBits.GuildPresences,
|
||||||
GatewayIntentBits.GuildMessageReactions,
|
GatewayIntentBits.GuildMessageReactions,
|
||||||
@@ -27,19 +26,8 @@ client.aliases = new Collection() // list of command aliases
|
|||||||
client.buttons = new Collection() // list of buttons
|
client.buttons = new Collection() // list of buttons
|
||||||
client.selectMenus = new Collection() // list of selectMenus
|
client.selectMenus = new Collection() // list of selectMenus
|
||||||
|
|
||||||
// Initialize DisTube with YtDlpPlugin and request options
|
|
||||||
const distube = new DisTube(client, {
|
|
||||||
plugins: [
|
|
||||||
new YtDlpPlugin(),
|
|
||||||
],
|
|
||||||
});
|
|
||||||
|
|
||||||
client.distube = distube
|
|
||||||
|
|
||||||
fs.readdirSync('./handlers').forEach((handler) => {
|
fs.readdirSync('./handlers').forEach((handler) => {
|
||||||
require(`./handlers/${handler}`)(client)
|
require(`./handlers/${handler}`)(client)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
client.login(process.env.D_Token)
|
||||||
distube.on('error', (channel, error) => {client.emit('DistubeError', (channel, error))})
|
|
||||||
client.login(process.env.D_Token)
|
|
||||||
Generated
+463
-965
File diff suppressed because it is too large
Load Diff
+2
-8
@@ -20,16 +20,10 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/DeSqBlocki/Arthonor-3#readme",
|
"homepage": "https://github.com/DeSqBlocki/Arthonor-3#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discordjs/opus": "^0.9.0",
|
"canvas": "^2.11.2",
|
||||||
"@discordjs/voice": "^0.17.0",
|
|
||||||
"@distube/yt-dlp": "^2.0.1",
|
|
||||||
"discord.js": "^14.15.3",
|
"discord.js": "^14.15.3",
|
||||||
"distube": "^5.0.2",
|
|
||||||
"dotenv": "^16.4.5",
|
"dotenv": "^16.4.5",
|
||||||
"mongodb": "^6.8.0",
|
"mongodb": "^6.8.0",
|
||||||
"node-pre-gyp": "^0.17.0",
|
"nodemon": "^3.1.4"
|
||||||
"nodemon": "^3.1.4",
|
|
||||||
"rebuild": "^0.1.2",
|
|
||||||
"sodium-native": "^4.1.1"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,47 +1,47 @@
|
|||||||
const { EmbedBuilder, ActionRowBuilder, UserSelectMenuBuilder, PermissionFlagsBits, RoleSelectMenuComponent, UserSelectMenuComponent } = require("discord.js")
|
const { EmbedBuilder, ActionRowBuilder, UserSelectMenuBuilder, PermissionFlagsBits, RoleSelectMenuComponent, UserSelectMenuComponent } = require("discord.js")
|
||||||
const { mClient } = require("../..")
|
const { mClient } = require("../..")
|
||||||
require('dotenv').config()
|
require('dotenv').config()
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'quotes_list_mentionable',
|
name: 'quotes_list_mentionable',
|
||||||
description: 'handles quotes list mentionables',
|
description: 'handles quotes list mentionables',
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
const embedData = await interaction.message.embeds[0].data
|
const embedData = await interaction.message.embeds[0].data
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
if (!interaction.members) {
|
if (!interaction.members) {
|
||||||
embed.setTitle(embedData.title)
|
embed.setTitle(embedData.title)
|
||||||
.setThumbnail(embedData.thumbnail.url)
|
.setThumbnail(embedData.thumbnail.url)
|
||||||
.setDescription(embedData.description);
|
.setDescription(embedData.description);
|
||||||
} else {
|
} else {
|
||||||
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('quotes')
|
const quotesColl = db.collection('quotes')
|
||||||
const quotes = await quotesColl.find({ by: target.id }).toArray()
|
const quotes = await quotesColl.find({ by: 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)
|
||||||
.map((role) => role.toString())
|
.map((role) => role.toString())
|
||||||
|
|
||||||
const description = String(`${target}\r\n\r\n${memberRoles}`).replaceAll(',', ' ')
|
const description = String(`${target}\r\n\r\n${memberRoles}`).replaceAll(',', ' ')
|
||||||
embed.setTitle(`- User Stats -`)
|
embed.setTitle(`- User Stats -`)
|
||||||
.setDescription(description)
|
.setDescription(description)
|
||||||
.setThumbnail(target.displayAvatarURL())
|
.setThumbnail(target.displayAvatarURL())
|
||||||
.addFields({
|
.addFields({
|
||||||
name: 'Number of Quotes:', value: `${quotes.length}`, inline: true
|
name: 'Number of Quotes:', value: `${quotes.length}`, inline: true
|
||||||
})
|
})
|
||||||
.setFooter({ text: (`${new Date().toLocaleDateString('en-US', { weekday: 'short' })} ${new Date().toLocaleDateString('en-US', { month: 'short' })} ${new Date().getDate()} ${new Date().getFullYear()} UserID <@${member.id}>`) })
|
.setFooter({ text: (`${new Date().toLocaleDateString('en-US', { weekday: 'short' })} ${new Date().toLocaleDateString('en-US', { month: 'short' })} ${new Date().getDate()} ${new Date().getFullYear()} UserID <@${member.id}>`) })
|
||||||
}
|
}
|
||||||
const select = new ActionRowBuilder()
|
const select = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new UserSelectMenuBuilder()
|
new UserSelectMenuBuilder()
|
||||||
.setCustomId('quotes_list_mentionable')
|
.setCustomId('quotes_list_mentionable')
|
||||||
.setPlaceholder('Filter By User')
|
.setPlaceholder('Filter By User')
|
||||||
)
|
)
|
||||||
|
|
||||||
const row = interaction.message.components[1]
|
const row = interaction.message.components[1]
|
||||||
await interaction.update({
|
await interaction.update({
|
||||||
embeds: [embed],
|
embeds: [embed],
|
||||||
components: [select, row]
|
components: [select, row]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user