mirror of
https://github.com/captbaritone/webamp.git
synced 2026-08-02 06:52:19 +00:00
Remove !archive command in favor of the skin musuem upload flow
This commit is contained in:
parent
c76307d60e
commit
031596f8a6
2 changed files with 0 additions and 54 deletions
|
|
@ -1,53 +0,0 @@
|
|||
import { Message } from "discord.js";
|
||||
import fetch from "node-fetch";
|
||||
import * as Utils from "../utils";
|
||||
import { addSkinFromBuffer } from "../../addSkin";
|
||||
|
||||
async function handler(message: Message) {
|
||||
const { attachments } = message;
|
||||
if (attachments.array().length < 1) {
|
||||
await message.channel.send("Could not archive. No attachment found.");
|
||||
return;
|
||||
}
|
||||
const files = await Promise.all(
|
||||
attachments.map(async (attachment) => {
|
||||
const { filename, url } = attachment;
|
||||
const response = await fetch(url);
|
||||
const buffer = await response.buffer();
|
||||
return { filename, buffer };
|
||||
})
|
||||
);
|
||||
|
||||
for (const file of files) {
|
||||
let result;
|
||||
try {
|
||||
result = await addSkinFromBuffer(
|
||||
file.buffer,
|
||||
file.filename,
|
||||
message.author.username
|
||||
);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
message.channel.send(
|
||||
"There was an error archiving your skin. Please ping @captbaritone."
|
||||
);
|
||||
throw e;
|
||||
}
|
||||
if (result.status === "FOUND") {
|
||||
await message.channel.send(`This skin is already in our collection.`);
|
||||
} else if (result.status === "ADDED") {
|
||||
await message.channel.send(
|
||||
`Thanks! ${file.filename} is a brand new skin. 👏 It has been queued for archiving. In the mean time, here's a screenshot and a link to it on Webamp.`
|
||||
);
|
||||
}
|
||||
await Utils.postSkin({ md5: result.md5, dest: message.channel });
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
command: "archive",
|
||||
usage: "",
|
||||
description:
|
||||
"Queues the accompanying uploaded skin for inclusion in the Archive",
|
||||
handler,
|
||||
};
|
||||
|
|
@ -9,7 +9,6 @@ const handlers = {
|
|||
};
|
||||
|
||||
const commands = [
|
||||
require("./commands/archive"),
|
||||
require("./commands/review"),
|
||||
require("./commands/screenshot"),
|
||||
require("./commands/skin"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue