diff --git a/README.md b/README.md index a22e565..d67f98f 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,11 @@ # bnuuy-mc-search -bnuuy bnuuy bnuuy bnuuy bnuuy bnuuy bnuuy bnuuy bnuuy bnuuy bnuuy bnuuy bnuuy bnuuy bnuuy bnuuy \ No newline at end of file +Fetches all death messages from a predetermined channel. + +## How it works + +run ``/fetch`` in the channel you want to fetch the death messages + +## Reporting bugs + +Don't bother, they won't be fixed \ No newline at end of file diff --git a/commands/fetch/fetch.js b/commands/fetch/fetch.js index 2826658..9b46748 100644 --- a/commands/fetch/fetch.js +++ b/commands/fetch/fetch.js @@ -3,8 +3,27 @@ const { SlashCommandBuilder } = require('discord.js'); module.exports = { data: new SlashCommandBuilder() .setName('fetch') - .setDescription('Fetch\'s All Youre Data\'s !! :3'), + .setDescription('Fetches all messages from a specified user and scans them for death messages') + .addUserOption(option => option.setName('user').setDescription('User to fetch messages from').setRequired(true)), async execute(interaction) { - await interaction.reply('fuck yoy'); + const target = interaction.options.getUser('user'); + await interaction.deferReply(); + console.log(target); + await interaction.guild.members.fetch(target, { force: true }) + .then((member) => { + targetId = member.id; + }) + .catch(error => console.error(`error. ${error}`)); + await interaction.channel.messages.fetch() + .then((messages) => { + messages.filter(message => message.author.id === targetId); + console.log(messages); + for (message in messages) { + console.log(message); + console.log(message.content); + } + }) + .catch(console.error); + await interaction.editReply(targetId); }, }; \ No newline at end of file