alemonjs 2.1.27 → 2.1.29

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.
@@ -18,7 +18,7 @@ export declare const useMention: <T extends EventKeys>(event: Events[T]) => [{
18
18
  }];
19
19
  export declare const useMessage: <T extends EventKeys>(event: Events[T]) => readonly [{
20
20
  "__#11@#format": DataEnums[];
21
- readonly currentFormat: DataEnums[];
21
+ readonly currentFormat: any[];
22
22
  addText(val: string, options?: {
23
23
  style?: "none" | "bold" | "block" | "strikethrough" | "boldItalic" | "italic";
24
24
  }): any;
@@ -33,11 +33,9 @@ export declare const useMessage: <T extends EventKeys>(event: Events[T]) => read
33
33
  payload?: User | import("..").Guild | import("..").Channel | "everyone";
34
34
  }): any;
35
35
  addButtonGroup(...args: Parameters<typeof BT.group>): any;
36
- addButtonTemplate(templateId: string): any;
36
+ addButtonTemplate(...args: Parameters<typeof BT.template>): any;
37
37
  addMarkdown(...args: Parameters<typeof MD>): any;
38
- addMarkdownTemplate(templateId: string, params?: {
39
- [key: string]: string;
40
- }): any;
38
+ addMarkdownTemplate(...args: Parameters<typeof MD.template>): any;
41
39
  addFormat(val: DataEnums[]): any;
42
40
  clear(): any;
