@omujs/chat 0.1.22

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.
Files changed (94) hide show
  1. package/.eslintignore +13 -0
  2. package/.eslintrc.cjs +6 -0
  3. package/.prettierignore +1 -0
  4. package/CHANGELOG.md +262 -0
  5. package/LICENSE +21 -0
  6. package/README.md +1 -0
  7. package/built/dts/chat.d.ts +14 -0
  8. package/built/dts/chat.d.ts.map +1 -0
  9. package/built/dts/client.d.ts +24 -0
  10. package/built/dts/client.d.ts.map +1 -0
  11. package/built/dts/const.d.ts +3 -0
  12. package/built/dts/const.d.ts.map +1 -0
  13. package/built/dts/event/event-registry.d.ts +12 -0
  14. package/built/dts/event/event-registry.d.ts.map +1 -0
  15. package/built/dts/event/event.d.ts +26 -0
  16. package/built/dts/event/event.d.ts.map +1 -0
  17. package/built/dts/event/index.d.ts +3 -0
  18. package/built/dts/event/index.d.ts.map +1 -0
  19. package/built/dts/index.d.ts +4 -0
  20. package/built/dts/index.d.ts.map +1 -0
  21. package/built/dts/models/author.d.ts +40 -0
  22. package/built/dts/models/author.d.ts.map +1 -0
  23. package/built/dts/models/channel.d.ts +34 -0
  24. package/built/dts/models/channel.d.ts.map +1 -0
  25. package/built/dts/models/content.d.ts +76 -0
  26. package/built/dts/models/content.d.ts.map +1 -0
  27. package/built/dts/models/gift.d.ts +25 -0
  28. package/built/dts/models/gift.d.ts.map +1 -0
  29. package/built/dts/models/index.d.ts +10 -0
  30. package/built/dts/models/index.d.ts.map +1 -0
  31. package/built/dts/models/message.d.ts +40 -0
  32. package/built/dts/models/message.d.ts.map +1 -0
  33. package/built/dts/models/paid.d.ts +13 -0
  34. package/built/dts/models/paid.d.ts.map +1 -0
  35. package/built/dts/models/provider.d.ts +37 -0
  36. package/built/dts/models/provider.d.ts.map +1 -0
  37. package/built/dts/models/role.d.ts +28 -0
  38. package/built/dts/models/role.d.ts.map +1 -0
  39. package/built/dts/models/room.d.ts +45 -0
  40. package/built/dts/models/room.d.ts.map +1 -0
  41. package/built/dts/permissions.d.ts +6 -0
  42. package/built/dts/permissions.d.ts.map +1 -0
  43. package/built/esm/chat.js +81 -0
  44. package/built/esm/chat.js.map +1 -0
  45. package/built/esm/client.js +44 -0
  46. package/built/esm/client.js.map +1 -0
  47. package/built/esm/const.js +3 -0
  48. package/built/esm/const.js.map +1 -0
  49. package/built/esm/event/event-registry.js +35 -0
  50. package/built/esm/event/event-registry.js.map +1 -0
  51. package/built/esm/event/event.js +40 -0
  52. package/built/esm/event/event.js.map +1 -0
  53. package/built/esm/event/index.js +3 -0
  54. package/built/esm/event/index.js.map +1 -0
  55. package/built/esm/index.js +4 -0
  56. package/built/esm/index.js.map +1 -0
  57. package/built/esm/models/author.js +42 -0
  58. package/built/esm/models/author.js.map +1 -0
  59. package/built/esm/models/channel.js +45 -0
  60. package/built/esm/models/channel.js.map +1 -0
  61. package/built/esm/models/content.js +154 -0
  62. package/built/esm/models/content.js.map +1 -0
  63. package/built/esm/models/gift.js +33 -0
  64. package/built/esm/models/gift.js.map +1 -0
  65. package/built/esm/models/index.js +10 -0
  66. package/built/esm/models/index.js.map +1 -0
  67. package/built/esm/models/message.js +57 -0
  68. package/built/esm/models/message.js.map +1 -0
  69. package/built/esm/models/paid.js +18 -0
  70. package/built/esm/models/paid.js.map +1 -0
  71. package/built/esm/models/provider.js +49 -0
  72. package/built/esm/models/provider.js.map +1 -0
  73. package/built/esm/models/role.js +37 -0
  74. package/built/esm/models/role.js.map +1 -0
  75. package/built/esm/models/room.js +45 -0
  76. package/built/esm/models/room.js.map +1 -0
  77. package/built/esm/permissions.js +7 -0
  78. package/built/esm/permissions.js.map +1 -0
  79. package/package.json +53 -0
  80. package/src/chat.ts +90 -0
  81. package/src/const.ts +3 -0
  82. package/src/index.ts +3 -0
  83. package/src/models/author.ts +74 -0
  84. package/src/models/channel.ts +69 -0
  85. package/src/models/content.ts +207 -0
  86. package/src/models/gift.ts +51 -0
  87. package/src/models/index.ts +10 -0
  88. package/src/models/message.ts +85 -0
  89. package/src/models/paid.ts +24 -0
  90. package/src/models/provider.ts +75 -0
  91. package/src/models/role.ts +57 -0
  92. package/src/models/room.ts +82 -0
  93. package/src/permissions.ts +7 -0
  94. package/tsconfig.json +12 -0
@@ -0,0 +1,74 @@
1
+ import { Identifier } from '@omujs/omu/identifier.js';
2
+ import type { Keyable } from '@omujs/omu/interface.js';
3
+ import type { Model } from '@omujs/omu/model.js';
4
+
5
+ import type { RoleJson } from './role.js';
6
+ import { Role } from './role.js';
7
+
8
+ export type AuthorMetadata = {
9
+ url?: string;
10
+ screen_id?: string;
11
+ avatar_url?: string;
12
+ description?: string;
13
+ links?: string[];
14
+ };
15
+
16
+ export type AuthorJson = {
17
+ provider_id: string;
18
+ id: string;
19
+ name?: string;
20
+ avatar_url?: string;
21
+ roles?: RoleJson[];
22
+ metadata?: AuthorMetadata;
23
+ };
24
+
25
+ export class Author implements Keyable, Model<AuthorJson> {
26
+ public providerId: Identifier;
27
+ public id: Identifier;
28
+ public name?: string;
29
+ public avatarUrl?: string;
30
+ public roles?: Role[];
31
+ public metadata?: AuthorMetadata;
32
+
33
+ constructor(options: {
34
+ providerId: Identifier;
35
+ id: Identifier;
36
+ name?: string;
37
+ avatarUrl?: string;
38
+ roles?: Role[];
39
+ metadata?: AuthorMetadata;
40
+ }) {
41
+ this.providerId = options.providerId;
42
+ this.id = options.id;
43
+ this.name = options.name;
44
+ this.avatarUrl = options.avatarUrl;
45
+ this.roles = options.roles;
46
+ this.metadata = options.metadata;
47
+ }
48
+
49
+ static fromJson(info: AuthorJson): Author {
50
+ return new Author({
51
+ providerId: Identifier.fromKey(info.provider_id),
52
+ id: Identifier.fromKey(info.id),
53
+ name: info.name,
54
+ avatarUrl: info.avatar_url,
55
+ roles: info.roles?.map((role) => Role.fromJson(role)),
56
+ metadata: info.metadata,
57
+ });
58
+ }
59
+
60
+ key(): string {
61
+ return `${this.providerId}:${this.id}`;
62
+ }
63
+
64
+ toJson(): AuthorJson {
65
+ return {
66
+ provider_id: this.providerId.key(),
67
+ id: this.id.key(),
68
+ name: this.name,
69
+ avatar_url: this.avatarUrl,
70
+ roles: this.roles?.map((role) => role.toJson()),
71
+ metadata: this.metadata,
72
+ };
73
+ }
74
+ }
@@ -0,0 +1,69 @@
1
+ import { Identifier } from '@omujs/omu/identifier.js';
2
+ import type { Keyable } from '@omujs/omu/interface.js';
3
+ import type { Model } from '@omujs/omu/model.js';
4
+
5
+ export type ChannelJson = {
6
+ provider_id: string;
7
+ id: string;
8
+ url: string;
9
+ name: string;
10
+ description: string;
11
+ active: boolean;
12
+ icon_url: string;
13
+ };
14
+
15
+ export class Channel implements Model<ChannelJson>, Keyable {
16
+ providerId: Identifier;
17
+ id: Identifier;
18
+ url: string;
19
+ name: string;
20
+ description: string;
21
+ active: boolean;
22
+ iconUrl: string;
23
+
24
+ constructor(option: {
25
+ providerId: Identifier;
26
+ id: Identifier;
27
+ url: string;
28
+ name: string;
29
+ description: string;
30
+ active: boolean;
31
+ iconUrl: string;
32
+ }) {
33
+ this.providerId = option.providerId;
34
+ this.id = option.id;
35
+ this.url = option.url;
36
+ this.name = option.name;
37
+ this.description = option.description;
38
+ this.active = option.active;
39
+ this.iconUrl = option.iconUrl;
40
+ }
41
+
42
+ static fromJson(json: ChannelJson): Channel {
43
+ return new Channel({
44
+ providerId: Identifier.fromKey(json.provider_id),
45
+ id: Identifier.fromKey(json.id),
46
+ url: json.url,
47
+ name: json.name,
48
+ description: json.description,
49
+ active: json.active,
50
+ iconUrl: json.icon_url,
51
+ });
52
+ }
53
+
54
+ key(): string {
55
+ return this.id.key();
56
+ }
57
+
58
+ toJson(): ChannelJson {
59
+ return {
60
+ provider_id: this.providerId.key(),
61
+ id: this.id.key(),
62
+ url: this.url,
63
+ name: this.name,
64
+ description: this.description,
65
+ active: this.active,
66
+ icon_url: this.iconUrl,
67
+ };
68
+ }
69
+ }
@@ -0,0 +1,207 @@
1
+ type Primitive =
2
+ | {
3
+ [key: string]: Primitive | string | number | boolean | null;
4
+ }
5
+ | any[]
6
+ | string
7
+ | number
8
+ | boolean
9
+ | null;
10
+
11
+ export type ComponentJson = {
12
+ type: string;
13
+ data: Primitive;
14
+ };
15
+
16
+ export interface Parent {
17
+ children: Component[];
18
+ }
19
+
20
+ export abstract class Component<T extends string = string, D extends Primitive = Primitive> {
21
+ constructor(public type: T) { }
22
+
23
+ abstract toJson(): D;
24
+
25
+ isParent(): this is Parent {
26
+ return 'children' in this;
27
+ }
28
+
29
+ walk(cb: (component: Component) => void): void {
30
+ const stack: Component[] = [this];
31
+ while (stack.length) {
32
+ const component = stack.pop();
33
+ if (!component) {
34
+ continue;
35
+ }
36
+ cb(component);
37
+ if (component.isParent()) {
38
+ stack.push(...component.children);
39
+ }
40
+ }
41
+ }
42
+
43
+ *iter(): Iterable<Component> {
44
+ const stack: Component[] = [this];
45
+ while (stack.length) {
46
+ const component = stack.pop();
47
+ if (!component) {
48
+ continue;
49
+ }
50
+ yield component;
51
+ if (component.isParent()) {
52
+ stack.push(...component.children);
53
+ }
54
+ }
55
+ }
56
+
57
+ toString(): string {
58
+ const parts = [] as string[];
59
+ for (const component of this.iter()) {
60
+ if (component instanceof Text) {
61
+ parts.push(component.text);
62
+ }
63
+ }
64
+ return parts.join('');
65
+ }
66
+ }
67
+
68
+ export type ComponentType<D, C extends Component> = {
69
+ type: string;
70
+ fromJson(json: D): C;
71
+ };
72
+
73
+ const componentTypes: Record<string, ComponentType<unknown, Component> | undefined> = {};
74
+
75
+ export function deserialize(json: ComponentJson): Component {
76
+ const type = componentTypes[json.type];
77
+ if (!type) {
78
+ throw new Error(`Unknown component type: ${json.type}`);
79
+ }
80
+ return type.fromJson(json.data);
81
+ }
82
+
83
+ export function serialize(component: Component): ComponentJson {
84
+ return {
85
+ type: component.type,
86
+ data: component.toJson(),
87
+ };
88
+ }
89
+
90
+ export function register<D, C extends Component>(type: string, deserialize: (json: D) => C): void {
91
+ if (componentTypes[type]) {
92
+ throw new Error(`Component type already registered: ${type}`);
93
+ }
94
+ componentTypes[type] = {
95
+ type,
96
+ fromJson: deserialize,
97
+ };
98
+ }
99
+
100
+ export type RootData = ComponentJson[];
101
+
102
+ export class Root extends Component<'root', RootData> implements Parent {
103
+ constructor(public children: Component[]) {
104
+ super('root');
105
+ }
106
+
107
+ toJson(): RootData {
108
+ return this.children.map(serialize);
109
+ }
110
+
111
+ add(component: Component): void {
112
+ this.children.push(component);
113
+ }
114
+
115
+ text(): string {
116
+ const parts = [] as string[];
117
+ for (const component of this.iter()) {
118
+ if (component instanceof Text) {
119
+ parts.push(component.text);
120
+ }
121
+ }
122
+ return parts.join('');
123
+ }
124
+ }
125
+
126
+ export type TextData = string;
127
+
128
+ export class Text extends Component<'text', TextData> {
129
+ constructor(public text: string) {
130
+ super('text');
131
+ }
132
+
133
+ toJson(): TextData {
134
+ return this.text;
135
+ }
136
+
137
+ static of(text: string): Text {
138
+ return new Text(text);
139
+ }
140
+ }
141
+
142
+ export type ImageData = {
143
+ url: string;
144
+ id: string;
145
+ name?: string;
146
+ };
147
+
148
+ export class Image extends Component<'image', ImageData> {
149
+ constructor(
150
+ public url: string,
151
+ public id: string,
152
+ public name: string | undefined = undefined,
153
+ ) {
154
+ super('image');
155
+ }
156
+
157
+ toJson(): ImageData {
158
+ return {
159
+ url: this.url,
160
+ id: this.id,
161
+ name: this.name,
162
+ };
163
+ }
164
+
165
+ static of({ url, id, name }: { url: string; id: string; name?: string }): Image {
166
+ return new Image(url, id, name);
167
+ }
168
+ }
169
+
170
+ export type LinkData = {
171
+ url: string;
172
+ children: ComponentJson[];
173
+ };
174
+
175
+ export class Link extends Component<'link', LinkData> implements Parent {
176
+ constructor(
177
+ public url: string,
178
+ public children: Component[],
179
+ ) {
180
+ super('link');
181
+ }
182
+
183
+ toJson(): LinkData {
184
+ return {
185
+ url: this.url,
186
+ children: this.children.map(serialize),
187
+ };
188
+ }
189
+ }
190
+
191
+ export type SystemData = ComponentJson[];
192
+
193
+ export class System extends Component<'system', SystemData> implements Parent {
194
+ constructor(public children: Component[]) {
195
+ super('system');
196
+ }
197
+
198
+ toJson(): SystemData {
199
+ return this.children.map(serialize);
200
+ }
201
+ }
202
+
203
+ register('root', (json: RootData) => new Root(json.map(deserialize)));
204
+ register('text', (json: TextData) => new Text(json));
205
+ register('image', (json: ImageData) => new Image(json.url, json.id, json.name));
206
+ register('link', (json: LinkData) => new Link(json.url, json.children.map(deserialize)));
207
+ register('system', (json: SystemData) => new System(json.map(deserialize)));
@@ -0,0 +1,51 @@
1
+ import type { Model } from '@omujs/omu/model.js';
2
+
3
+ export type GiftJson = {
4
+ id: string;
5
+ name?: string;
6
+ amount?: number;
7
+ is_paid?: boolean;
8
+ image_url?: string;
9
+ };
10
+
11
+ export class Gift implements Model<GiftJson> {
12
+ id: string;
13
+ name?: string;
14
+ amount?: number;
15
+ isPaid?: boolean;
16
+ imageUrl?: string;
17
+
18
+ constructor(options: {
19
+ id: string;
20
+ name?: string;
21
+ amount?: number;
22
+ isPaid?: boolean;
23
+ imageUrl?: string;
24
+ }) {
25
+ this.id = options.id;
26
+ this.name = options.name;
27
+ this.amount = options.amount;
28
+ this.isPaid = options.isPaid;
29
+ this.imageUrl = options.imageUrl;
30
+ }
31
+
32
+ static fromJson(options: GiftJson): Gift {
33
+ return new Gift({
34
+ id: options.id,
35
+ name: options.name,
36
+ amount: options.amount,
37
+ isPaid: options.is_paid,
38
+ imageUrl: options.image_url,
39
+ });
40
+ }
41
+
42
+ toJson(): GiftJson {
43
+ return {
44
+ id: this.id,
45
+ name: this.name,
46
+ amount: this.amount,
47
+ is_paid: this.isPaid,
48
+ image_url: this.imageUrl,
49
+ };
50
+ }
51
+ }
@@ -0,0 +1,10 @@
1
+ export { Author } from './author.js';
2
+ export { Channel } from './channel.js';
3
+ export * as content from './content.js';
4
+ export { Gift } from './gift.js';
5
+ export { Message } from './message.js';
6
+ export { Paid } from './paid.js';
7
+ export { Provider } from './provider.js';
8
+ export { Role } from './role.js';
9
+ export { Room } from './room.js';
10
+
@@ -0,0 +1,85 @@
1
+ import { Identifier } from '@omujs/omu/identifier.js';
2
+ import type { Keyable, Timestamped } from '@omujs/omu/interface.js';
3
+ import type { Model } from '@omujs/omu/model.js';
4
+
5
+ import * as content from './content.js';
6
+ import type { GiftJson } from './gift.js';
7
+ import { Gift } from './gift.js';
8
+ import type { PaidJson } from './paid.js';
9
+ import { Paid } from './paid.js';
10
+
11
+ export type MessageJson = {
12
+ room_id: string;
13
+ id: string;
14
+ created_at: string; // ISO 8601 date string
15
+ author_id?: string;
16
+ content?: content.ComponentJson;
17
+ paid?: PaidJson;
18
+ gifts?: GiftJson[];
19
+ };
20
+
21
+ export class Message implements Model<MessageJson>, Keyable, Timestamped {
22
+ public roomId: Identifier;
23
+ public id: Identifier;
24
+ public authorId?: Identifier;
25
+ public content?: content.Component;
26
+ public paid?: Paid;
27
+ public gifts?: Gift[];
28
+ public createdAt: Date;
29
+
30
+ constructor(options: {
31
+ roomId: Identifier;
32
+ id: Identifier;
33
+ authorId?: Identifier;
34
+ createdAt: Date;
35
+ content?: content.Component;
36
+ paid?: Paid;
37
+ gifts?: Gift[];
38
+ }) {
39
+ if (!(options.createdAt instanceof Date)) {
40
+ throw new Error('created_at must be a Date');
41
+ }
42
+ this.roomId = options.roomId;
43
+ this.id = options.id;
44
+ this.authorId = options.authorId;
45
+ this.content = options.content;
46
+ this.paid = options.paid;
47
+ this.gifts = options.gifts;
48
+ this.createdAt = options.createdAt;
49
+ }
50
+
51
+ static fromJson(info: MessageJson): Message {
52
+ return new Message({
53
+ roomId: Identifier.fromKey(info.room_id),
54
+ id: Identifier.fromKey(info.id),
55
+ authorId: info.author_id ? Identifier.fromKey(info.author_id) : undefined,
56
+ content: info.content && content.deserialize(info.content),
57
+ paid: info.paid && Paid.fromJson(info.paid),
58
+ gifts: info.gifts?.map((gift) => Gift.fromJson(gift)),
59
+ createdAt: new Date(info.created_at),
60
+ });
61
+ }
62
+
63
+ get text(): string {
64
+ if (!this.content) {
65
+ return '';
66
+ }
67
+ return this.content.toString();
68
+ }
69
+
70
+ key(): string {
71
+ return this.id.key();
72
+ }
73
+
74
+ toJson(): MessageJson {
75
+ return {
76
+ room_id: this.roomId.key(),
77
+ id: this.id.key(),
78
+ author_id: this.authorId?.key(),
79
+ created_at: this.createdAt.toISOString(),
80
+ content: this.content && content.serialize(this.content),
81
+ paid: this.paid?.toJson(),
82
+ gifts: this.gifts?.map((gift) => gift.toJson()),
83
+ };
84
+ }
85
+ }
@@ -0,0 +1,24 @@
1
+ import type { Model } from '@omujs/omu/model.js';
2
+
3
+ export type PaidJson = {
4
+ amount: number;
5
+ currency: string;
6
+ };
7
+
8
+ export class Paid implements Model<PaidJson> {
9
+ constructor(
10
+ public amount: number,
11
+ public currency: string,
12
+ ) { }
13
+
14
+ static fromJson(options: PaidJson): Paid {
15
+ return new Paid(options.amount, options.currency);
16
+ }
17
+
18
+ toJson(): PaidJson {
19
+ return {
20
+ amount: this.amount,
21
+ currency: this.currency,
22
+ };
23
+ }
24
+ }
@@ -0,0 +1,75 @@
1
+ import { Identifier } from '@omujs/omu/identifier.js';
2
+ import type { Keyable } from '@omujs/omu/interface.js';
3
+ import type { Model } from '@omujs/omu/model.js';
4
+
5
+ export type ProviderJson = {
6
+ id: string;
7
+ url: string;
8
+ name: string;
9
+ version: string;
10
+ repository_url: string;
11
+ image_url?: string;
12
+ description: string;
13
+ regex: string;
14
+ };
15
+
16
+ export class Provider implements Keyable, Model<ProviderJson> {
17
+ public id: Identifier;
18
+ public url: string;
19
+ public name: string;
20
+ public version: string;
21
+ public repositoryUrl: string;
22
+ public imageUrl?: string;
23
+ public description: string;
24
+ public regex: string;
25
+
26
+ constructor(options: {
27
+ id: Identifier;
28
+ url: string;
29
+ name: string;
30
+ version: string;
31
+ repository_url: string;
32
+ image_url?: string;
33
+ description: string;
34
+ regex: string;
35
+ }) {
36
+ this.id = options.id;
37
+ this.url = options.url;
38
+ this.name = options.name;
39
+ this.version = options.version;
40
+ this.repositoryUrl = options.repository_url;
41
+ this.imageUrl = options.image_url;
42
+ this.description = options.description;
43
+ this.regex = options.regex;
44
+ }
45
+
46
+ static fromJson(data: ProviderJson): Provider {
47
+ return new Provider({
48
+ id: Identifier.fromKey(data.id),
49
+ url: data.url,
50
+ name: data.name,
51
+ version: data.version,
52
+ repository_url: data.repository_url,
53
+ image_url: data.image_url,
54
+ description: data.description,
55
+ regex: data.regex,
56
+ });
57
+ }
58
+
59
+ toJson(): ProviderJson {
60
+ return {
61
+ id: this.id.key(),
62
+ url: this.url,
63
+ name: this.name,
64
+ version: this.version,
65
+ repository_url: this.repositoryUrl,
66
+ image_url: this.imageUrl,
67
+ description: this.description,
68
+ regex: this.regex,
69
+ };
70
+ }
71
+
72
+ key(): string {
73
+ return this.id.key();
74
+ }
75
+ }
@@ -0,0 +1,57 @@
1
+ import type { Model } from '@omujs/omu/model.js';
2
+
3
+ export type RoleJson = {
4
+ id?: string;
5
+ name: string;
6
+ is_owner: boolean;
7
+ is_moderator: boolean;
8
+ icon_url?: string;
9
+ color?: string;
10
+ };
11
+
12
+ export class Role implements Model<RoleJson> {
13
+ id?: string;
14
+ name: string;
15
+ isOwner: boolean;
16
+ isModerator: boolean;
17
+ iconUrl?: string;
18
+ color?: string;
19
+
20
+ constructor(options: {
21
+ id?: string;
22
+ name: string;
23
+ isOwner: boolean;
24
+ isModerator: boolean;
25
+ iconUrl?: string;
26
+ color?: string;
27
+ }) {
28
+ this.id = options.id;
29
+ this.name = options.name;
30
+ this.isOwner = options.isOwner;
31
+ this.isModerator = options.isModerator;
32
+ this.iconUrl = options.iconUrl;
33
+ this.color = options.color;
34
+ }
35
+
36
+ static fromJson(json: RoleJson): Role {
37
+ return new Role({
38
+ id: json.id,
39
+ name: json.name,
40
+ isOwner: json.is_owner,
41
+ isModerator: json.is_moderator,
42
+ iconUrl: json.icon_url,
43
+ color: json.color,
44
+ });
45
+ }
46
+
47
+ toJson(): RoleJson {
48
+ return {
49
+ id: this.id,
50
+ name: this.name,
51
+ color: this.color,
52
+ icon_url: this.iconUrl,
53
+ is_owner: this.isOwner,
54
+ is_moderator: this.isModerator,
55
+ };
56
+ }
57
+ }