@omujs/chat 0.9.47 → 0.9.49
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/dts/chat.d.ts +20 -0
- package/dist/dts/const.d.ts +2 -0
- package/dist/dts/event/event-types.d.ts +15 -0
- package/dist/dts/event/event.d.ts +33 -0
- package/{src/event/index.ts → dist/dts/event/index.d.ts} +0 -1
- package/dist/dts/models/author.d.ts +37 -0
- package/dist/dts/models/channel.d.ts +31 -0
- package/dist/dts/models/content.d.ts +24 -0
- package/dist/dts/models/gift.d.ts +23 -0
- package/{src/models/index.ts → dist/dts/models/index.d.ts} +0 -1
- package/dist/dts/models/message.d.ts +40 -0
- package/dist/dts/models/paid.d.ts +11 -0
- package/dist/dts/models/provider.d.ts +34 -0
- package/dist/dts/models/reaction.d.ts +21 -0
- package/dist/dts/models/role.d.ts +26 -0
- package/dist/dts/models/room.d.ts +44 -0
- package/dist/dts/models/vote.d.ts +33 -0
- package/dist/dts/permissions.d.ts +7 -0
- package/dist/esm/chat.js +7976 -0
- package/dist/esm/const.js +5060 -0
- package/dist/esm/event/event-types.js +76 -0
- package/dist/esm/event/event.js +106 -0
- package/dist/esm/event/index.js +115 -0
- package/dist/esm/index.js +8022 -0
- package/dist/esm/models/author.js +5136 -0
- package/dist/esm/models/channel.js +5102 -0
- package/dist/esm/models/content.js +39 -0
- package/dist/esm/models/gift.js +40 -0
- package/dist/esm/models/index.js +5499 -0
- package/dist/esm/models/message.js +5199 -0
- package/dist/esm/models/paid.js +25 -0
- package/dist/esm/models/provider.js +5106 -0
- package/dist/esm/models/reaction.js +5079 -0
- package/dist/esm/models/role.js +44 -0
- package/dist/esm/models/room.js +5102 -0
- package/dist/esm/models/vote.js +5098 -0
- package/dist/esm/permissions.js +5073 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +28 -25
- package/CHANGELOG.md +0 -1823
- package/src/chat.ts +0 -131
- package/src/const.ts +0 -3
- package/src/event/event-types.ts +0 -16
- package/src/event/event.ts +0 -102
- package/src/models/author.ts +0 -72
- package/src/models/channel.ts +0 -67
- package/src/models/content.ts +0 -62
- package/src/models/gift.ts +0 -49
- package/src/models/message.ts +0 -88
- package/src/models/paid.ts +0 -22
- package/src/models/provider.ts +0 -73
- package/src/models/reaction.ts +0 -39
- package/src/models/role.ts +0 -55
- package/src/models/room.ts +0 -82
- package/src/models/vote.ts +0 -67
- package/src/permissions.ts +0 -9
- package/tsconfig.json +0 -15
- /package/{src/index.ts → dist/dts/index.d.ts} +0 -0
package/src/models/reaction.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { Identifier } from '@omujs/omu';
|
|
2
|
-
|
|
3
|
-
export type ReactionJson = {
|
|
4
|
-
room_id: string;
|
|
5
|
-
reactions: {
|
|
6
|
-
[key: string]: number;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export class Reaction {
|
|
11
|
-
public roomId: Identifier;
|
|
12
|
-
public reactions: {
|
|
13
|
-
[key: string]: number;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
constructor(options: {
|
|
17
|
-
roomId: Identifier;
|
|
18
|
-
reactions: {
|
|
19
|
-
[key: string]: number;
|
|
20
|
-
};
|
|
21
|
-
}) {
|
|
22
|
-
this.roomId = options.roomId;
|
|
23
|
-
this.reactions = options.reactions;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public static deserialize(data: ReactionJson): Reaction {
|
|
27
|
-
return new Reaction({
|
|
28
|
-
roomId: Identifier.fromKey(data.room_id),
|
|
29
|
-
reactions: data.reactions,
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
public static serialize(item: Reaction): ReactionJson {
|
|
34
|
-
return {
|
|
35
|
-
room_id: item.roomId.key(),
|
|
36
|
-
reactions: item.reactions,
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
}
|
package/src/models/role.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
export type RoleJson = {
|
|
2
|
-
id?: string;
|
|
3
|
-
name: string;
|
|
4
|
-
is_owner: boolean;
|
|
5
|
-
is_moderator: boolean;
|
|
6
|
-
icon_url?: string;
|
|
7
|
-
color?: string;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export class Role {
|
|
11
|
-
id?: string;
|
|
12
|
-
name: string;
|
|
13
|
-
isOwner: boolean;
|
|
14
|
-
isModerator: boolean;
|
|
15
|
-
iconUrl?: string;
|
|
16
|
-
color?: string;
|
|
17
|
-
|
|
18
|
-
constructor(options: {
|
|
19
|
-
id?: string;
|
|
20
|
-
name: string;
|
|
21
|
-
isOwner: boolean;
|
|
22
|
-
isModerator: boolean;
|
|
23
|
-
iconUrl?: string;
|
|
24
|
-
color?: string;
|
|
25
|
-
}) {
|
|
26
|
-
this.id = options.id;
|
|
27
|
-
this.name = options.name;
|
|
28
|
-
this.isOwner = options.isOwner;
|
|
29
|
-
this.isModerator = options.isModerator;
|
|
30
|
-
this.iconUrl = options.iconUrl;
|
|
31
|
-
this.color = options.color;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
static fromJson(json: RoleJson): Role {
|
|
35
|
-
return new Role({
|
|
36
|
-
id: json.id,
|
|
37
|
-
name: json.name,
|
|
38
|
-
isOwner: json.is_owner,
|
|
39
|
-
isModerator: json.is_moderator,
|
|
40
|
-
iconUrl: json.icon_url,
|
|
41
|
-
color: json.color,
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
toJson(): RoleJson {
|
|
46
|
-
return {
|
|
47
|
-
id: this.id,
|
|
48
|
-
name: this.name,
|
|
49
|
-
color: this.color,
|
|
50
|
-
icon_url: this.iconUrl,
|
|
51
|
-
is_owner: this.isOwner,
|
|
52
|
-
is_moderator: this.isModerator,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
}
|
package/src/models/room.ts
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { Identifier } from '@omujs/omu';
|
|
2
|
-
|
|
3
|
-
export type MetadataJson = {
|
|
4
|
-
title?: string;
|
|
5
|
-
description?: string;
|
|
6
|
-
url?: string;
|
|
7
|
-
thumbnail?: string;
|
|
8
|
-
viewers?: number;
|
|
9
|
-
created_at?: string;
|
|
10
|
-
started_at?: string;
|
|
11
|
-
ended_at?: string;
|
|
12
|
-
first_message_id?: string;
|
|
13
|
-
last_message_id?: string;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export type Status = 'online' | 'reserved' | 'offline';
|
|
17
|
-
|
|
18
|
-
export type RoomJson = {
|
|
19
|
-
id: string;
|
|
20
|
-
provider_id: string;
|
|
21
|
-
connected: boolean;
|
|
22
|
-
status: Status;
|
|
23
|
-
metadata: MetadataJson;
|
|
24
|
-
channel_id?: string;
|
|
25
|
-
created_at: string; // ISO 8601 date string
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export class Room {
|
|
29
|
-
public id: Identifier;
|
|
30
|
-
public providerId: Identifier;
|
|
31
|
-
public connected: boolean;
|
|
32
|
-
public status: Status;
|
|
33
|
-
public metadata: MetadataJson;
|
|
34
|
-
public channelId?: string;
|
|
35
|
-
public createdAt: Date;
|
|
36
|
-
|
|
37
|
-
constructor(options: {
|
|
38
|
-
id: Identifier;
|
|
39
|
-
providerId: Identifier;
|
|
40
|
-
connected: boolean;
|
|
41
|
-
status: Status;
|
|
42
|
-
metadata: MetadataJson;
|
|
43
|
-
channelId?: string;
|
|
44
|
-
createdAt: Date;
|
|
45
|
-
}) {
|
|
46
|
-
this.id = options.id;
|
|
47
|
-
this.providerId = options.providerId;
|
|
48
|
-
this.connected = options.connected;
|
|
49
|
-
this.status = options.status;
|
|
50
|
-
this.metadata = options.metadata;
|
|
51
|
-
this.channelId = options.channelId;
|
|
52
|
-
this.createdAt = options.createdAt;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
public static deserialize(options: RoomJson): Room {
|
|
56
|
-
return new Room({
|
|
57
|
-
id: Identifier.fromKey(options.id),
|
|
58
|
-
providerId: Identifier.fromKey(options.provider_id),
|
|
59
|
-
connected: options.connected,
|
|
60
|
-
status: options.status,
|
|
61
|
-
metadata: options.metadata,
|
|
62
|
-
channelId: options.channel_id,
|
|
63
|
-
createdAt: new Date(options.created_at),
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
public static serialize(item: Room): RoomJson {
|
|
68
|
-
return {
|
|
69
|
-
id: item.id.key(),
|
|
70
|
-
provider_id: item.providerId.key(),
|
|
71
|
-
connected: item.connected,
|
|
72
|
-
status: item.status,
|
|
73
|
-
metadata: item.metadata,
|
|
74
|
-
channel_id: item.channelId,
|
|
75
|
-
created_at: item.createdAt.toISOString(),
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
key(): string {
|
|
80
|
-
return this.id.key();
|
|
81
|
-
}
|
|
82
|
-
}
|
package/src/models/vote.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { Identifier } from '@omujs/omu';
|
|
2
|
-
|
|
3
|
-
export type Choice = {
|
|
4
|
-
text: string;
|
|
5
|
-
ratio: number;
|
|
6
|
-
count?: number;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export type VoteJson = {
|
|
10
|
-
id: string;
|
|
11
|
-
room_id: string;
|
|
12
|
-
title: string;
|
|
13
|
-
choices: Choice[];
|
|
14
|
-
ended: boolean;
|
|
15
|
-
total: number | null;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export class Vote {
|
|
19
|
-
public readonly id: Identifier;
|
|
20
|
-
public readonly roomId: Identifier;
|
|
21
|
-
public title: string;
|
|
22
|
-
public choices: Choice[];
|
|
23
|
-
public ended: boolean;
|
|
24
|
-
public total: number | null;
|
|
25
|
-
|
|
26
|
-
constructor(options: {
|
|
27
|
-
id: Identifier;
|
|
28
|
-
roomId: Identifier;
|
|
29
|
-
title: string;
|
|
30
|
-
choices: Choice[];
|
|
31
|
-
ended: boolean;
|
|
32
|
-
total: number | null;
|
|
33
|
-
}) {
|
|
34
|
-
this.id = options.id;
|
|
35
|
-
this.roomId = options.roomId;
|
|
36
|
-
this.title = options.title;
|
|
37
|
-
this.choices = options.choices;
|
|
38
|
-
this.ended = options.ended;
|
|
39
|
-
this.total = options.total;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
public static deserialize(options: VoteJson): Vote {
|
|
43
|
-
return new Vote({
|
|
44
|
-
id: Identifier.fromKey(options.id),
|
|
45
|
-
roomId: Identifier.fromKey(options.room_id),
|
|
46
|
-
title: options.title,
|
|
47
|
-
choices: options.choices,
|
|
48
|
-
ended: options.ended,
|
|
49
|
-
total: options.total,
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
public static serialize(item: Vote): VoteJson {
|
|
54
|
-
return {
|
|
55
|
-
id: item.id.key(),
|
|
56
|
-
room_id: item.roomId.key(),
|
|
57
|
-
title: item.title,
|
|
58
|
-
choices: item.choices,
|
|
59
|
-
ended: item.ended,
|
|
60
|
-
total: item.total,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
public key(): string {
|
|
65
|
-
return this.id.key();
|
|
66
|
-
}
|
|
67
|
-
}
|
package/src/permissions.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Identifier } from '@omujs/omu';
|
|
2
|
-
import { PLUGIN_ID } from './const.js';
|
|
3
|
-
|
|
4
|
-
export const CHAT_PERMISSION_ID: Identifier = PLUGIN_ID;
|
|
5
|
-
export const CHAT_READ_PERMISSION_ID: Identifier = PLUGIN_ID.join('chat', 'read');
|
|
6
|
-
export const CHAT_WRITE_PERMISSION_ID: Identifier = PLUGIN_ID.join('chat', 'write');
|
|
7
|
-
export const CHAT_SEND_PERMISSION_ID: Identifier = PLUGIN_ID.join('chat', 'send');
|
|
8
|
-
export const CHAT_CHANNEL_TREE_PERMISSION_ID: Identifier = PLUGIN_ID.join('create_channel_tree');
|
|
9
|
-
export const CHAT_REACTION_PERMISSION_ID: Identifier = PLUGIN_ID.join('reaction');
|
package/tsconfig.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json.schemastore.org/tsconfig",
|
|
3
|
-
"extends": "../../tsconfig.json",
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
"isolatedDeclarations": true,
|
|
6
|
-
"declaration": true
|
|
7
|
-
},
|
|
8
|
-
"compileOnSave": true,
|
|
9
|
-
"include": [
|
|
10
|
-
"./src/**/*"
|
|
11
|
-
],
|
|
12
|
-
"exclude": [
|
|
13
|
-
"dist",
|
|
14
|
-
],
|
|
15
|
-
}
|
|
File without changes
|