can you tell i'm going insane?

This commit is contained in:
jaezu 2025-07-31 19:05:10 +02:00
parent 2a37d68cad
commit bbba870572

View File

@ -7,23 +7,43 @@ module.exports = {
.addUserOption(option => option.setName('user').setDescription('User to fetch messages from').setRequired(true)), .addUserOption(option => option.setName('user').setDescription('User to fetch messages from').setRequired(true)),
async execute(interaction) { async execute(interaction) {
const target = interaction.options.getUser('user'); const target = interaction.options.getUser('user');
let targetId;
const deathMessages = [];
await interaction.deferReply(); await interaction.deferReply();
console.log(target);
await interaction.guild.members.fetch(target, { force: true }) await interaction.guild.members.fetch(target, { force: true })
.then((member) => { .then(member => targetId = member.id)
targetId = member.id;
})
.catch(error => console.error(`error. ${error}`)); .catch(error => console.error(`error. ${error}`));
await interaction.channel.messages.fetch()
.then((messages) => { const channel = interaction.client.channels.cache.get(interaction.channel.id);
messages.filter(message => message.author.id === targetId);
console.log(messages); let deathMessage = await channel.messages
for (message in messages) { .fetch({ limit: 1 })
console.log(message); .then(messagePage => (messagePage.size === 1 ? messagePage.at(0) : null));
console.log(message.content);
while (deathMessage) {
await channel.messages
.fetch({ limit: 100, before: deathMessage.id })
.then(messagePage => {
messagePage.forEach((msg) => {
if (msg.author.id === targetId) deathMessages.push(msg.content);
});
deathMessage = messagePage.size > 0 ? messagePage.at(messagePage.size - 1) : null;
});
}
if (!deathMessages) {
await interaction.editReply('There Are No Messages');
}
else {
deathMessages.forEach((death) => {
if (!death.match('joined') || !death.match('left')) {
console.log(death);
} }
}) });
.catch(console.error); // console.log(deathMessages);
await interaction.editReply(targetId); await interaction.editReply(`(${deathMessages.length})Death Messages Founded!!! Check Console`);
}
}, },
}; };