goat
command
drive
Upload video or media to Google Drive and return shareable URL.
0
views
0
likes
0
installs
raw source
const axios = require('axios');
module.exports.config = {
name: "drive",
version: "0.0.1",
role: 2,
author: "π©π
ππ·πΎππͺ πππΎ",
description: "Upload video or media to Google Drive and return shareable URL.",
category: "utility",
countDown: 5
};
module.exports.onStart = async function({ api, event, args }) {
let inputUrl = null;
if (event.messageReply?.attachments?.length > 0) {
inputUrl = event.messageReply.attachments[0].url;
} else if (args.length > 0) {
inputUrl = args[0];
}
if (!inputUrl) {
return api.sendMessage(
"β | Please reply to a media message or provide a valid media URL.",
event.threadID,
event.messageID
);
}
try {
const apikey = "ArYAN";
const apiURL = `https://aryan-xyz-google-drive.vercel.app/drive?url=${encodeURIComponent(inputUrl)}&apikey=${apikey}`;
const res = await axios.get(apiURL);
const data = res.data || {};
const driveLink = data.driveLink || data.driveLIink;
if (driveLink) {
const successMsg = `β
make by Sujon-Boss| File successfully uploaded to Google Drive!\n\nπ Drive URL: ${driveLink}`;
return api.sendMessage(successMsg, event.threadID, event.messageID);
}
return api.sendMessage(
`β | Failed to upload the file.\n${data.error || "No additional information available."}`,
event.threadID,
event.messageID
);
} catch (error) {
console.error("Google Drive Upload Error:", error.message);
return api.sendMessage(
"β | An unexpected error occurred during upload. Please try again later.",
event.threadID,
event.messageID
);
}
};