Skip to content

Instantly share code, notes, and snippets.

@he3als
Created March 26, 2023 12:23
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save he3als/9791159dce22b24cd6726c2fba99292f to your computer and use it in GitHub Desktop.
Save he3als/9791159dce22b24cd6726c2fba99292f to your computer and use it in GitHub Desktop.
FileDitch Vencord Uploader Plugin - https://fileditch.com/
/*
* Vencord, a modification for Discord's desktop app
* Copyright (c) 2022 Samu
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { ApplicationCommandInputType, ApplicationCommandOptionType } from "@api/Commands";
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
import { findByProps } from "@webpack";
const DRAFT_TYPE = 0;
export default definePlugin({
name: "Gofileio",
description: "Allow for you to upload files to gofile.io and send them to others",
authors: [Devs.Samu],
dependencies: ["MessageEventsAPI"],
target: "DESKTOP",
commands: [{
name: "goupload",
description: "Upload a file to gofile.io and adds it to your clipboard",
inputType: ApplicationCommandInputType.BUILT_IN,
options: [
{
name: "file",
description: "The file to upload",
type: ApplicationCommandOptionType.ATTACHMENT,
required: true
}
],
execute: async (args, ctx) => {
const UploadStore = findByProps("getUploads");
const upload = UploadStore.getUploads(ctx.channel.id, DRAFT_TYPE)[0];
const uploadedFile = upload?.item?.file as File;
const formData = new FormData();
formData.append("file", uploadedFile);
const server = await fetch("https://api.gofile.io/getServer").then(response => response.json());
fetch(`https://${server.data.server}.gofile.io/uploadFile`, {
method: "POST",
body: formData
})
.then(response => response.json())
.then(result => {
DiscordNative.clipboard.copy(result.data.downloadPage);
})
.catch(error => {
console.error("Error:", error);
});
}
}],
start() {
},
stop() {
}
});
@he3als
Copy link
Author

he3als commented Mar 26, 2023

A fork/modified version of a third party plugin made by Samu (Samu!#7117) for uploading to GoFile posted in the #🧩-third-party-plugins in the Vencord Discord server.

As a note, the original version is said to be getting more support, and I presume that once it is finished then it will be an official plugin.

PS: This is an early test of what Im making, plan for it to not be gofile.io exclusive when done, just didnt want this to go to waste incase i didnt finish

Discord_rc4nEqHXYN.mp4

Useful for uploading files that are normally too big or for videos that do not embed, so that you can then append the embeds.video website to the start of it to make it embed. There's a built in button for copying the embeds.video to your clipboard automatically.

Installation

Installation requires you to follow this: https://github.com/Vendicated/Vencord/blob/main/docs/1_INSTALLING.md
However, before you build or inject Vencord, make sure to first put the fileDitch.ts file into src\userplugins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment