mirai-js 2.1.0 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. package/.eslintrc.json +45 -45
  2. package/.github/FUNDING.yml +12 -12
  3. package/.github/dependabot.yml +14 -14
  4. package/.github/workflows/codeql-analysis.yml +70 -0
  5. package/.husky/pre-commit +5 -5
  6. package/LICENSE +661 -661
  7. package/README.md +17 -283
  8. package/demo.html +1 -1
  9. package/demo.js +14 -92
  10. package/dist/browser/mirai-js.js +1 -1
  11. package/dist/node/BaseType.d.ts +3 -0
  12. package/dist/node/Bot.d.ts +95 -8
  13. package/dist/node/Bot.js +241 -18
  14. package/dist/node/FileManager.js +15 -6
  15. package/dist/node/Middleware.js +90 -16
  16. package/dist/node/core/anno/deleteAnno.js +67 -0
  17. package/dist/node/core/anno/getAnno.js +70 -0
  18. package/dist/node/core/anno/publishAnno.js +70 -0
  19. package/dist/node/core/auth.js +9 -11
  20. package/dist/node/core/fs/deleteGroupFile.js +71 -0
  21. package/dist/node/core/fs/getGroupFileInfo.js +77 -0
  22. package/dist/node/core/fs/getGroupFileList.js +82 -0
  23. package/dist/node/core/fs/makeGroupDir.js +73 -0
  24. package/dist/node/core/fs/moveGroupFile.js +77 -0
  25. package/dist/node/core/fs/renameGroupFile.js +73 -0
  26. package/dist/node/core/fs/uploadGroupFIle.js +81 -0
  27. package/dist/node/core/getFriendList.js +9 -11
  28. package/dist/node/core/getGroupConfig.js +9 -11
  29. package/dist/node/core/getGroupFileInfo.js +6 -2
  30. package/dist/node/core/getGroupFileList.js +6 -2
  31. package/dist/node/core/getGroupList.js +9 -11
  32. package/dist/node/core/getMemberInfo.js +13 -19
  33. package/dist/node/core/getMemberList.js +9 -11
  34. package/dist/node/core/getSessionConfig.js +9 -11
  35. package/dist/node/core/getUserProfile.js +78 -0
  36. package/dist/node/core/groupFileDelete.js +6 -2
  37. package/dist/node/core/groupFileMove.js +6 -2
  38. package/dist/node/core/groupFileRename.js +6 -2
  39. package/dist/node/core/mute.js +9 -11
  40. package/dist/node/core/muteAll.js +9 -11
  41. package/dist/node/core/quitGroup.js +9 -11
  42. package/dist/node/core/recall.js +9 -11
  43. package/dist/node/core/releaseSession.js +10 -11
  44. package/dist/node/core/removeFriend.js +64 -0
  45. package/dist/node/core/removeMember.js +9 -11
  46. package/dist/node/core/responseBotInvitedJoinGroupRequest.js +9 -11
  47. package/dist/node/core/responseFirendRequest.js +9 -11
  48. package/dist/node/core/responseMemberJoinRequest.js +9 -11
  49. package/dist/node/core/sendCommand.js +9 -11
  50. package/dist/node/core/sendFirendMessage.js +9 -11
  51. package/dist/node/core/sendGroupMessage.js +9 -11
  52. package/dist/node/core/sendNudge.js +9 -11
  53. package/dist/node/core/sendTempMessage.js +9 -11
  54. package/dist/node/core/setEssence.js +9 -11
  55. package/dist/node/core/setGroupConfig.js +9 -11
  56. package/dist/node/core/setMemberAdmin.js +70 -0
  57. package/dist/node/core/setMemberInfo.js +9 -11
  58. package/dist/node/core/setSessionConfig.js +9 -11
  59. package/dist/node/core/startListeningBrowser.js +8 -9
  60. package/dist/node/core/startListeningNode.js +8 -10
  61. package/dist/node/core/stopListeningBrowser.js +5 -1
  62. package/dist/node/core/stopListeningNode.js +5 -1
  63. package/dist/node/core/unmute.js +9 -11
  64. package/dist/node/core/unmuteAll.js +9 -11
  65. package/dist/node/core/uploadFileAndSend.js +6 -1
  66. package/dist/node/core/uploadImage.js +9 -10
  67. package/dist/node/core/uploadVoice.js +9 -10
  68. package/dist/node/core/verify.js +9 -11
  69. package/dist/node/polyfill/URL.js +5 -0
  70. package/dist/node/polyfill/wsListener.js +6 -0
  71. package/docs/checkDocShouldBuild.sh +4 -4
  72. package/package.json +51 -51
  73. package/src/BaseType.d.ts +3 -0
  74. package/src/Bot.d.ts +95 -8
  75. package/src/Bot.js +154 -9
  76. package/src/FileManager.js +10 -6
  77. package/src/Middleware.js +51 -3
  78. package/src/core/anno/deleteAnno.js +42 -0
  79. package/src/core/anno/getAnno.js +43 -0
  80. package/src/core/anno/publishAnno.js +43 -0
  81. package/src/core/auth.js +5 -7
  82. package/src/core/fs/deleteGroupFile.js +44 -0
  83. package/src/core/fs/getGroupFileInfo.js +45 -0
  84. package/src/core/fs/getGroupFileList.js +46 -0
  85. package/src/core/fs/makeGroupDir.js +44 -0
  86. package/src/core/fs/moveGroupFile.js +46 -0
  87. package/src/core/{groupFileRename.js → fs/renameGroupFile.js} +11 -13
  88. package/src/core/{uploadFileAndSend.js → fs/uploadGroupFIle.js} +9 -11
  89. package/src/core/getFriendList.js +5 -7
  90. package/src/core/getGroupConfig.js +5 -7
  91. package/src/core/getGroupList.js +5 -7
  92. package/src/core/getMemberInfo.js +8 -10
  93. package/src/core/getMemberList.js +5 -7
  94. package/src/core/getSessionConfig.js +5 -7
  95. package/src/core/getUserProfile.js +39 -0
  96. package/src/core/mute.js +5 -7
  97. package/src/core/muteAll.js +5 -7
  98. package/src/core/quitGroup.js +5 -7
  99. package/src/core/recall.js +5 -7
  100. package/src/core/releaseSession.js +6 -7
  101. package/src/core/{groupFileDelete.js → removeFriend.js} +11 -17
  102. package/src/core/removeMember.js +5 -7
  103. package/src/core/responseBotInvitedJoinGroupRequest.js +5 -7
  104. package/src/core/responseFirendRequest.js +5 -7
  105. package/src/core/responseMemberJoinRequest.js +5 -7
  106. package/src/core/sendCommand.js +5 -7
  107. package/src/core/sendFirendMessage.js +5 -7
  108. package/src/core/sendGroupMessage.js +5 -7
  109. package/src/core/sendNudge.js +5 -7
  110. package/src/core/sendTempMessage.js +5 -7
  111. package/src/core/setEssence.js +5 -7
  112. package/src/core/setGroupConfig.js +5 -7
  113. package/src/core/setMemberAdmin.js +43 -0
  114. package/src/core/setMemberInfo.js +5 -7
  115. package/src/core/setSessionConfig.js +5 -7
  116. package/src/core/startListeningBrowser.js +4 -6
  117. package/src/core/startListeningNode.js +4 -6
  118. package/src/core/stopListeningBrowser.js +3 -0
  119. package/src/core/stopListeningNode.js +3 -0
  120. package/src/core/unmute.js +5 -7
  121. package/src/core/unmuteAll.js +5 -7
  122. package/src/core/uploadImage.js +5 -7
  123. package/src/core/uploadVoice.js +5 -7
  124. package/src/core/verify.js +5 -7
  125. package/src/polyfill/URL.js +3 -0
  126. package/src/polyfill/wsListener.js +4 -0
  127. package/webpack.config.js +4 -0
  128. package/src/core/getGroupFileInfo.js +0 -44
  129. package/src/core/getGroupFileList.js +0 -40
  130. package/src/core/groupFileMove.js +0 -46
