airship-cli 1.0.1 → 1.1.1
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/LICENSE +673 -673
- package/README.MD +20 -57
- package/out/AirshipTypes.d.ts +4 -4
- package/out/AirshipTypes.d.ts.map +1 -1
- package/out/cli.d.ts +10 -7
- package/out/cli.d.ts.map +1 -1
- package/out/cli.js +72 -26
- package/out/cli.js.map +1 -1
- package/out/commands/CommandTypes.d.ts +1 -0
- package/out/commands/CommandTypes.d.ts.map +1 -1
- package/out/commands/FetchGame.d.ts.map +1 -1
- package/out/commands/FetchGame.js +30 -43
- package/out/commands/FetchGame.js.map +1 -1
- package/out/commands/FetchProfilePhoto.d.ts +3 -0
- package/out/commands/FetchProfilePhoto.d.ts.map +1 -0
- package/out/commands/FetchProfilePhoto.js +31 -0
- package/out/commands/FetchProfilePhoto.js.map +1 -0
- package/out/commands/FetchUser.d.ts.map +1 -1
- package/out/commands/FetchUser.js +28 -43
- package/out/commands/FetchUser.js.map +1 -1
- package/out/commands/FetchUserPhoto.d.ts +3 -0
- package/out/commands/FetchUserPhoto.d.ts.map +1 -0
- package/out/commands/FetchUserPhoto.js +45 -0
- package/out/commands/FetchUserPhoto.js.map +1 -0
- package/out/commands/{help.d.ts → Help.d.ts} +1 -1
- package/out/commands/Help.d.ts.map +1 -0
- package/out/commands/{help.js → Help.js} +4 -3
- package/out/commands/Help.js.map +1 -0
- package/out/util/TokenManager.d.ts +1 -1
- package/out/util/TokenManager.d.ts.map +1 -1
- package/out/util/TokenManager.js +21 -5
- package/out/util/TokenManager.js.map +1 -1
- package/out/util/platform/FetchGame.d.ts +6 -0
- package/out/util/platform/FetchGame.d.ts.map +1 -0
- package/out/util/platform/FetchGame.js +14 -0
- package/out/util/platform/FetchGame.js.map +1 -0
- package/out/util/platform/FetchUser.d.ts +6 -0
- package/out/util/platform/FetchUser.d.ts.map +1 -0
- package/out/util/platform/FetchUser.js +14 -0
- package/out/util/platform/FetchUser.js.map +1 -0
- package/package.json +4 -2
- package/.github/workflows/npm-publish.yml +0 -27
- package/out/Types.d.ts +0 -2
- package/out/Types.d.ts.map +0 -1
- package/out/Types.js +0 -2
- package/out/Types.js.map +0 -1
- package/out/commands/FetchUser copy.d.ts +0 -3
- package/out/commands/FetchUser copy.d.ts.map +0 -1
- package/out/commands/FetchUser copy.js +0 -46
- package/out/commands/FetchUser copy.js.map +0 -1
- package/out/commands/help.d.ts.map +0 -1
- package/out/commands/help.js.map +0 -1
- package/out/index.d.ts.map +0 -1
- package/out/index.js.map +0 -1
- package/src/AirshipTypes.ts +0 -63
- package/src/cli.ts +0 -49
- package/src/commands/CommandTypes.ts +0 -7
- package/src/commands/FetchGame.ts +0 -61
- package/src/commands/FetchUser.ts +0 -61
- package/src/commands/Help.ts +0 -36
- package/src/util/Styles.ts +0 -20
- package/src/util/TokenManager.ts +0 -20
- package/tsconfig.json +0 -42
package/README.MD
CHANGED
|
@@ -1,57 +1,20 @@
|
|
|
1
|
-
# Airship CLI
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
<tr>
|
|
22
|
-
<td>
|
|
23
|
-
|
|
24
|
-
```sh
|
|
25
|
-
npm install airship-cli
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
</td>
|
|
29
|
-
<td>
|
|
30
|
-
|
|
31
|
-
```sh
|
|
32
|
-
yarn add airship-cli
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
</td>
|
|
36
|
-
<td>
|
|
37
|
-
|
|
38
|
-
```sh
|
|
39
|
-
bun add airship-cli
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
</td>
|
|
43
|
-
</tr>
|
|
44
|
-
</table>
|
|
45
|
-
|
|
46
|
-
# Usage
|
|
47
|
-
|
|
48
|
-
Simply run the command below and you're ready to grab data from the platform API. It's that simple!
|
|
49
|
-
|
|
50
|
-
```sh
|
|
51
|
-
airship
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
# License
|
|
55
|
-
|
|
56
|
-
Copyright (c) 2026 Max McDaniel
|
|
57
|
-
Licensed under the GPL 3.0 license.
|
|
1
|
+
# Airship CLI
|
|
2
|
+
Interact with the Airship.gg API from your Terminal!
|
|
3
|
+
|
|
4
|
+
## How to Use
|
|
5
|
+
Simply install the NPM Package
|
|
6
|
+
|
|
7
|
+
`npm install -g airship-cli`
|
|
8
|
+
|
|
9
|
+
and run the command, `airship`!
|
|
10
|
+
|
|
11
|
+
# Development Stats
|
|
12
|
+

