@39choko/lanyard 1.0.0 → 1.0.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/README.md +69 -69
- package/dist/api/Users.d.ts +1 -1
- package/dist/api/Users.js +2 -6
- package/dist/api/Users.mjs +2 -6
- package/package.json +26 -26
package/README.md
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
# @39choko/lanyard
|
|
2
|
-
|
|
3
|
-
<div align="center">
|
|
4
|
-
<p>
|
|
5
|
-
<a href="https://www.npmjs.com/package/@39choko/lanyard"><img src="https://img.shields.io/npm/v/@39choko/lanyard.svg?maxAge=3600" alt="npm version" /></a>
|
|
6
|
-
<a href="https://www.npmjs.com/package/@39choko/lanyard"><img src="https://img.shields.io/npm/dt/@39choko/lanyard.svg?maxAge=3600" alt="npm downloads" /></a>
|
|
7
|
-
<a href="https://github.com/39Choko/lanyard/commits/main/"><img alt="Last commit." src="https://img.shields.io/github/last-commit/39Choko/lanyard?logo=github&logoColor=ffffff">
|
|
8
|
-
</p>
|
|
9
|
-
</div>
|
|
10
|
-
|
|
11
|
-
## About
|
|
12
|
-
|
|
13
|
-
@39choko/lanyard is a [npm](https://www.npmjs.com/) package that allows you to interacting with [Lanyard](https://github.com/Phineas/lanyard).
|
|
14
|
-
|
|
15
|
-
## Installation
|
|
16
|
-
|
|
17
|
-
```sh
|
|
18
|
-
npm install @39choko/lanyard
|
|
19
|
-
yarn add @39choko/lanyard
|
|
20
|
-
pnpm add @39choko/lanyard
|
|
21
|
-
bun add @39choko/lanyard
|
|
22
|
-
deno install npm:@39choko/lanyard
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Example usage
|
|
26
|
-
|
|
27
|
-
```ts
|
|
28
|
-
import { Client } from
|
|
29
|
-
|
|
30
|
-
const client = new Client();
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### Example
|
|
34
|
-
|
|
35
|
-
Getting User Info
|
|
36
|
-
|
|
37
|
-
```ts
|
|
38
|
-
const user = await client.user.getUser("826467976484094023");
|
|
39
|
-
if (!user.success) return throw Error("Failed to fetch user.")
|
|
40
|
-
|
|
41
|
-
console.log(user.data);
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
Getting User display name
|
|
45
|
-
|
|
46
|
-
```ts
|
|
47
|
-
const avatarURL = await client.user.getAvatarURL("826467976484094023");
|
|
48
|
-
if (!avatarURL) return throw Error("Failed to fetch the avatar url.")
|
|
49
|
-
|
|
50
|
-
console.log(avatarURL); // "https://cdn.discordapp.com/avatars/826467976484094023/e4479e082bb156a6f004fb3b34d678ac.png"
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
Getting User platform status
|
|
54
|
-
|
|
55
|
-
```ts
|
|
56
|
-
const platformStatus = await client.user.getPlatformStatus("826467976484094023");
|
|
57
|
-
if (!platformStatus) return throw Error("Failed to fetch the platform status.")
|
|
58
|
-
|
|
59
|
-
console.log(platformStatus); // ["desktop", "mobile"]
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
## Links
|
|
63
|
-
|
|
64
|
-
- [npm](https://www.npmjs.com/package/@39choko/lanyard)
|
|
65
|
-
- [Lanyard](https://github.com/Phineas/lanyard)
|
|
66
|
-
|
|
67
|
-
## More
|
|
68
|
-
|
|
69
|
-
If you want to contribute to this repo please make a pull request or dm me on discord (39choko / 826467976484094023)
|
|
1
|
+
# @39choko/lanyard
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
<p>
|
|
5
|
+
<a href="https://www.npmjs.com/package/@39choko/lanyard"><img src="https://img.shields.io/npm/v/@39choko/lanyard.svg?maxAge=3600" alt="npm version" /></a>
|
|
6
|
+
<a href="https://www.npmjs.com/package/@39choko/lanyard"><img src="https://img.shields.io/npm/dt/@39choko/lanyard.svg?maxAge=3600" alt="npm downloads" /></a>
|
|
7
|
+
<a href="https://github.com/39Choko/lanyard/commits/main/"><img alt="Last commit." src="https://img.shields.io/github/last-commit/39Choko/lanyard?logo=github&logoColor=ffffff">
|
|
8
|
+
</p>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
## About
|
|
12
|
+
|
|
13
|
+
@39choko/lanyard is a [npm](https://www.npmjs.com/) package that allows you to interacting with [Lanyard](https://github.com/Phineas/lanyard).
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
npm install @39choko/lanyard
|
|
19
|
+
yarn add @39choko/lanyard
|
|
20
|
+
pnpm add @39choko/lanyard
|
|
21
|
+
bun add @39choko/lanyard
|
|
22
|
+
deno install npm:@39choko/lanyard
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Example usage
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { Client } from "@39choko/lanyard";
|
|
29
|
+
|
|
30
|
+
const client = new Client();
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Example
|
|
34
|
+
|
|
35
|
+
Getting User Info
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
const user = await client.user.getUser("826467976484094023");
|
|
39
|
+
if (!user.success) return throw Error("Failed to fetch user.")
|
|
40
|
+
|
|
41
|
+
console.log(user.data);
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Getting User display name
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
const avatarURL = await client.user.getAvatarURL("826467976484094023");
|
|
48
|
+
if (!avatarURL) return throw Error("Failed to fetch the avatar url.")
|
|
49
|
+
|
|
50
|
+
console.log(avatarURL); // "https://cdn.discordapp.com/avatars/826467976484094023/e4479e082bb156a6f004fb3b34d678ac.png"
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Getting User platform status
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
const platformStatus = await client.user.getPlatformStatus("826467976484094023");
|
|
57
|
+
if (!platformStatus) return throw Error("Failed to fetch the platform status.")
|
|
58
|
+
|
|
59
|
+
console.log(platformStatus); // ["desktop", "mobile"]
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Links
|
|
63
|
+
|
|
64
|
+
- [npm](https://www.npmjs.com/package/@39choko/lanyard)
|
|
65
|
+
- [Lanyard](https://github.com/Phineas/lanyard)
|
|
66
|
+
|
|
67
|
+
## More
|
|
68
|
+
|
|
69
|
+
If you want to contribute to this repo please make a pull request or dm me on discord (39choko / 826467976484094023)
|
package/dist/api/Users.d.ts
CHANGED
|
@@ -5,6 +5,6 @@ export declare class Users {
|
|
|
5
5
|
constructor(client: Client);
|
|
6
6
|
getUser(userId: string): Promise<APIResponse<UserData>>;
|
|
7
7
|
getDisplayName(userId: string): Promise<string | null>;
|
|
8
|
-
getAvatarURL(userId: string):
|
|
8
|
+
getAvatarURL(userId: string): string;
|
|
9
9
|
getPlatformStatus(userId: string): Promise<string[] | null>;
|
|
10
10
|
}
|
package/dist/api/Users.js
CHANGED
|
@@ -30,12 +30,8 @@ class Users {
|
|
|
30
30
|
const userRequest = await this.getUser(userId);
|
|
31
31
|
return userRequest.success === !1 ? null : userRequest.data.discord_user.display_name;
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if (userRequest.success === !1)
|
|
36
|
-
return null;
|
|
37
|
-
const avatarHash = userRequest.data.discord_user.avatar;
|
|
38
|
-
return `https://cdn.discordapp.com/avatars/${userId}/${avatarHash}.png`;
|
|
33
|
+
getAvatarURL(userId) {
|
|
34
|
+
return `https://api.lanyard.rest/${userId}.png`;
|
|
39
35
|
}
|
|
40
36
|
async getPlatformStatus(userId) {
|
|
41
37
|
const userRequest = await this.getUser(userId), platform = [];
|
package/dist/api/Users.mjs
CHANGED
|
@@ -10,12 +10,8 @@ class Users {
|
|
|
10
10
|
const userRequest = await this.getUser(userId);
|
|
11
11
|
return userRequest.success === !1 ? null : userRequest.data.discord_user.display_name;
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (userRequest.success === !1)
|
|
16
|
-
return null;
|
|
17
|
-
const avatarHash = userRequest.data.discord_user.avatar;
|
|
18
|
-
return `https://cdn.discordapp.com/avatars/${userId}/${avatarHash}.png`;
|
|
13
|
+
getAvatarURL(userId) {
|
|
14
|
+
return `https://api.lanyard.rest/${userId}.png`;
|
|
19
15
|
}
|
|
20
16
|
async getPlatformStatus(userId) {
|
|
21
17
|
const userRequest = await this.getUser(userId), platform = [];
|
package/package.json
CHANGED
|
@@ -1,47 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@39choko/lanyard",
|
|
3
|
+
"version": "1.0.1",
|
|
3
4
|
"description": "A simple Lanyard client.",
|
|
4
|
-
"
|
|
5
|
+
"keywords": [
|
|
6
|
+
"discord",
|
|
7
|
+
"lanyard",
|
|
8
|
+
"presence"
|
|
9
|
+
],
|
|
5
10
|
"homepage": "https://github.com/39Choko/lanyard",
|
|
6
11
|
"bugs": "https://github.com/39Choko/lanyard/issues",
|
|
7
12
|
"repository": {
|
|
8
13
|
"type": "git",
|
|
9
14
|
"url": "git+https://github.com/39Choko/lanyard.git"
|
|
10
15
|
},
|
|
11
|
-
"publishConfig": {
|
|
12
|
-
"access": "public",
|
|
13
|
-
"provenance": true
|
|
14
|
-
},
|
|
15
16
|
"license": "MIT",
|
|
16
17
|
"author": {
|
|
17
18
|
"name": "39Choko",
|
|
18
19
|
"url": "https://github.com/39Choko"
|
|
19
20
|
},
|
|
20
|
-
"main": "./dist/index.js",
|
|
21
|
-
"module": "./dist/index.mjs",
|
|
22
|
-
"types": "./dist/index.d.ts",
|
|
23
|
-
"scripts": {
|
|
24
|
-
"prettier": "bunx prettier --write .",
|
|
25
|
-
"test": "bun test",
|
|
26
|
-
"build": "bun build.ts",
|
|
27
|
-
"release": "bun run prettier && bun run build && bun run test && bun publish"
|
|
28
|
-
},
|
|
29
21
|
"exports": {
|
|
30
22
|
"./package.json": "./package.json",
|
|
31
23
|
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
32
25
|
"import": "./dist/index.mjs",
|
|
33
|
-
"require": "./dist/index.js"
|
|
34
|
-
"types": "./dist/index.d.ts"
|
|
26
|
+
"require": "./dist/index.js"
|
|
35
27
|
},
|
|
36
28
|
"./client": {
|
|
29
|
+
"types": "./dist/client/index.d.ts",
|
|
37
30
|
"import": "./dist/client/index.mjs",
|
|
38
|
-
"require": "./dist/client/index.js"
|
|
39
|
-
"types": "./dist/client/index.d.ts"
|
|
31
|
+
"require": "./dist/client/index.js"
|
|
40
32
|
},
|
|
41
33
|
"./api": {
|
|
34
|
+
"types": "./dist/api/index.d.ts",
|
|
42
35
|
"import": "./dist/api/index.mjs",
|
|
43
|
-
"require": "./dist/api/index.js"
|
|
44
|
-
"types": "./dist/api/index.d.ts"
|
|
36
|
+
"require": "./dist/api/index.js"
|
|
45
37
|
},
|
|
46
38
|
"./types": {
|
|
47
39
|
"types": "./dist/types.d.ts",
|
|
@@ -49,11 +41,15 @@
|
|
|
49
41
|
"require": "./dist/types.js"
|
|
50
42
|
}
|
|
51
43
|
},
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
44
|
+
"main": "./dist/index.js",
|
|
45
|
+
"module": "./dist/index.mjs",
|
|
46
|
+
"types": "./dist/index.d.ts",
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "bun build.ts",
|
|
49
|
+
"prettier": "bunx prettier --write .",
|
|
50
|
+
"release": "bun run prettier && bun run build && bun run test && bun publish",
|
|
51
|
+
"test": "bun test"
|
|
52
|
+
},
|
|
57
53
|
"devDependencies": {
|
|
58
54
|
"@39choko/prettier-config": "^1.0.2",
|
|
59
55
|
"@types/bun": "latest",
|
|
@@ -72,5 +68,9 @@
|
|
|
72
68
|
"typescript": {
|
|
73
69
|
"optional": true
|
|
74
70
|
}
|
|
71
|
+
},
|
|
72
|
+
"publishConfig": {
|
|
73
|
+
"access": "public",
|
|
74
|
+
"provenance": true
|
|
75
75
|
}
|
|
76
|
-
}
|
|
76
|
+
}
|