alemonjs 2.1.25 → 2.1.26

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.
@@ -17,7 +17,7 @@ export declare const useMention: <T extends EventKeys>(event: Events[T]) => [{
17
17
  }>;
18
18
  }];
19
19
  export declare const useMessage: <T extends EventKeys>(event: Events[T]) => readonly [{
20
- "__#10@#format": DataEnums[];
20
+ "__#11@#format": DataEnums[];
21
21
  readonly currentFormat: DataEnums[];
22
22
  addText(val: string, options?: {
23
23
  style?: "none" | "bold" | "block" | "strikethrough" | "boldItalic" | "italic";
@@ -11,7 +11,6 @@ declare class FormatButtonGroup {
11
11
  declare class FormatMarkDown {
12
12
  #private;
13
13
  get value(): DataMarkDown;
14
- addMention(...args: Parameters<typeof MD.button>): this;
15
14
  addContent(...args: Parameters<typeof MD.content>): this;
16
15
  addText(...args: Parameters<typeof MD.text>): this;
17
16
  addTitle(...args: Parameters<typeof MD.title>): this;
@@ -28,6 +27,8 @@ declare class FormatMarkDown {
28
27
  addNewline(...args: Parameters<typeof MD.newline>): this;
29
28
  addCode(...args: Parameters<typeof MD.code>): this;
30
29
  addBreak(): this;
30
+ addMention(...args: Parameters<typeof MD.mention>): this;
31
+ addButton(...args: Parameters<typeof MD.button>): this;
31
32
  clear(): this;
32
33
  }
33
34
  export declare class Format {
@@ -37,10 +37,6 @@ class FormatMarkDown {
37
37
  get value() {
38
38
  return MD(...this.#data);
39
39
  }
40
- addMention(...args) {
41
- this.#data.push(MD.button(...args));
42
- return this;
43
- }
44
40
  addContent(...args) {
45
41
  this.#data.push(MD.content(...args));
46
42
  return this;
@@ -105,6 +101,14 @@ class FormatMarkDown {
105
101
  this.#data.push(MD.newline());
106
102
  return this;
107
103
  }
104
+ addMention(...args) {
105
+ this.#data.push(MD.mention(...args));
106
+ return this;
107
+ }
108
+ addButton(...args) {
109
+ this.#data.push(MD.button(...args));
110
+ return this;
111
+ }
108
112
  clear() {
109
113
  this.#data = [];
110
114
  return this;
@@ -28,3 +28,21 @@ export declare const ResultCode: {
28
28
  readonly FailInternal: 5000;
29
29
  };
30
30
  export type ResultCode = (typeof ResultCode)[keyof typeof ResultCode];
31
+ export declare class Result {
32
+ #private;
33
+ get value(): {
34
+ code: ResultCode;
35
+ message: string;
36
+ data: null;
37
+ }[];
38
+ static create(): Result;
39
+ push(param: {
40
+ code: ResultCode;
41
+ message: string;
42
+ data: null;
43
+ }): this;
44
+ newIndex(): this;
45
+ updateMessage(msg: string): this;
46
+ updateData(data: any): this;
47
+ updateCode(callback: (code: typeof ResultCode) => ResultCode): this;
48
+ }
@@ -26,5 +26,63 @@ const ResultCode = {
26
26
  FailAuth,
27
27
  FailInternal
28
28
  };
29
+ class Result {
30
+ #data = [];
31
+ #currentIndex = 0;
32
+ get value() {
33
+ return this.#data;
34
+ }
35
+ static create() {
36
+ return new Result();
37
+ }
38
+ push(param) {
39
+ this.#data.push(param);
40
+ return this;
41
+ }
42
+ newIndex() {
43
+ if (this.#data[this.#currentIndex]) {
44
+ this.#currentIndex++;
45
+ }
46
+ else {
47
+ this.#currentIndex = 0;
48
+ }
49
+ return this;
50
+ }
51
+ updateMessage(msg) {
52
+ if (!this.#data[this.#currentIndex]) {
53
+ this.#data[this.#currentIndex] = {
54
+ code: ResultCode.Ok,
55
+ message: msg,
56
+ data: null
57
+ };
58
+ }
59
+ this.#data[this.#currentIndex].message = msg;
60
+ return this;
61
+ }
62
+ updateData(data) {
63
+ if (!this.#data[this.#currentIndex]) {
64
+ this.#data[this.#currentIndex] = {
65
+ code: ResultCode.Ok,
66
+ message: '',
67
+ data: data
68
+ };
69
+ }
70
+ return this;
71
+ }
72
+ updateCode(callback) {
73
+ const newCode = callback(ResultCode);
74
+ if (!this.#data[this.#currentIndex]) {
75
+ this.#data[this.#currentIndex] = {
76
+ code: newCode,
77
+ message: '',
78
+ data: null
79
+ };
80
+ }
81
+ else {
82
+ this.#data[this.#currentIndex].code = newCode;
83
+ }
84
+ return this;
85
+ }
86
+ }
29
87
 
30
- export { EventMessageText, Fail, FailAuth, FailInternal, FailParams, Ok, ResultCode, Warn, defaultLogin, defaultPlatformCommonPrefix, defaultPlatformPrefix, defaultPort, filePrefixCommon, fileSuffixMiddleware, fileSuffixResponse, processorMaxMapSize, processorRepeatedClearSize, processorRepeatedClearTimeMax, processorRepeatedClearTimeMin, processorRepeatedEventTime, processorRepeatedUserTime };
88
+ export { EventMessageText, Fail, FailAuth, FailInternal, FailParams, Ok, Result, ResultCode, Warn, defaultLogin, defaultPlatformCommonPrefix, defaultPlatformPrefix, defaultPort, filePrefixCommon, fileSuffixMiddleware, fileSuffixResponse, processorMaxMapSize, processorRepeatedClearSize, processorRepeatedClearTimeMax, processorRepeatedClearTimeMin, processorRepeatedEventTime, processorRepeatedUserTime };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alemonjs",
3
- "version": "2.1.25",
3
+ "version": "2.1.26",
4
4
  "description": "bot script",
5
5
  "author": "lemonade",
6
6
  "license": "MIT",