Finished Nuts/Honor/Quotes
This commit is contained in:
@@ -8,10 +8,12 @@ module.exports = {
|
||||
async execute(interaction) {
|
||||
let temp = await interaction.message.embeds[0].description.split(' ')
|
||||
var honor
|
||||
if (temp[5].slice(2, -2) == 'Honor') {
|
||||
if (temp[5] === '**Honor**') {
|
||||
honor = 1
|
||||
} else {
|
||||
} else if (temp[5] === '**Dishonor**'){
|
||||
honor = -1
|
||||
} else {
|
||||
return await interaction.reply({content: "ERROR", ephemeral: true})
|
||||
}
|
||||
const target = await interaction.message.guild.members.fetch(temp[3].slice(2, -1))
|
||||
temp = interaction.message.embeds[0].description.split('\r\n')
|
||||
@@ -31,12 +33,12 @@ module.exports = {
|
||||
var newThumbnail
|
||||
|
||||
if (honor == 1) {
|
||||
description = `Willst du wirklich <@${target.id}> einen Honor geben?\r\n[Grund: ${reason}]`
|
||||
description = `Willst du wirklich <@${target.id}> einen **Honor** geben?\r\n[Grund: ${reason}]`
|
||||
newTitle = 'Honor Up!'
|
||||
newDescription = `<@${target.id}> erhält einen Honor!\r\n[Grund: ${reason}]`
|
||||
newThumbnail = "https://cdn.discordapp.com/emojis/748176295535443968.webp"
|
||||
} else {
|
||||
description = `Willst du wirklich <@${target.id}> einen Dishonor geben?\r\n[Grund: ${reason}]`
|
||||
description = `Willst du wirklich <@${target.id}> einen **Dishonor** geben?\r\n[Grund: ${reason}]`
|
||||
newTitle = 'Honor Down!'
|
||||
newDescription = `<@${target.id}> erhält einen Dishonor!\r\n[Grund: ${reason}]`
|
||||
newThumbnail = "https://cdn.discordapp.com/emojis/748176295132790786.webp"
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
const { EmbedBuilder, UserSelectMenuBuilder, ActionRowBuilder } = require("discord.js")
|
||||
const { mClient } = require("../..")
|
||||
require('dotenv').config()
|
||||
module.exports = {
|
||||
name: 'quotes_list_left',
|
||||
description: 'navigate left',
|
||||
async execute(interaction) {
|
||||
let oldEmbed = interaction.message.embeds[0].data
|
||||
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 }) }
|
||||
|
||||
let userID = interaction.message.embeds[0].data.footer.text.split(' ')[5].slice(2, -1)
|
||||
const target = await interaction.guild.members.fetch(userID)
|
||||
if (!target) { return interaction.reply({ content: 'Please use a Filter', ephemeral: true }) }
|
||||
|
||||
const db = mClient.db(process.env.M_DB)
|
||||
const quotesColl = db.collection('quotes')
|
||||
const quotes = await quotesColl.find({ by: target.id }).toArray()
|
||||
|
||||
var index = Number((await interaction.message.embeds[0].data.title).split(' ')[2].slice(1))
|
||||
if (!index) { index = 0 }
|
||||
index = index - 2
|
||||
if (index < 1) { index = 0 }
|
||||
|
||||
|
||||
const found = quotes[index]
|
||||
|
||||
const guild = await interaction.client.guilds.fetch(found.guildID)
|
||||
const channel = await guild.channels.fetch(found.channelID)
|
||||
const message = await channel.messages.fetch(found.messageID)
|
||||
|
||||
var msgData = {
|
||||
content: message.content,
|
||||
author: await message.author,
|
||||
reference: await message.reference,
|
||||
embed: await message.embeds ? 'embed' : null
|
||||
} // debug
|
||||
if (msgData.reference) {
|
||||
let refMessage = await channel.messages.fetch(msgData.reference.messageId)
|
||||
var refData = {
|
||||
content: refMessage.content,
|
||||
author: await refMessage.author,
|
||||
embed: await refMessage.embeds.length > 0 ? 'embed' : null
|
||||
}
|
||||
}
|
||||
|
||||
var description = ''
|
||||
if (refData) {
|
||||
description += `> ${refData.author}`
|
||||
if (refData.embed) {
|
||||
description += '*an embed / a command* '
|
||||
} else {
|
||||
description += refData.content
|
||||
}
|
||||
description += `\r\n↳`
|
||||
}
|
||||
let messageLink = `https://discord.com/channels/${found.guildID}/${found.channelID}/${found.messageID}`
|
||||
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 #${index + 1} -`)
|
||||
.setDescription(description)
|
||||
.setFooter({ text: (`${footer} #${found.messageID} <@${found.by}>`) })
|
||||
const select = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new UserSelectMenuBuilder()
|
||||
.setCustomId('quotes_list_mentionable')
|
||||
.setPlaceholder('Filter By User')
|
||||
)
|
||||
|
||||
const row = interaction.message.components[1]
|
||||
await interaction.update({
|
||||
embeds: [embed],
|
||||
components: [select, row]
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
const { EmbedBuilder, UserSelectMenuBuilder, ActionRowBuilder } = require("discord.js")
|
||||
const { mClient } = require("../..")
|
||||
require('dotenv').config()
|
||||
module.exports = {
|
||||
name: 'quotes_list_right',
|
||||
description: 'navigate right',
|
||||
async execute(interaction) {
|
||||
let oldEmbed = interaction.message.embeds[0].data
|
||||
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 }) }
|
||||
|
||||
let userID = interaction.message.embeds[0].data.footer.text.split(' ')[5].slice(2, -1)
|
||||
const target = await interaction.guild.members.fetch(userID)
|
||||
if (!target) { return interaction.reply({ content: 'Please use a Filter', ephemeral: true }) }
|
||||
|
||||
const db = mClient.db(process.env.M_DB)
|
||||
const quotesColl = db.collection('quotes')
|
||||
const quotes = await quotesColl.find({ by: target.id }).toArray()
|
||||
|
||||
var index = Number((await interaction.message.embeds[0].data.title).split(' ')[2].slice(1))
|
||||
if (!index) { index = 0 }
|
||||
//if (index >= quotes.length){ return interaction.reply({content: 'Max Quotes Reached', ephemeral: true})}
|
||||
if (index >= quotes.length) { index-- }
|
||||
|
||||
// will automatically reflect the next index due to how arrays think
|
||||
|
||||
const found = quotes[index]
|
||||
const guild = await interaction.client.guilds.fetch(found.guildID)
|
||||
const channel = await guild.channels.fetch(found.channelID)
|
||||
const message = await channel.messages.fetch(found.messageID)
|
||||
|
||||
var msgData = {
|
||||
content: message.content,
|
||||
author: await message.author,
|
||||
reference: await message.reference,
|
||||
embed: await message.embeds ? 'embed' : null
|
||||
} // debug
|
||||
if (msgData.reference) {
|
||||
let refMessage = await channel.messages.fetch(msgData.reference.messageId)
|
||||
var refData = {
|
||||
content: refMessage.content,
|
||||
author: await refMessage.author,
|
||||
embed: await refMessage.embeds.length > 0 ? 'embed' : null
|
||||
}
|
||||
}
|
||||
|
||||
var description = ''
|
||||
if (refData) {
|
||||
description += `> ${refData.author}`
|
||||
if (refData.embed) {
|
||||
description += '*an embed / a command* '
|
||||
} else {
|
||||
description += refData.content
|
||||
}
|
||||
description += `\r\n↳`
|
||||
}
|
||||
let messageLink = `https://discord.com/channels/${found.guildID}/${found.channelID}/${found.messageID}`
|
||||
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 #${index + 1} -`)
|
||||
.setDescription(description)
|
||||
.setFooter({ text: (`${footer} #${found.messageID} <@${found.by}>`) })
|
||||
const select = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new UserSelectMenuBuilder()
|
||||
.setCustomId('quotes_list_mentionable')
|
||||
.setPlaceholder('Filter By User')
|
||||
)
|
||||
|
||||
const row = interaction.message.components[1]
|
||||
await interaction.update({
|
||||
embeds: [embed],
|
||||
components: [select, row]
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
module.exports = {
|
||||
name: 'test_button_1',
|
||||
description: 'a test button',
|
||||
execute(interaction){
|
||||
interaction.reply({
|
||||
content: 'Success'
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user