43
41
  send(params?: {
@@ -47,7 +45,7 @@ export declare const useMessage: <T extends EventKeys>(event: Events[T]) => read
47
45
  export declare const useMember: <T extends EventKeys>(event: Events[T]) => readonly [{}];
48
46
  export declare const useChannel: <T extends EventKeys>(event: Events[T]) => readonly [{}];
49
47
  export declare const useSend: <T extends EventKeys>(event: Events[T]) => (...val: DataEnums[]) => Promise<Result[]>;
50
- export declare const useSends: <T extends EventKeys>(event: Events[T]) => readonly [(params?: DataEnums[] | {
48
+ export declare const useSends: <T extends EventKeys>(event: Events[T]) => readonly [(params?: any[] | {
51
49
  format: Format | DataEnums[];
52
50
  }) => Promise<Result[]>];
53
51
  export declare const unChildren: (name?: string) => void;
package/lib/app/index.js CHANGED
@@ -19,4 +19,4 @@ export { onState, unState, useState } from './hook-use-state.js';
19
19
  export { useObserver, useSubscribe } from './hook-use-subscribe.js';
20
20
  export { createDataFormat, createEventValue, format, getMessageIntent, sendToChannel, sendToUser } from './message-api.js';
21
21
  export { Format, FormatButtonGroup, FormatMarkDown, createEvent } from './message-format.js';
22
- export { Ark, Attachment, Audio, BT, Custom, Image, ImageFile, ImageURL, Link, MD, Markdown, Mention, Text, Video } from './message-format-old.js';
22
+ export { Ark, Attachment, Audio, BT, Button, Image, ImageFile, ImageURL, Link, MD, Markdown, MarkdownOriginal, Mention, Text, Video } from './message-format-old.js';
@@ -1,5 +1,4 @@
1
- import { DataMention, DataImage, DataText, DataImageURL, DataImageFile, ButtonRow, DataButtonGroup, DataButton, DataArkList, DataArkListTip, DataArkListContent, DataArkListItem, DataArkCard, DataArkBigCard, DataMarkdownTemplate, DataMarkDown, DataMarkdownTitle, DataMarkdownSubtitle, DataMarkdownBold, DataMarkdownItalic, DataMarkdownItalicStar, DataMarkdownStrikethrough, DataMarkdownLink, DataMarkdownImage, DataMarkdownList, DataMarkdownListItem, DataMarkdownBlockquote, DataMarkdownDivider, DataMarkdownNewline, DataLink, DataMarkdownText, DataButtonTemplate, DataMarkdownCode, DataCustom, DataMarkdownOriginal, DataAttachment, DataAudio, DataVideo, DataMarkdownMention, DataMarkdownContent, DataMarkdownButton } from '../types';
2
- export declare const Custom: (value: DataCustom["value"], options?: DataCustom["options"], type?: DataCustom["type"]) => DataCustom;
1
+ import { DataMention, DataImage, DataText, DataImageURL, DataImageFile, DataButtonRow, DataButtonGroup, DataButton, DataArkList, DataArkListTip, DataArkListContent, DataArkListItem, DataArkCard, DataArkBigCard, DataMarkDown, DataMarkdownTitle, DataMarkdownSubtitle, DataMarkdownBold, DataMarkdownItalic, DataMarkdownItalicStar, DataMarkdownStrikethrough, DataMarkdownLink, DataMarkdownImage, DataMarkdownList, DataMarkdownListItem, DataMarkdownBlockquote, DataMarkdownDivider, DataMarkdownNewline, DataLink, DataMarkdownText, DataMarkdownCode, DataMarkdownOriginal, DataAttachment, DataAudio, DataVideo, DataMarkdownMention, DataMarkdownContent, DataMarkdownButton } from '../types';
3
2
  export declare const Text: (val: DataText["value"], options?: DataText["options"]) => DataText;
4
3
  export declare const Link: (val: DataLink["value"], options?: DataText["options"]) => DataText;
5
4
  export declare const ImageURL: (val: DataImageURL["value"]) => DataImageURL;
@@ -11,13 +10,16 @@ declare const Image: {
11
10
  };
12
11
  export { Image };
13
12
  export declare const Mention: (UserId?: DataMention["value"], options?: DataMention["options"]) => DataMention;
14
- declare const BT: {
13
+ export declare const Button: {
15
14
  (title: string, data: DataButton["options"]["data"], options?: Omit<DataButton["options"], "data">): DataButton;
16
- group(...rows: ButtonRow[]): DataButtonGroup;
17
- template(templateId: DataButtonTemplate["value"]): DataButtonTemplate;
18
- row(...buttons: DataButton[]): ButtonRow;
15
+ group: (...rows: DataButtonRow[]) => DataButtonGroup;
16
+ row: (...buttons: DataButton[]) => DataButtonRow;
17
+ };
18
+ export declare const BT: {
19
+ (title: string, data: DataButton["options"]["data"], options?: Omit<DataButton["options"], "data">): DataButton;
20
+ group: (...rows: DataButtonRow[]) => DataButtonGroup;
21
+ row: (...buttons: DataButton[]) => DataButtonRow;
19
22
  };
20
- export { BT };
21
23
  export declare const Ark: {
22
24
  list: (values_0: DataArkListTip, values_1: DataArkListContent) => DataArkList;
23
25
  listTip: (options: DataArkListTip["value"]) => DataArkListTip;
@@ -26,9 +28,32 @@ export declare const Ark: {
26
28
  Card: (value: DataArkCard["value"]) => DataArkCard;
27
29
  BigCard: (value: DataArkBigCard["value"]) => DataArkBigCard;
28
30
  };
29
- declare const MD: {
31
+ declare const Markdown: {
32
+ (...values: DataMarkDown["value"]): DataMarkDown;
33
+ text(text: string): DataMarkdownText;
34
+ mention(uid?: string, options?: DataMarkdownMention["options"]): DataMarkdownMention;
35
+ button(title: string, data: DataMarkdownButton["options"]): DataMarkdownButton;
36
+ content(text: string): DataMarkdownContent;
37
+ title(text: string): DataMarkdownTitle;
38
+ subtitle(text: string): DataMarkdownSubtitle;
39
+ bold(text: string): DataMarkdownBold;
40
+ italic(text: string): DataMarkdownItalic;
41
+ italicStar(text: string): DataMarkdownItalicStar;
42
+ strikethrough(text: string): DataMarkdownStrikethrough;
43
+ link(text: string, url: string): DataMarkdownLink;
44
+ image(url: string, options?: {
45
+ width?: number;
46
+ height?: number;
47
+ }): DataMarkdownImage;
48
+ list(...items: any[]): DataMarkdownList;
49
+ listItem(indexOrText: number | string, text?: string): DataMarkdownListItem;
50
+ blockquote(text: string): DataMarkdownBlockquote;
51
+ divider(): DataMarkdownDivider;
52
+ newline(value?: boolean): DataMarkdownNewline;
53
+ code(value: DataMarkdownCode["value"], options?: DataMarkdownCode["options"]): DataMarkdownCode;
54
+ };
55
+ export declare const MD: {
30
56
  (...values: DataMarkDown["value"]): DataMarkDown;
31
- template(templateId: DataMarkdownTemplate["value"], params?: DataMarkdownTemplate["options"]["params"]): DataMarkdownTemplate;
32
57
  text(text: string): DataMarkdownText;
33
58
  mention(uid?: string, options?: DataMarkdownMention["options"]): DataMarkdownMention;
34
59
  button(title: string, data: DataMarkdownButton["options"]): DataMarkdownButton;
@@ -51,8 +76,8 @@ declare const MD: {
51
76
  newline(value?: boolean): DataMarkdownNewline;
52
77
  code(value: DataMarkdownCode["value"], options?: DataMarkdownCode["options"]): DataMarkdownCode;
53
78
  };
54
- export { MD };
55
- export declare const Markdown: (val: string) => DataMarkdownOriginal;
79
+ export { Markdown };
80
+ export declare const MarkdownOriginal: (val: string) => DataMarkdownOriginal;
56
81
  export declare const Attachment: (val: string, options?: DataAttachment["options"]) => DataAttachment;
57
82
  export declare const Audio: (val: string) => DataAudio;
58
83
  export declare const Video: (val: string) => DataVideo;
@@ -1,10 +1,3 @@
1
- const Custom = (value, options, type) => {
2
- return {
3
- type: type,
4
- value,
5
- options
6
- };
7
- };
8
1
  const Text = (val, options) => {
9
2
  return {
10
3
  type: 'Text',
@@ -48,7 +41,7 @@ const Mention = (UserId, options) => {
48
41
  }
49
42
  };
50
43
  };
51
- const BT = (title, data, options) => {
44
+ const Button = (title, data, options) => {
52
45
  return {
53
46
  type: 'Button',
54
47
  value: title,
@@ -58,24 +51,21 @@ const BT = (title, data, options) => {
58
51
  }
59
52
  };
60
53
  };
61
- BT.group = function Group(...rows) {
54
+ const ButtonGroup = (...rows) => {
62
55
  return {
63
56
  type: 'BT.group',
64
57
  value: rows
65
58
  };
66
59
  };
67
- BT.template = function Template(templateId) {
68
- return {
69
- type: 'ButtonTemplate',
70
- value: templateId
71
- };
72
- };
73
- BT.row = function Row(...buttons) {
60
+ const ButtonRow = (...buttons) => {
74
61
  return {
75
62
  type: 'BT.row',
76
63
  value: buttons
77
64
  };
78
65
  };
66
+ Button.group = ButtonGroup;
67
+ Button.row = ButtonRow;
68
+ const BT = Button;
79
69
  const Ark = {
80
70
  list: (...values) => {
81
71
  return {
@@ -114,135 +104,127 @@ const Ark = {
114
104
  };
115
105
  }
116
106
  };
117
- const MD = (...values) => {
107
+ const Markdown = (...values) => {
118
108
  return {
119
109
  type: 'Markdown',
120
110
  value: values
121
111
  };
122
112
  };
123
- MD.template = (templateId, params) => {
124
- return {
125
- type: 'MarkdownTemplate',
126
- value: templateId,
127
- options: {
128
- params
129
- }
130
- };
131
- };
132
- MD.text = (text) => {
113
+ Markdown.text = (text) => {
133
114
  return {
134
115
  type: 'MD.text',
135
116
  value: text
136
117
  };
137
118
  };
138
- MD.mention = (uid, options) => {
119
+ Markdown.mention = (uid, options) => {
139
120
  return {
140
121
  type: 'MD.mention',
141
- value: uid || '',
122
+ value: uid || 'everyone',
142
123
  options: options ?? {
143
- belong: 'all'
124
+ belong: 'user'
144
125
  }
145
126
  };
146
127
  };
147
- MD.button = (title, data) => {
128
+ Markdown.button = (title, data) => {
148
129
  return {
149
130
  type: 'MD.button',
150
131
  value: title,
151
132
  options: data
152
133
  };
153
134
  };
154
- MD.content = (text) => {
135
+ Markdown.content = (text) => {
155
136
  return {
156
137
  type: 'MD.content',
157
138
  value: text
158
139
  };
159
140
  };
160
- MD.title = (text) => {
141
+ Markdown.title = (text) => {
161
142
  return {
162
143
  type: 'MD.title',
163
144
  value: text
164
145
  };
165
146
  };
166
- MD.subtitle = (text) => {
147
+ Markdown.subtitle = (text) => {
167
148
  return {
168
149
  type: 'MD.subtitle',
169
150
  value: text
170
151
  };
171
152
  };
172
- MD.bold = (text) => {
153
+ Markdown.bold = (text) => {
173
154
  return {
174
155
  type: 'MD.bold',
175
156
  value: text
176
157
  };
177
158
  };
178
- MD.italic = (text) => {
159
+ Markdown.italic = (text) => {
179
160
  return {
180
161
  type: 'MD.italic',
181
162
  value: text
182
163
  };
183
164
  };
184
- MD.italicStar = (text) => {
165
+ Markdown.italicStar = (text) => {
185
166
  return {
186
167
  type: 'MD.italicStar',
187
168
  value: text
188
169
  };
189
170
  };
190
- MD.strikethrough = (text) => {
171
+ Markdown.strikethrough = (text) => {
191
172
  return {
192
173
  type: 'MD.strikethrough',
193
174
  value: text
194
175
  };
195
176
  };
196
- MD.link = (text, url) => {
177
+ Markdown.link = (text, url) => {
197
178
  return {
198
179
  type: 'MD.link',
199
180
  value: { text, url }
200
181
  };
201
182
  };
202
- MD.image = (url, options) => {
183
+ Markdown.image = (url, options) => {
203
184
  return {
204
185
  type: 'MD.image',
205
186
  value: url,
206
187
  options
207
188
  };
208
189
  };
209
- MD.list = (...items) => {
190
+ Markdown.list = (...items) => {
210
191
  return {
211
192
  type: 'MD.list',
212
193
  value: items
213
194
  };
214
195
  };
215
- MD.listItem = (indexOrText, text) => {
196
+ Markdown.listItem = (indexOrText, text) => {
216
197
  return {
217
198
  type: 'MD.listItem',
218
199
  value: typeof indexOrText === 'number' ? { index: indexOrText, text } : indexOrText
219
200
  };
220
201
  };
221
- MD.blockquote = (text) => {
202
+ Markdown.blockquote = (text) => {
222
203
  return {
223
204
  type: 'MD.blockquote',
224
205
  value: text
225
206
  };
226
207
  };
227
- MD.divider = () => {
208
+ Markdown.divider = () => {
228
209
  return {
229
210
  type: 'MD.divider'
230
211
  };
231
212
  };
232
- MD.newline = (value = false) => {
213
+ Markdown.newline = (value = false) => {
233
214
  return {
234
215
  type: 'MD.newline',
235
216
  value: value
236
217
  };
237
218
  };
238
- MD.code = (value, options) => {
219
+ Markdown.code = (value, options) => {
239
220
  return {
240
221
  type: 'MD.code',
241
222
  value: value,
242
223
  options: options
243
224
  };
244
225
  };
245
- const Markdown = (val) => {
226
+ const MD = Markdown;
227
+ const MarkdownOriginal = (val) => {
246
228
  return {
247
229
  type: 'MarkdownOriginal',
248
230
  value: val
@@ -268,4 +250,4 @@ const Video = (val) => {
268
250
  };
269
251
  };
270
252
 
271
- export { Ark, Attachment, Audio, BT, Custom, Image, ImageFile, ImageURL, Link, MD, Markdown, Mention, Text, Video };
253
+ export { Ark, Attachment, Audio, BT, Button, Image, ImageFile, ImageURL, Link, MD, Markdown, MarkdownOriginal, Mention, Text, Video };
@@ -1,5 +1,5 @@
1
1
  import { DataButtonGroup, DataMarkDown, DataEnums, EventKeys, Events } from '../types';
2
- import { Text, Link, Image, ImageFile, ImageURL, Mention, BT, MD, Markdown, Attachment, Audio, Video, Custom } from './message-format-old.js';
2
+ import { Text, Image, Link, ImageFile, ImageURL, Mention, BT, MD, MarkdownOriginal, Attachment, Audio, Video } from './message-format-old.js';
3
3
  export * from './message-format-old.js';
4
4
  export declare class FormatButtonGroup {
5
5
  #private;
@@ -47,11 +47,10 @@ export declare class Format {
47
47
  addButtonGroup(...args: Parameters<typeof BT.group>): this;
48
48
  addMarkdown(md: FormatMarkDown): this;
49
49
  addMarkdown(...args: Parameters<typeof MD>): this;
50
- addMarkdownOriginal(...args: Parameters<typeof Markdown>): this;
50
+ addMarkdownOriginal(...args: Parameters<typeof MarkdownOriginal>): this;
51
51
  addAttachment(...args: Parameters<typeof Attachment>): this;
52
52
  addAudio(...args: Parameters<typeof Audio>): this;
53
53
  addVideo(...args: Parameters<typeof Video>): this;
54
- addCustom(...args: Parameters<typeof Custom>): this;
55
54
  addLink(...args: Parameters<typeof Link>): this;
56
55
  addImageFile(...args: Parameters<typeof ImageFile>): this;
57
56
  addImageURL(...args: Parameters<typeof ImageURL>): this;
@@ -1,5 +1,5 @@
1
- import { BT, MD, Text, Image, Mention, Markdown, Attachment, Audio, Video, Custom, Link, ImageFile, ImageURL } from './message-format-old.js';
2
- export { Ark } from './message-format-old.js';
1
+ import { BT, MD, Text, Image, Mention, MarkdownOriginal, Attachment, Audio, Video, Link, ImageFile, ImageURL } from './message-format-old.js';
2
+ export { Ark, Button, Markdown } from './message-format-old.js';
3
3
 
4
4
  class FormatButtonGroup {
5
5
  #rows = [];
@@ -174,7 +174,7 @@ class Format {
174
174
  return this;
175
175
  }
176
176
  addMarkdownOriginal(...args) {
177
- this.#data.push(Markdown(...args));
177
+ this.#data.push(MarkdownOriginal(...args));
178
178
  return this;
179
179
  }
180
180
  addAttachment(...args) {
@@ -189,10 +189,6 @@ class Format {
189
189
  this.#data.push(Video(...args));
190
190
  return this;
191
191
  }
192
- addCustom(...args) {
193
- this.#data.push(Custom(...args));
194
- return this;
195
- }
196
192
  addLink(...args) {
197
193
  this.#data.push(Link(...args));
198
194
  return this;
@@ -235,4 +231,4 @@ function createEvent(options) {
235
231
  return { ...event, ...o };
236
232
  }
237
233
 
238
- export { Attachment, Audio, BT, Custom, Format, FormatButtonGroup, FormatMarkDown, Image, ImageFile, ImageURL, Link, MD, Markdown, Mention, Text, Video, createEvent };
234
+ export { Attachment, Audio, BT, Format, FormatButtonGroup, FormatMarkDown, Image, ImageFile, ImageURL, Link, MD, MarkdownOriginal, Mention, Text, Video, createEvent };
package/lib/index.js CHANGED
@@ -27,4 +27,4 @@ export { useObserver, useSubscribe } from './app/hook-use-subscribe.js';
27
27
  export { createDataFormat, createEventValue, format, getMessageIntent, sendToChannel, sendToUser } from './app/message-api.js';
28
28
  export { Format, FormatButtonGroup, FormatMarkDown, createEvent } from './app/message-format.js';
29
29
  export { start } from './main.js';
30
- export { Ark, Attachment, Audio, BT, Custom, Image, ImageFile, ImageURL, Link, MD, Markdown, Mention, Text, Video } from './app/message-format-old.js';
30
+ export { Ark, Attachment, Audio, BT, Button, Image, ImageFile, ImageURL, Link, MD, Markdown, MarkdownOriginal, Mention, Text, Video } from './app/message-format-old.js';
@@ -8,15 +8,11 @@ export type DataButton = {
8
8
  type?: 'command' | 'link' | 'call';
9
9
  };
10
10
  };
11
- export type ButtonRow = {
12
- type: 'BT.row';
11
+ export type DataButtonRow = {
12
+ type: 'ButtonRow' | 'BT.row';
13
13
  value: DataButton[];
14
14
  };
15
15
  export type DataButtonGroup = {
16
- type: 'BT.group';
17
- value: ButtonRow[];
18
- };
19
- export type DataButtonTemplate = {
20
- type: 'ButtonTemplate';
21
- value: string;
16
+ type: 'ButtonGroup' | 'BT.group';
17
+ value: DataButtonRow[];
22
18
  };
@@ -1,6 +1,6 @@
1
1
  import { DataButtonGroup, DataButtonTemplate } from './button';
2
2
  import { DataArkBigCard, DataArkCard, DataArkList } from './ark';
3
- import { DataMarkDown, DataMarkdownTemplate, DataCustom } from './markdown';
3
+ import { DataMarkDown, DataMarkdownTemplate } from './markdown';
4
4
  import { DataImage, DataImageFile, DataImageURL } from './image';
5
5
  import { DataText } from './text';
6
6
  import { DataMention } from './mention';
@@ -20,5 +20,5 @@ export * from './markdown-raw';
20
20
  export * from './attachment';
21
21
  export * from './audio';
22
22
  export * from './video';
23
- export type DataEnums = DataText | DataLink | DataImage | DataImageURL | DataImageFile | DataMention | DataButtonGroup | DataButtonTemplate | DataArkList | DataArkCard | DataArkBigCard | DataMarkDown | DataMarkdownTemplate | DataMarkdownOriginal | DataAttachment | DataAudio | DataVideo | DataCustom;
23
+ export type DataEnums = DataText | DataLink | DataImage | DataImageURL | DataImageFile | DataMention | DataButtonGroup | DataButtonTemplate | DataArkList | DataArkCard | DataArkBigCard | DataMarkDown | DataMarkdownTemplate | DataMarkdownOriginal | DataAttachment | DataAudio | DataVideo;
24
24
  export type MessageDataFormat = DataEnums[];
@@ -1,21 +1,12 @@
1
- export type DataMarkdownTemplate = {
2
- type: 'MarkdownTemplate';
3
- value: string;
4
- options: {
5
- params: {
6
- [key: string]: string;
7
- };
8
- };
9
- };
10
1
  export type DataMarkdownText = {
11
2
  type: 'MD.text';
12
3
  value: string;
13
4
  };
14
5
  export type DataMarkdownMention = {
15
6
  type: 'MD.mention';
16
- value?: string;
7
+ value?: string | 'everyone';
17
8
  options?: {
18
- belong?: 'user' | 'channel' | 'all';
9
+ belong?: 'user' | 'channel';
19
10
  };
20
11
  };
21
12
  export type DataMarkdownContent = {
@@ -100,14 +91,7 @@ export type DataMarkdownCode = {
100
91
  language?: string;
101
92
  };
102
93
  };
103
- export type DataCustom = {
104
- type: string;
105
- value: string;
106
- options?: {
107
- [key: string]: any;
108
- };
109
- };
110
- type DataMarkDownBalue = DataMarkdownMention | DataMarkdownContent | DataMarkdownButton | DataMarkdownText | DataMarkdownTitle | DataMarkdownSubtitle | DataMarkdownBold | DataMarkdownItalic | DataMarkdownItalicStar | DataMarkdownStrikethrough | DataMarkdownLink | DataMarkdownImage | DataMarkdownList | DataMarkdownBlockquote | DataMarkdownDivider | DataMarkdownNewline | DataMarkdownCode | DataCustom;
94
+ type DataMarkDownBalue = DataMarkdownMention | DataMarkdownContent | DataMarkdownButton | DataMarkdownText | DataMarkdownTitle | DataMarkdownSubtitle | DataMarkdownBold | DataMarkdownItalic | DataMarkdownItalicStar | DataMarkdownStrikethrough | DataMarkdownLink | DataMarkdownImage | DataMarkdownList | DataMarkdownBlockquote | DataMarkdownDivider | DataMarkdownNewline | DataMarkdownCode;
111
95
  export type DataMarkDown = {
112
96
  type: 'Markdown';
113
97
  value: DataMarkDownBalue[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alemonjs",
3
- "version": "2.1.27",
3
+ "version": "2.1.29",
4
4
  "description": "bot script",
5
5
  "author": "lemonade",
6
6
  "license": "MIT",