diff --git a/interactions/commands/export.js b/interactions/commands/export.js index cf962b0..499ca3a 100644 --- a/interactions/commands/export.js +++ b/interactions/commands/export.js @@ -5,20 +5,16 @@ const execute = async (interaction, db, client) => { if (!interaction.isCommand()) return; await interaction.deferReply({ flags: Discord.MessageFlags.Ephemeral }).catch(console.error); - db.get("SELECT * FROM badActors", async (err, row) => { + db.all("SELECT * FROM badActors", async (err, row) => { if (row) { const now = new Date(); const pad = (n) => n.toString().padStart(2, '0'); - const filename = `badActors-${pad(now.getMonth() + 1)}-${pad(now.getDate())}-${now.getFullYear()}-utc${pad(now.getUTCHours())}-${pad(now.getUTCMinutes())}.json`; - let attachments = [ - { - id: Discord.SnowflakeUtil.generate().toString(), - name: filename, - attachment: Buffer.from(JSON.stringify(row, null, 2), 'utf8') - } - ]; - - interaction.editReply({ attachments, flags: Discord.MessageFlags.Ephemeral }); + const filename = `badActors-${pad(now.getMonth() + 1)}-${pad(now.getDate())}-${now.getFullYear()}.json`; + const jsonBuffer = Buffer.from(JSON.stringify(row, null, 2), 'utf8'); + interaction.editReply({ + files: [{ attachment: jsonBuffer, name: filename }], + flags: Discord.MessageFlags.Ephemeral + }); } else { interaction.editReply({ content: "Somehow... the list is empty", ephemeral: true }); }