package/.eslintrc.json CHANGED
@@ -1,46 +1,46 @@
1
- {
2
- "env": {
3
- "browser": true,
4
- "node": true,
5
- "commonjs": true,
6
- "es2021": true
7
- },
8
- "extends": [
9
- "eslint:recommended"
10
- ],
11
- "overrides": [
12
- {
13
- "files": [
14
- "*.ts"
15
- ],
16
- "parser": "@typescript-eslint/parser",
17
- "parserOptions": {
18
- "ecmaVersion": 12
19
- },
20
- "plugins": [
21
- "@typescript-eslint"
22
- ],
23
- "extends": [
24
- "plugin:@typescript-eslint/recommended"
25
- ]
26
- }
27
- ],
28
- "rules": {
29
- "indent": [
30
- "error",
31
- 4
32
- ],
33
- "linebreak-style": [
34
- "error",
35
- "windows"
36
- ],
37
- "quotes": [
38
- "error",
39
- "single"
40
- ],
41
- "semi": [
42
- "error",
43
- "always"
44
- ]
45
- }
1
+ {
2
+ "env": {
3
+ "browser": true,
4
+ "node": true,
5
+ "commonjs": true,
6
+ "es2021": true
7
+ },
8
+ "extends": [
9
+ "eslint:recommended"
10
+ ],
11
+ "overrides": [
12
+ {
13
+ "files": [
14
+ "*.ts"
15
+ ],
16
+ "parser": "@typescript-eslint/parser",
17
+ "parserOptions": {
18
+ "ecmaVersion": 12
19
+ },
20
+ "plugins": [
21
+ "@typescript-eslint"
22
+ ],
23
+ "extends": [
24
+ "plugin:@typescript-eslint/recommended"
25
+ ]
26
+ }
27
+ ],
28
+ "rules": {
29
+ "indent": [
30
+ "error",
31
+ 4
32
+ ],
33
+ "linebreak-style": [
34
+ "error",
35
+ "windows"
36
+ ],
37
+ "quotes": [
38
+ "error",
39
+ "single"
40
+ ],
41
+ "semi": [
42
+ "error",
43
+ "always"
44
+ ]
45
+ }
46
46
  }
@@ -1,12 +1,12 @@
1
- # These are supported funding model platforms
2
-
3
- github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4
- patreon: # Replace with a single Patreon username
5
- open_collective: # Replace with a single Open Collective username
6
- ko_fi: # Replace with a single Ko-fi username
7
- tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8
- community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
- liberapay: # Replace with a single Liberapay username
10
- issuehunt: # Replace with a single IssueHunt username
11
- otechie: # Replace with a single Otechie username
12
- custom: ['http://gaolihai.cool/']
1
+ # These are supported funding model platforms
2
+
3
+ github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4
+ patreon: # Replace with a single Patreon username
5
+ open_collective: # Replace with a single Open Collective username
6
+ ko_fi: # Replace with a single Ko-fi username
7
+ tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8
+ community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
+ liberapay: # Replace with a single Liberapay username
10
+ issuehunt: # Replace with a single IssueHunt username
11
+ otechie: # Replace with a single Otechie username
12
+ custom: ['http://codingfor.life/']
@@ -1,14 +1,14 @@
1
- # To get started with Dependabot version updates, you'll need to specify which
2
- # package ecosystems to update and where the package manifests are located.
3
- # Please see the documentation for all configuration options:
4
- # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
-
6
- version: 2
7
- updates:
8
- - package-ecosystem: "npm"
9
- directory: "/"
10
- schedule:
11
- interval: "daily"
12
- allow:
13
- - dependency-name: "*"
14
-
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
+
6
+ version: 2
7
+ updates:
8
+ - package-ecosystem: "npm"
9
+ directory: "/"
10
+ schedule:
11
+ interval: "monthly"
12
+ allow:
13
+ - dependency-name: "*"
14
+
@@ -0,0 +1,70 @@
1
+ # For most projects, this workflow file will not need changing; you simply need
2
+ # to commit it to your repository.
3
+ #
4
+ # You may wish to alter this file to override the set of languages analyzed,
5
+ # or to provide custom queries or build logic.
6
+ #
7
+ # ******** NOTE ********
8
+ # We have attempted to detect the languages in your repository. Please check
9
+ # the `language` matrix defined below to confirm you have the correct set of
10
+ # supported CodeQL languages.
11
+ #
12
+ name: "CodeQL"
13
+
14
+ on:
15
+ push:
16
+ branches: [ master ]
17
+ pull_request:
18
+ # The branches below must be a subset of the branches above
19
+ branches: [ master ]
20
+ schedule:
21
+ - cron: '32 11 * * 4'
22
+
23
+ jobs:
24
+ analyze:
25
+ name: Analyze
26
+ runs-on: ubuntu-latest
27
+ permissions:
28
+ actions: read
29
+ contents: read
30
+ security-events: write
31
+
32
+ strategy:
33
+ fail-fast: false
34
+ matrix:
35
+ language: [ 'javascript' ]
36
+ # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37
+ # Learn more about CodeQL language support at https://git.io/codeql-language-support
38
+
39
+ steps:
40
+ - name: Checkout repository
41
+ uses: actions/checkout@v2
42
+
43
+ # Initializes the CodeQL tools for scanning.
44
+ - name: Initialize CodeQL
45
+ uses: github/codeql-action/init@v1
46
+ with:
47
+ languages: ${{ matrix.language }}
48
+ # If you wish to specify custom queries, you can do so here or in a config file.
49
+ # By default, queries listed here will override any specified in a config file.
50
+ # Prefix the list here with "+" to use these queries and those in the config file.
51
+ # queries: ./path/to/local/query, your-org/your-repo/queries@main
52
+
53
+ # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
54
+ # If this step fails, then you should remove it and run the build manually (see below)
55
+ - name: Autobuild
56
+ uses: github/codeql-action/autobuild@v1
57
+
58
+ # ℹ️ Command-line programs to run using the OS shell.
59
+ # 📚 https://git.io/JvXDl
60
+
61
+ # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
62
+ # and modify them (or add more) to build your code if your project
63
+ # uses a compiled language
64
+
65
+ #- run: |
66
+ # make bootstrap
67
+ # make release
68
+
69
+ - name: Perform CodeQL Analysis
70
+ uses: github/codeql-action/analyze@v1
package/.husky/pre-commit CHANGED
@@ -1,6 +1,6 @@
1
- #!/bin/sh
2
- . "$(dirname "$0")/_/husky.sh"
3
-
4
- npx lint-staged
5
- npm run build
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ npx lint-staged
5
+ npm run build
6
6
  git add dist