Skip to content

Commit

Permalink
Add tags for tspacks
Browse files Browse the repository at this point in the history
Also make eslint happy. Formatting changes are unimportant for this.
  • Loading branch information
reiichi001 committed Mar 9, 2024
1 parent 4ef92a6 commit e0704e7
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions events/messageCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,28 +278,31 @@ module.exports = async (client, message) => {


// We upload these to S3 because Discord killed Franz's proxy
const objGuildID = message.guild?.id ?? "directmessage";
const response = await fetch(attachment.attachment);
const buffer = Buffer.from(await response.arrayBuffer());
const bucketName = "dalamudlogsbucket-franz";

Check failure on line 284 in events/messageCreate.js

View workflow job for this annotation

GitHub Actions / eslint

'fetch' is not defined
const keyName = `${message.guild?.id ?? "directmessage"}/tspack/${message.author.id}-${attachment.name}`
const keyName = `${objGuildID}/tspack/${message.author.id}-${attachment.name}`
const objectTags = `io.franzbot.tspack/source_user_id=${message.author.id}&io.franzbot.tspack/source_guild_id=${objGuildID}`;

const s3Client = new S3Client({
region: client.config.AWS_REGION,
credentials: {
accessKeyId: client.config.AWS_KEY,
secretAccessKey: client.config.AWS_KEYSECRET,
accessKeyId: client.config.AWS_KEY,
secretAccessKey: client.config.AWS_KEYSECRET,
}
});

await s3Client.send(
new PutObjectCommand({
Bucket: bucketName,
Key: keyName,
Body: buffer,
Bucket: bucketName,
Key: keyName,
Body: buffer,
Tagging: objectTags
})
);


const url = `https://dalamudlogsbucket-franz.s3.us-east-2.amazonaws.com/${keyName}`;

// console.log(url);
Expand Down Expand Up @@ -338,7 +341,7 @@ module.exports = async (client, message) => {
+ `**NOTE**: Please make sure to provide some context about this if you haven't already.` // ,
+ `The original post will be removed.\n\n`
+ `Orginal Message:\n`
+ `>>> ${message.content}`,
+ `>>> ${message.content}`,
},
],
allowedMentions: {
Expand Down Expand Up @@ -741,9 +744,9 @@ module.exports = async (client, message) => {

if (foundCustomRepoPluginInstalled
&& anyCustomRepoPluginsLoaded && (
message.guildId === client.config.GUILDID_GOAT
|| message.guildId === client.config.GUILDID_XIVONMAC
|| message.guildId === client.config.GUILDID_TESTING)
message.guildId === client.config.GUILDID_GOAT
|| message.guildId === client.config.GUILDID_XIVONMAC
|| message.guildId === client.config.GUILDID_TESTING)
) {
const nagMessage = require("../modules/parse/customrepoplugin.js");
const nagMessageReply = await nagMessage.replyMessage(client);
Expand Down

0 comments on commit e0704e7

Please sign in to comment.