dc-cloud 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/classes/cloudBot.d.ts +17 -0
- package/dist/classes/cloudBot.d.ts.map +1 -0
- package/dist/classes/dCloud.d.ts +15 -0
- package/dist/classes/dCloud.d.ts.map +1 -0
- package/dist/classes/dCloud.js +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -10
- package/dist/interface/index.d.ts +21 -0
- package/dist/interface/index.d.ts.map +1 -0
- package/dist/utils/7zip.d.ts +24 -0
- package/dist/utils/7zip.d.ts.map +1 -0
- package/dist/utils/7zip.js +2 -0
- package/dist/utils/lib.d.ts +3 -0
- package/dist/utils/lib.d.ts.map +1 -0
- package/dist/utils/lib.js +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Client, EmbedBuilder, ForumChannel, Guild, ThreadChannel } from "discord.js";
|
|
2
|
+
import { ICloudBot } from "../interface/index.js";
|
|
3
|
+
declare class CloudBotClass extends Client {
|
|
4
|
+
private configOptions;
|
|
5
|
+
forumChannel: ForumChannel | null;
|
|
6
|
+
currentServer: Guild | null;
|
|
7
|
+
constructor(options: ICloudBot);
|
|
8
|
+
Init(): Promise<void>;
|
|
9
|
+
IsBotOnline(): boolean;
|
|
10
|
+
private findServer;
|
|
11
|
+
private findForumChannel;
|
|
12
|
+
initializeNewThread(name: string, msg: EmbedBuilder): Promise<ThreadChannel | null>;
|
|
13
|
+
sendToForumChannel(filePath: string, fileName: string): Promise<string | null>;
|
|
14
|
+
}
|
|
15
|
+
declare const CloudBot: (config: ICloudBot) => CloudBotClass;
|
|
16
|
+
export { CloudBot, CloudBotClass };
|
|
17
|
+
//# sourceMappingURL=cloudBot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloudBot.d.ts","sourceRoot":"","sources":["../../src/classes/cloudBot.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,MAAM,EACN,YAAY,EACZ,YAAY,EAEZ,KAAK,EACL,aAAa,EACd,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAKlD,cAAM,aAAc,SAAQ,MAAM;IAChC,OAAO,CAAC,aAAa,CAAY;IAC1B,YAAY,EAAE,YAAY,GAAG,IAAI,CAAQ;IACzC,aAAa,EAAE,KAAK,GAAG,IAAI,CAAQ;gBAE9B,OAAO,EAAE,SAAS;IAYjB,IAAI;IAoBV,WAAW,IAAI,OAAO;YAIf,UAAU;YAeV,gBAAgB;IA8BjB,mBAAmB,CAC9B,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,YAAY,GAChB,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IA6BnB,kBAAkB,CAC7B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CA2C1B;AAED,QAAA,MAAM,QAAQ,GAAI,QAAQ,SAAS,KAAG,aAErC,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ICloudBot, ICompressorResult } from "../interface/index.js";
|
|
2
|
+
import { ThreadChannel } from "discord.js";
|
|
3
|
+
export declare class DCloudClass {
|
|
4
|
+
private bot;
|
|
5
|
+
private thread;
|
|
6
|
+
private inputPath;
|
|
7
|
+
private fileMetaData;
|
|
8
|
+
constructor(config: ICloudBot);
|
|
9
|
+
init(): Promise<void>;
|
|
10
|
+
initializeNewChannel(fileName: string): Promise<ThreadChannel | null>;
|
|
11
|
+
upload(_inputPath: string): Promise<ICompressorResult | undefined>;
|
|
12
|
+
downloader(attachmentUrl: string, output: string): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export declare const DCloud: (config: ICloudBot) => DCloudClass;
|
|
15
|
+
//# sourceMappingURL=dCloud.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dCloud.d.ts","sourceRoot":"","sources":["../../src/classes/dCloud.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,SAAS,EAET,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAgB,aAAa,EAAE,MAAM,YAAY,CAAC;AAKzD,qBAAa,WAAW;IACtB,OAAO,CAAC,GAAG,CAA8B;IACzC,OAAO,CAAC,MAAM,CAA8B;IAC5C,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,YAAY,CAA4B;gBAEpC,MAAM,EAAE,SAAS;IAIhB,IAAI;IAIJ,oBAAoB,CAC/B,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IA+CnB,MAAM,CACjB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC;IA2G5B,UAAU,CACrB,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC;CA4FjB;AAED,eAAO,MAAM,MAAM,GAAI,QAAQ,SAAS,KAAG,WAE1C,CAAC"}
|
package/dist/classes/dCloud.js
CHANGED
|
@@ -53,7 +53,7 @@ export class DCloudClass {
|
|
|
53
53
|
try {
|
|
54
54
|
this.inputPath = normalize(_inputPath);
|
|
55
55
|
if (!this.inputPath)
|
|
56
|
-
return Promise.reject(
|
|
56
|
+
return Promise.reject(new Error("[DCloud] [Error]: Invalid input path"));
|
|
57
57
|
console.log(chalk.cyan("[DCloud] [Process]: Preparing Discord thread..."));
|
|
58
58
|
const threadReady = await this.initializeNewChannel(path.basename(this.inputPath));
|
|
59
59
|
if (!threadReady) {
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EACL,SAAS,EACT,WAAW,EACX,iBAAiB,GAClB,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const CHANNEL_ID = "1465235994243502162";
|
|
4
|
-
const GUILD_ID = "1316439358609297418";
|
|
5
|
-
const dCloud = DCloud({ FORUM_CHANNEL_ID: CHANNEL_ID, TOKEN: TOKEN, SERVER_ID: GUILD_ID });
|
|
6
|
-
dCloud.init();
|
|
7
|
-
setTimeout(() => {
|
|
8
|
-
dCloud.upload("C:\\Users\\neelo\\OneDrive\\Desktop\\DCloud\\text.txt");
|
|
9
|
-
}, 10000);
|
|
10
|
-
// dCloud.downloader("https://cdn.discordapp.com/attachments/1465344532462702639/1465344646329929923/metadata.json?ex=6978c40c&is=6977728c&hm=3b51d006d31594712dbc8c76c5a5b24d83c01c4b6d9bf8339ed175f9c5114e4a&", "..")
|
|
1
|
+
export { DCloud, DCloudClass } from "./classes/dCloud.js";
|
|
2
|
+
export { CloudBot, CloudBotClass } from "./classes/cloudBot.js";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface ICompressor {
|
|
2
|
+
originalName: string;
|
|
3
|
+
totalSize: string;
|
|
4
|
+
createdAt: string;
|
|
5
|
+
parts: {
|
|
6
|
+
name: string;
|
|
7
|
+
url: string;
|
|
8
|
+
}[];
|
|
9
|
+
}
|
|
10
|
+
export interface ICompressorResult {
|
|
11
|
+
originalName: string;
|
|
12
|
+
totalSize: string;
|
|
13
|
+
createdAt: string;
|
|
14
|
+
metadata: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ICloudBot {
|
|
17
|
+
TOKEN: string;
|
|
18
|
+
SERVER_ID: string;
|
|
19
|
+
FORUM_CHANNEL_ID: string;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/interface/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACxC;AAED,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;CAC1B"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import { ICompressor } from "../interface/index.js";
|
|
3
|
+
export declare const SEVEN_ZIP: string;
|
|
4
|
+
/**
|
|
5
|
+
* Executes a 7z command process
|
|
6
|
+
*/
|
|
7
|
+
export declare function run7z(args: string[], onDone: () => void, onFailed: () => void): void;
|
|
8
|
+
/**
|
|
9
|
+
* Watches for specific 7z split parts being created
|
|
10
|
+
*/
|
|
11
|
+
export declare function fileWatcher(dir: string, baseName: string, callback: (fileName: string) => void): fs.FSWatcher;
|
|
12
|
+
/**
|
|
13
|
+
* Compresses input into split 7z archives and triggers upload tasks
|
|
14
|
+
*/
|
|
15
|
+
export declare function Compress(input: string, outPut: string, onNewFileCreated: (filePath: string) => Promise<void>): Promise<ICompressor | null>;
|
|
16
|
+
/**
|
|
17
|
+
* Restores a split archive back to its original form
|
|
18
|
+
*/
|
|
19
|
+
export declare function Restore(folder: string, destination?: string, onDone?: () => void, onFailed?: () => void): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Recursively calculates directory size in bytes
|
|
22
|
+
*/
|
|
23
|
+
export declare function getDirSize(dirPath: string): number;
|
|
24
|
+
//# sourceMappingURL=7zip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"7zip.d.ts","sourceRoot":"","sources":["../../src/utils/7zip.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGpD,eAAO,MAAM,SAAS,QAAU,CAAC;AAEjC;;GAEG;AACH,wBAAgB,KAAK,CACnB,IAAI,EAAE,MAAM,EAAE,EACd,MAAM,EAAE,MAAM,IAAI,EAClB,QAAQ,EAAE,MAAM,IAAI,QA0BrB;AAED;;GAEG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,gBAgBrC;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAC5B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GACpD,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAiF7B;AAED;;GAEG;AACH,wBAAsB,OAAO,CAC3B,MAAM,EAAE,MAAM,EACd,WAAW,CAAC,EAAE,MAAM,EACpB,MAAM,CAAC,EAAE,MAAM,IAAI,EACnB,QAAQ,CAAC,EAAE,MAAM,IAAI,GACpB,OAAO,CAAC,IAAI,CAAC,CAyDf;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAgBlD"}
|
package/dist/utils/7zip.js
CHANGED
|
@@ -133,6 +133,8 @@ export async function Restore(folder, destination, onDone, onFailed) {
|
|
|
133
133
|
return reject(new Error("First archive part missing"));
|
|
134
134
|
}
|
|
135
135
|
const outDir = destination ? normalize(destination) : folderPath;
|
|
136
|
+
if (!outDir)
|
|
137
|
+
return reject(new Error("[7z] [Error]: Invalid output directory"));
|
|
136
138
|
const args = ["x", firstPart, `-o${outDir}`, "-aoa", "-y"];
|
|
137
139
|
const on7zDone = () => {
|
|
138
140
|
console.log(chalk.green("[7z] [Restore]: Extraction completed successfully."));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../src/utils/lib.ts"],"names":[],"mappings":"AAGA,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGzD;AAED,wBAAgB,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAGhD"}
|
package/dist/utils/lib.js
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dc-cloud",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Discord-based cloud storage solution for file compression, segmentation, and backup using Discord as a backend",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license":"MIT",
|
|
7
7
|
"module": "dist/index.js",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
9
10
|
|
|
10
11
|
"author": {
|
|
11
12
|
"name": "Neel Frostrain",
|