|
|
13
|
+
[](https://www.npmjs.com/package/airship-cli)
|
|
14
|
+
|
|
15
|
+

|
|
16
|
+

|
|
17
|
+
|
|
18
|
+
# License
|
|
19
|
+
|
|
20
|
+
Copyright (c) 2026 Max McDaniel - Licensed under the GPL 3.0 license.
|
package/out/AirshipTypes.d.ts
CHANGED
|
@@ -7,12 +7,12 @@ export type AirshipUser = {
|
|
|
7
7
|
uid: string;
|
|
8
8
|
username: string;
|
|
9
9
|
usernameLower: string;
|
|
10
|
-
statusText
|
|
11
|
-
profileImageId
|
|
12
|
-
lastOnlineTime
|
|
10
|
+
statusText?: string;
|
|
11
|
+
profileImageId?: string;
|
|
12
|
+
lastOnlineTime?: string;
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
|
-
export type
|
|
15
|
+
export type AirshipError = {
|
|
16
16
|
message: string[];
|
|
17
17
|
error: string;
|
|
18
18
|
statusCode: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AirshipTypes.d.ts","sourceRoot":"","sources":["../src/AirshipTypes.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACtB,YAAY,EAAE,MA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GAAG;IACtB,IAAI,EAAE;QACF,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;QACpB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;QAC9B,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B,WAAW,EAAE,MAAM,CAAC;QACpB,cAAc,EAAE,MAAM,CAAC;QACvB,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;QAC9C,iBAAiB,EAAE,MAAM,CAAC;QAC1B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;QAC1B,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;QACpC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;QACvB,KAAK,EAAE,QAAQ,EAAE,CAAC;QAClB,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,cAAc,EAAE,MAAM,CAAC;QACvB,SAAS,EAAE,MAAM,EAAE,CAAC;QACpB,YAAY,EAAE,mBAAmB,CAAA;KACpC,CAAA;CACJ,CAAC"}
|
package/out/cli.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export declare
|
|
2
|
+
import type { CLICommand } from './commands/CommandTypes.js';
|
|
3
|
+
interface CommandMap {
|
|
4
|
+
[key: string]: {
|
|
5
|
+
[key: string]: CLICommand;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export declare const commandMap: CommandMap;
|
|
9
|
+
export declare function StartTool(): Promise<void>;
|
|
10
|
+
export declare function RestartTool(): Promise<void>;
|
|
11
|
+
export {};
|
|
9
12
|
//# sourceMappingURL=cli.d.ts.map
|
package/out/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAUA,
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAUA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAE7D,UAAU,UAAU;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG;QACX,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAA;KAC5B,CAAA;CACJ;AAGD,eAAO,MAAM,UAAU,EAAE,UAWxB,CAAC;AAEF,wBAAsB,SAAS,kBAK9B;AAED,wBAAsB,WAAW,kBAYhC"}
|
package/out/cli.js
CHANGED
|
@@ -1,44 +1,90 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { input, select } from '@inquirer/prompts';
|
|
2
|
+
import { confirm, input, select } from '@inquirer/prompts';
|
|
3
3
|
import { PrintHeader, PrintError, PrintTitle } from './util/Styles.js';
|
|
4
4
|
import { AirshipToken } from './util/TokenManager.js';
|
|
5
|
-
import {
|
|
6
|
-
import { helpCommand } from './commands/help.js';
|
|
5
|
+
import { helpCommand } from './commands/Help.js';
|
|
7
6
|
import { fetchUserCommand } from './commands/FetchUser.js';
|
|
8
7
|
import { fetchGameCommand } from './commands/FetchGame.js';
|
|
8
|
+
import { setTimeout } from 'node:timers/promises';
|
|
9
|
+
import { FetchProfilePhotoCommand } from './commands/FetchProfilePhoto.js';
|
|
10
|
+
;
|
|
11
|
+
// TODO: Make default category
|
|
9
12
|
export const commandMap = {
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
/* "default": {
|
|
14
|
+
"Help": helpCommand
|
|
15
|
+
}, */
|
|
16
|
+
"Users": {
|
|
17
|
+
"Fetch User": fetchUserCommand,
|
|
18
|
+
"Fetch Profile Photo": FetchProfilePhotoCommand
|
|
19
|
+
},
|
|
20
|
+
"Games": {
|
|
21
|
+
"Fetch Game": fetchGameCommand
|
|
22
|
+
}
|
|
13
23
|
};
|
|
14
|
-
export
|
|
15
|
-
"Help",
|
|
16
|
-
"Fetch User",
|
|
17
|
-
"Fetch Game"
|
|
18
|
-
];
|
|
19
|
-
export function StartTool() {
|
|
24
|
+
export async function StartTool() {
|
|
20
25
|
PrintTitle();
|
|
21
|
-
setTimeout(
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
await setTimeout(250);
|
|
27
|
+
PromptCommand();
|
|
28
|
+
}
|
|
29
|
+
;
|
|
30
|
+
export async function RestartTool() {
|
|
31
|
+
try {
|
|
32
|
+
await setTimeout(800);
|
|
33
|
+
const restartTool = await confirm({ message: "Would you like to anything else?" });
|
|
34
|
+
if (restartTool) {
|
|
35
|
+
StartTool();
|
|
36
|
+
}
|
|
37
|
+
;
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
console.error(err);
|
|
41
|
+
process.exit(0);
|
|
42
|
+
}
|
|
43
|
+
;
|
|
24
44
|
}
|
|
25
45
|
;
|
|
26
|
-
StartTool();
|
|
27
46
|
async function PromptCommand() {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
47
|
+
try {
|
|
48
|
+
const categoryAnswer = await select({ message: "Select a command category:", choices: Object.keys(commandMap) });
|
|
49
|
+
const cmdCategories = Object.entries(commandMap);
|
|
50
|
+
for (let [categoryName, commands] of cmdCategories) {
|
|
51
|
+
// TODO: Make back command
|
|
52
|
+
if (categoryAnswer === categoryName) {
|
|
53
|
+
const cmdAnswer = await select({ message: "What would you like to do?", choices: Object.keys(commands) });
|
|
54
|
+
HandleCommand(commands[cmdAnswer], cmdAnswer);
|
|
55
|
+
}
|
|
56
|
+
;
|
|
38
57
|
}
|
|
39
58
|
;
|
|
40
59
|
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
console.error(err);
|
|
62
|
+
process.exit(0);
|
|
63
|
+
}
|
|
41
64
|
;
|
|
42
65
|
}
|
|
43
66
|
;
|
|
67
|
+
async function HandleCommand(command, answer) {
|
|
68
|
+
const cmdName = command.displayName;
|
|
69
|
+
const requiresToken = command.requiresToken;
|
|
70
|
+
const cmdFunction = command;
|
|
71
|
+
if (answer === cmdName) {
|
|
72
|
+
if (AirshipToken === undefined && requiresToken) {
|
|
73
|
+
PrintError("An authenticated Airship installation is required to run this command!");
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
76
|
+
;
|
|
77
|
+
await setTimeout(250);
|
|
78
|
+
cmdFunction.execute();
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
;
|
|
82
|
+
}
|
|
83
|
+
;
|
|
84
|
+
// process.on("exit", (signal) => {
|
|
85
|
+
// if (signal === 0) {
|
|
86
|
+
// console.clear();
|
|
87
|
+
// };
|
|
88
|
+
// });
|
|
89
|
+
StartTool();
|
|
44
90
|
//# sourceMappingURL=cli.js.map
|
package/out/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandTypes.d.ts","sourceRoot":"","sources":["../../src/commands/CommandTypes.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,OAAO,CAAC;IACvB,OAAO,EAAE,MAAM,IAAI,CAAA;CACtB,CAAC"}
|
|
1
|
+
{"version":3,"file":"CommandTypes.d.ts","sourceRoot":"","sources":["../../src/commands/CommandTypes.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,OAAO,CAAC;IACvB,OAAO,EAAE,MAAM,IAAI,CAAA;CACtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FetchGame.d.ts","sourceRoot":"","sources":["../../src/commands/FetchGame.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"FetchGame.d.ts","sourceRoot":"","sources":["../../src/commands/FetchGame.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAQpD,eAAO,MAAM,gBAAgB,EAAE,UAsC9B,CAAC"}
|
|
@@ -1,55 +1,42 @@
|
|
|
1
|
-
import { input, select
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
"Slug": "https://api.airship.gg/content/games/slug/",
|
|
7
|
-
"GameId": "https://api.airship.gg/content/games/game-id/"
|
|
8
|
-
};
|
|
1
|
+
import { input, select } from '@inquirer/prompts';
|
|
2
|
+
import { RestartTool } from "../cli.js";
|
|
3
|
+
import { FetchGame, gameApiMap } from "../util/platform/FetchGame.js";
|
|
4
|
+
import { PrintError } from "../util/Styles.js";
|
|
5
|
+
import chalk from "chalk";
|
|
9
6
|
export const fetchGameCommand = {
|
|
10
7
|
name: "fetch-game",
|
|
8
|
+
displayName: "Fetch Game",
|
|
11
9
|
description: "Returns data related to the specified game.",
|
|
12
10
|
usage: "fetch-game <method: slug | gameId> <identifier: string>",
|
|
13
11
|
requiresToken: false,
|
|
14
12
|
execute: async () => {
|
|
15
|
-
const fetchMethod = await select({ message: "Which method would you like to use?", choices:
|
|
16
|
-
|
|
17
|
-
"GameId"
|
|
18
|
-
] });
|
|
13
|
+
const fetchMethod = await select({ message: "Which method would you like to use?", choices: Object.keys(gameApiMap) });
|
|
14
|
+
const dataType = await select({ message: "How would you like your data?", choices: ["Simple", "Verbose"] });
|
|
19
15
|
const gameIdentifier = await input({ message: `Please enter the ${fetchMethod}:` });
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
});
|
|
41
|
-
setTimeout(async () => {
|
|
42
|
-
const restartTool = await confirm({ message: "Would you like to anything else?" });
|
|
43
|
-
if (restartTool) {
|
|
44
|
-
StartTool();
|
|
45
|
-
}
|
|
46
|
-
;
|
|
47
|
-
}, 1000);
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
;
|
|
16
|
+
const result = await FetchGame(fetchMethod, gameIdentifier);
|
|
17
|
+
const entries = Object.entries(result);
|
|
18
|
+
const keys = Object.keys(result);
|
|
19
|
+
if (entries.length === 0 || keys.length === 0 || "error" in result) {
|
|
20
|
+
return PrintError(`Invalid ${fetchMethod}`);
|
|
21
|
+
}
|
|
22
|
+
;
|
|
23
|
+
const game = result.game;
|
|
24
|
+
switch (dataType) {
|
|
25
|
+
case "Simple":
|
|
26
|
+
console.log(`\n${chalk.green("Game Id")}: ${game.id}`);
|
|
27
|
+
console.log(`${chalk.green("Name")}: ${game.name}`);
|
|
28
|
+
console.log(`${chalk.green("Slug")}: ${game.slug || ""}`);
|
|
29
|
+
console.log(`${chalk.green("Developer")}: ${game.organization.name}`);
|
|
30
|
+
console.log(`${chalk.green("Description")}: ${game.description || ""}\n`);
|
|
31
|
+
break;
|
|
32
|
+
case "Verbose":
|
|
33
|
+
console.dir(result, { depth: null });
|
|
34
|
+
console.log();
|
|
35
|
+
break;
|
|
51
36
|
}
|
|
52
37
|
;
|
|
38
|
+
RestartTool();
|
|
39
|
+
return;
|
|
53
40
|
}
|
|
54
41
|
};
|
|
55
42
|
//# sourceMappingURL=FetchGame.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FetchGame.js","sourceRoot":"","sources":["../../src/commands/FetchGame.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"FetchGame.js","sourceRoot":"","sources":["../../src/commands/FetchGame.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,MAAM,gBAAgB,GAAe;IACxC,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,6CAA6C;IAC1D,KAAK,EAAE,yDAAyD;IAChE,aAAa,EAAE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AI,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC;gBAC1D,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC;gBACtE,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC,WAAW,IAAI,EAAE,IAAI,CAAC,CAAC;gBAC1E,MAAM;YACV,KAAK,SAAS;gBACV,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;gBACrC,OAAO,CAAC,GAAG,EAAE,CAAC;gBACd,MAAM;QACd,CAAC;QAAA,CAAC;QAEF,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FetchProfilePhoto.d.ts","sourceRoot":"","sources":["../../src/commands/FetchProfilePhoto.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAOpD,eAAO,MAAM,wBAAwB,EAAE,UA2BtC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { PrintError } from "../util/Styles.js";
|
|
2
|
+
import { input, select } from "@inquirer/prompts";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import { RestartTool } from "../cli.js";
|
|
5
|
+
import { FetchUser, userApiMap } from "../util/platform/FetchUser.js";
|
|
6
|
+
export const FetchProfilePhotoCommand = {
|
|
7
|
+
name: "fetch-profile-photo",
|
|
8
|
+
displayName: "Fetch Profile Photo",
|
|
9
|
+
description: "Returns the profile picture of the given user.",
|
|
10
|
+
usage: "<method: username | userId> <identifier: string>",
|
|
11
|
+
requiresToken: false,
|
|
12
|
+
execute: async () => {
|
|
13
|
+
const fetchMethod = await select({ message: "Which method would you like to use?", choices: Object.keys(userApiMap) });
|
|
14
|
+
const userIdentifier = await input({ message: `Please enter the ${fetchMethod}:` });
|
|
15
|
+
const result = await FetchUser(fetchMethod, userIdentifier);
|
|
16
|
+
const entries = Object.entries(result);
|
|
17
|
+
const keys = Object.keys(result);
|
|
18
|
+
if (entries.length === 0 || keys.length === 0 || "error" in result) {
|
|
19
|
+
return PrintError(`Invalid ${fetchMethod}`);
|
|
20
|
+
}
|
|
21
|
+
;
|
|
22
|
+
const user = result.user;
|
|
23
|
+
const profileImageId = user.profileImageId;
|
|
24
|
+
if (!profileImageId)
|
|
25
|
+
return PrintError("User has no profile image!");
|
|
26
|
+
console.log(chalk.green(`\nhttps://cdn.airship.gg/images/${profileImageId}\n`));
|
|
27
|
+
RestartTool();
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=FetchProfilePhoto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FetchProfilePhoto.js","sourceRoot":"","sources":["../../src/commands/FetchProfilePhoto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEtE,MAAM,CAAC,MAAM,wBAAwB,GAAe;IAChD,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EAAE,qBAAqB;IAClC,WAAW,EAAE,gDAAgD;IAC7D,KAAK,EAAE,kDAAkD;IACzD,aAAa,EAAE,KAAK;IACpB,OAAO,EAAE,KAAK,IAAI,EAAE;QAChB,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,EAAE,OAAO,EAAE,qCAAqC,EAAE,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAC,CAAC,CAAC;QACtH,MAAM,cAAc,GAAG,MAAM,KAAK,CAAC,EAAE,OAAO,EAAE,oBAAoB,WAAW,GAAG,EAAE,CAAC,CAAC;QAEpF,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;QAC5D,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACvC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEjC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,IAAI,MAAM,EAAE,CAAC;YACjE,OAAO,UAAU,CAAC,WAAW,WAAW,EAAE,CAAC,CAAC;QAChD,CAAC;QAAA,CAAC;QAEF,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACzB,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;QAC3C,IAAI,CAAC,cAAc;YAAE,OAAO,UAAU,CAAC,4BAA4B,CAAC,CAAC;QAErE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,mCAAmC,cAAc,IAAI,CAAC,CAAC,CAAC;QAEhF,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;CACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FetchUser.d.ts","sourceRoot":"","sources":["../../src/commands/FetchUser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"FetchUser.d.ts","sourceRoot":"","sources":["../../src/commands/FetchUser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAOpD,eAAO,MAAM,gBAAgB,EAAE,UAmC9B,CAAC"}
|
|
@@ -1,55 +1,40 @@
|
|
|
1
|
-
import { input, select
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
"Username": "https://api.airship.gg/game-coordinator/users/user?username=",
|
|
7
|
-
"UserId": "https://api.airship.gg/game-coordinator/users/uid/"
|
|
8
|
-
};
|
|
1
|
+
import { input, select } from '@inquirer/prompts';
|
|
2
|
+
import { PrintError } from '../util/Styles.js';
|
|
3
|
+
import { RestartTool } from "../cli.js";
|
|
4
|
+
import chalk from "chalk";
|
|
5
|
+
import { FetchUser, userApiMap } from "../util/platform/FetchUser.js";
|
|
9
6
|
export const fetchUserCommand = {
|
|
10
7
|
name: "fetch-user",
|
|
8
|
+
displayName: "Fetch User",
|
|
11
9
|
description: "Returns data related to the specified user.",
|
|
12
10
|
usage: "fetch-user <method: username | userId> <identifier: string>",
|
|
13
11
|
requiresToken: false,
|
|
14
12
|
execute: async () => {
|
|
15
|
-
const fetchMethod = await select({ message: "Which method would you like to use?", choices:
|
|
16
|
-
|
|
17
|
-
"UserId"
|
|
18
|
-
] });
|
|
13
|
+
const fetchMethod = await select({ message: "Which method would you like to use?", choices: Object.keys(userApiMap) });
|
|
14
|
+
const dataType = await select({ message: "How would you like your data?", choices: ["Simple", "Verbose"] });
|
|
19
15
|
const userIdentifier = await input({ message: `Please enter the ${fetchMethod}:` });
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
})).catch((err) => {
|
|
39
|
-
PrintError(err);
|
|
40
|
-
});
|
|
41
|
-
setTimeout(async () => {
|
|
42
|
-
const restartTool = await confirm({ message: "Would you like to anything else?" });
|
|
43
|
-
if (restartTool) {
|
|
44
|
-
StartTool();
|
|
45
|
-
}
|
|
46
|
-
;
|
|
47
|
-
}, 1000);
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
;
|
|
16
|
+
const result = await FetchUser(fetchMethod, userIdentifier);
|
|
17
|
+
const entries = Object.entries(result);
|
|
18
|
+
const keys = Object.keys(result);
|
|
19
|
+
if (entries.length === 0 || keys.length === 0 || "error" in result) {
|
|
20
|
+
return PrintError(`Invalid ${fetchMethod}`);
|
|
21
|
+
}
|
|
22
|
+
;
|
|
23
|
+
const user = result.user;
|
|
24
|
+
switch (dataType) {
|
|
25
|
+
case "Simple":
|
|
26
|
+
console.log(`\n${chalk.green("User Id")}: ${user.uid}`);
|
|
27
|
+
console.log(`${chalk.green("Username")}: ${user.username}`);
|
|
28
|
+
console.log(`${chalk.green("Status Text")}: ${user.statusText || ""}\n`);
|
|
29
|
+
break;
|
|
30
|
+
case "Verbose":
|
|
31
|
+
console.dir(result, { depth: null });
|
|
32
|
+
console.log();
|
|
33
|
+
break;
|
|
51
34
|
}
|
|
52
35
|
;
|
|
36
|
+
RestartTool();
|
|
37
|
+
return;
|
|
53
38
|
}
|
|
54
39
|
};
|
|
55
40
|
//# sourceMappingURL=FetchUser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FetchUser.js","sourceRoot":"","sources":["../../src/commands/FetchUser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"FetchUser.js","sourceRoot":"","sources":["../../src/commands/FetchUser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,UAAU,E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AAC,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;gBAC5D,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC,UAAU,IAAI,EAAE,IAAI,CAAC,CAAC;gBACzE,MAAM;YACV,KAAK,SAAS;gBACV,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;gBACrC,OAAO,CAAC,GAAG,EAAE,CAAC;gBACd,MAAM;QACd,CAAC;QAAA,CAAC;QAEF,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FetchUserPhoto.d.ts","sourceRoot":"","sources":["../../src/commands/FetchUserPhoto.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAYpD,eAAO,MAAM,qBAAqB,EAAE,UAuCnC,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { setTimeout } from "node:timers/promises";
|
|
2
|
+
import { PrintError, PrintHeader } from "../util/Styles.js";
|
|
3
|
+
import { input, select } from "@inquirer/prompts";
|
|
4
|
+
import chalk from "chalk";
|
|
5
|
+
import { RestartTool } from "../cli.js";
|
|
6
|
+
const apiMap = {
|
|
7
|
+
"Username": "https://api.airship.gg/game-coordinator/users/user?username=",
|
|
8
|
+
"UserId": "https://api.airship.gg/game-coordinator/users/uid/"
|
|
9
|
+
};
|
|
10
|
+
export const FetchUserPhotoCommand = {
|
|
11
|
+
name: "fetch-profile-photo",
|
|
12
|
+
displayName: "Fetch Profile Photo",
|
|
13
|
+
description: "Returns the profile picture of the given user.",
|
|
14
|
+
usage: "<method: username | userId> <identifier: string>",
|
|
15
|
+
requiresToken: false,
|
|
16
|
+
execute: async () => {
|
|
17
|
+
const fetchMethod = await select({ message: "Which method would you like to use?", choices: Object.keys(apiMap) });
|
|
18
|
+
const userIdentifier = await input({ message: `Please enter the ${fetchMethod}:` });
|
|
19
|
+
// for (let [ method, url ] of Object.entries(apiMap)) {
|
|
20
|
+
// if (method === fetchMethod) {
|
|
21
|
+
// fetch(url )
|
|
22
|
+
// };
|
|
23
|
+
// };
|
|
24
|
+
fetch(apiMap[fetchMethod] + userIdentifier, {
|
|
25
|
+
method: "GET"
|
|
26
|
+
}).then((raw) => raw.text().then((data) => {
|
|
27
|
+
const result = JSON.parse(data);
|
|
28
|
+
const keys = Object.keys(result);
|
|
29
|
+
const entries = Object.entries(result);
|
|
30
|
+
if (entries.length === 0 || "error" in result || keys.length === 0) {
|
|
31
|
+
PrintError(`Invalid ${fetchMethod}!`);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
;
|
|
35
|
+
const user = result.user;
|
|
36
|
+
const profileImageId = user.profileImageId;
|
|
37
|
+
if (!profileImageId)
|
|
38
|
+
return PrintError("User has no profile image!");
|
|
39
|
+
console.log(chalk.green(`\nhttps://cdn.airship.gg/images/${profileImageId}\n`));
|
|
40
|
+
}));
|
|
41
|
+
RestartTool();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=FetchUserPhoto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FetchUserPhoto.js","sourceRoot":"","sources":["../../src/commands/FetchUserPhoto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;A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