alemonjs 1.3.0 → 1.3.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.
@@ -1,5 +1,4 @@
1
1
  {
2
- "display": "alemonjs",
3
2
  "compilerOptions": {
4
3
  "target": "ESNext",
5
4
  "module": "ESNext",
package/dist/index.js CHANGED
@@ -8713,6 +8713,29 @@ let Controllers$2 = class Controllers extends BaseConfig$1 {
8713
8713
  if (!this.feasibility)
8714
8714
  return false;
8715
8715
  return false;
8716
+ },
8717
+ markdown: async (markdown, ...arg) => {
8718
+ const guild_id = this.get('guild_id');
8719
+ const msg_id = this.get('msg_id');
8720
+ const attribute = this.get('attribute');
8721
+ const open_id = this.get('open_id');
8722
+ const data = {
8723
+ msg_id,
8724
+ msg_seq: ClientNTQQ.getMsgSeq(msg_id),
8725
+ msg_type: 2,
8726
+ markdown
8727
+ };
8728
+ if (arg && arg.length > 0) {
8729
+ if (typeof arg[0] === 'string') {
8730
+ data.keyboard = { id: arg[0] };
8731
+ }
8732
+ else {
8733
+ data.keyboard = getKeyboardData(arg);
8734
+ }
8735
+ }
8736
+ return attribute == 'single'
8737
+ ? await ClientNTQQ.usersOpenMessages(open_id, data)
8738
+ : await ClientNTQQ.groupOpenMessages(guild_id, data);
8716
8739
  }
8717
8740
  };
8718
8741
  };
@@ -1,4 +1,5 @@
1
1
  import { BaseConfig, MessageButtonType, MessageContentType, type ControllerOption, type UserInformationType } from '../../../core/index.js';
2
+ import { MarkdownType } from '../sdk/index.js';
2
3
  export declare class Controllers extends BaseConfig<ControllerOption> {
3
4
  constructor(select?: ControllerOption);
4
5
  get feasibility(): boolean;
@@ -40,5 +41,9 @@ export declare class Controllers extends BaseConfig<ControllerOption> {
40
41
  limit: number;
41
42
  }) => Promise<boolean>;
42
43
  article: (msg: any) => Promise<boolean>;
44
+ markdown: (markdown: MarkdownType, ...arg: ([string] | MessageButtonType[]) & MessageButtonType[][]) => Promise<{
45
+ id: string;
46
+ timestamp: number;
47
+ }>;
43
48
  };
44
49
  }
@@ -18,13 +18,37 @@ interface ButtonType {
18
18
  data: string;
19
19
  };
20
20
  }
21
- interface KeyboardType {
22
- content: {
21
+ export interface KeyboardType {
22
+ id?: string;
23
+ content?: {
23
24
  rows: {
24
25
  buttons: ButtonType[];
25
26
  }[];
26
27
  };
27
28
  }
29
+ export interface MarkdownType {
30
+ custom_template_id: string;
31
+ content?: string;
32
+ params?: Array<{
33
+ key: string;
34
+ values: string[];
35
+ }>;
36
+ }
37
+ export interface ApiRequestData {
38
+ content?: string;
39
+ msg_type: MsgType;
40
+ markdown?: MarkdownType;
41
+ keyboard?: KeyboardType;
42
+ media?: {
43
+ file_info: string;
44
+ };
45
+ ark?: any;
46
+ image?: any;
47
+ message_reference?: any;
48
+ event_id?: any;
49
+ msg_id?: string;
50
+ msg_seq?: number;
51
+ }
28
52
  declare class ClientNtqq {
29
53
  #private;
30
54
  BOTS_API_RUL: string;
@@ -33,40 +57,12 @@ declare class ClientNtqq {
33
57
  getAuthentication(appId: string, clientSecret: string): Promise<import("axios").AxiosResponse<any, any>>;
34
58
  GroupService(options: AxiosRequestConfig): Promise<import("axios").AxiosResponse<any, any>>;
35
59
  gateway(): Promise<any>;
36
- usersOpenMessages(openid: string, data: {
37
- content?: string;
38
- msg_type: MsgType;
39
- markdown?: any;
40
- keyboard?: KeyboardType;
41
- media?: {
42
- file_info: string;
43
- };
44
- ark?: any;
45
- image?: any;
46
- message_reference?: any;
47
- event_id?: any;
48
- msg_id?: string;
49
- msg_seq?: number;
50
- }, msg_id?: string): Promise<{
60
+ usersOpenMessages(openid: string, data: ApiRequestData, msg_id?: string): Promise<{
51
61
  id: string;
52
62
  timestamp: number;
53
63
  }>;
54
64
  getMsgSeq(MsgId: string): number;
55
- groupOpenMessages(group_openid: string, data: {
56
- content?: string;
57
- msg_type: MsgType;
58
- markdown?: any;
59
- keyboard?: KeyboardType;
60
- media?: {
61
- file_info: string;
62
- };
63
- ark?: any;
64
- image?: any;
65
- message_reference?: any;
66
- event_id?: any;
67
- msg_id?: string;
68
- msg_seq?: number;
69
- }): Promise<{
65
+ groupOpenMessages(group_openid: string, data: ApiRequestData): Promise<{
70
66
  id: string;
71
67
  timestamp: number;
72
68
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alemonjs",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "啊柠檬脚本",
5
5
  "author": "ningmengchongshui",
6
6
  "license": "MIT",
@@ -73,13 +73,13 @@
73
73
  "import": "./dist/index.js",
74
74
  "types": "./dist/index.d.ts"
75
75
  },
76
- "./.puppeteerrc.cjs": {
76
+ "./.puppeteerrc": {
77
77
  "require": "./.puppeteerrc.cjs"
78
78
  },
79
79
  "./env": {
80
80
  "types": "./env.d.ts"
81
81
  },
82
- "./tsconfig.json": {
82
+ "./config/tsconfig.json": {
83
83
  "import": "./config/tsconfig.json",
84
84
  "require": "./config/tsconfig.json"
85
85
  }