mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
Compare commits
16 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
6f6b258f22 | ||
![]() |
717b246cb6 | ||
![]() |
827df80ec8 | ||
![]() |
7117fae2b2 | ||
![]() |
15e9462140 | ||
![]() |
9203fa3df2 | ||
![]() |
c771d75a00 | ||
![]() |
7b10d75aeb | ||
![]() |
b46459de5f | ||
![]() |
ac7f025223 | ||
![]() |
05b77b5042 | ||
![]() |
d6cfe11d97 | ||
![]() |
dd4d59e4e7 | ||
![]() |
7cb8626e16 | ||
![]() |
89b5202adb | ||
![]() |
40ae0c1449 |
397
LICENSE
397
LICENSE
@@ -1,373 +1,24 @@
|
|||||||
Mozilla Public License Version 2.0
|
BSD 2-Clause License
|
||||||
==================================
|
|
||||||
|
Copyright (c) 2024, NapNeko
|
||||||
1. Definitions
|
|
||||||
--------------
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
1.1. "Contributor"
|
|
||||||
means each individual or legal entity that creates, contributes to
|
1. Redistributions of source code must retain the above copyright notice, this
|
||||||
the creation of, or owns Covered Software.
|
list of conditions and the following disclaimer.
|
||||||
|
|
||||||
1.2. "Contributor Version"
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
means the combination of the Contributions of others (if any) used
|
this list of conditions and the following disclaimer in the documentation
|
||||||
by a Contributor and that particular Contributor's Contribution.
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
1.3. "Contribution"
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
means Covered Software of a particular Contributor.
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
1.4. "Covered Software"
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
means Source Code Form to which the initial Contributor has attached
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
the notice in Exhibit A, the Executable Form of such Source Code
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
Form, and Modifications of such Source Code Form, in each case
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
including portions thereof.
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
1.5. "Incompatible With Secondary Licenses"
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
means
|
|
||||||
|
|
||||||
(a) that the initial Contributor has attached the notice described
|
|
||||||
in Exhibit B to the Covered Software; or
|
|
||||||
|
|
||||||
(b) that the Covered Software was made available under the terms of
|
|
||||||
version 1.1 or earlier of the License, but not also under the
|
|
||||||
terms of a Secondary License.
|
|
||||||
|
|
||||||
1.6. "Executable Form"
|
|
||||||
means any form of the work other than Source Code Form.
|
|
||||||
|
|
||||||
1.7. "Larger Work"
|
|
||||||
means a work that combines Covered Software with other material, in
|
|
||||||
a separate file or files, that is not Covered Software.
|
|
||||||
|
|
||||||
1.8. "License"
|
|
||||||
means this document.
|
|
||||||
|
|
||||||
1.9. "Licensable"
|
|
||||||
means having the right to grant, to the maximum extent possible,
|
|
||||||
whether at the time of the initial grant or subsequently, any and
|
|
||||||
all of the rights conveyed by this License.
|
|
||||||
|
|
||||||
1.10. "Modifications"
|
|
||||||
means any of the following:
|
|
||||||
|
|
||||||
(a) any file in Source Code Form that results from an addition to,
|
|
||||||
deletion from, or modification of the contents of Covered
|
|
||||||
Software; or
|
|
||||||
|
|
||||||
(b) any new file in Source Code Form that contains any Covered
|
|
||||||
Software.
|
|
||||||
|
|
||||||
1.11. "Patent Claims" of a Contributor
|
|
||||||
means any patent claim(s), including without limitation, method,
|
|
||||||
process, and apparatus claims, in any patent Licensable by such
|
|
||||||
Contributor that would be infringed, but for the grant of the
|
|
||||||
License, by the making, using, selling, offering for sale, having
|
|
||||||
made, import, or transfer of either its Contributions or its
|
|
||||||
Contributor Version.
|
|
||||||
|
|
||||||
1.12. "Secondary License"
|
|
||||||
means either the GNU General Public License, Version 2.0, the GNU
|
|
||||||
Lesser General Public License, Version 2.1, the GNU Affero General
|
|
||||||
Public License, Version 3.0, or any later versions of those
|
|
||||||
licenses.
|
|
||||||
|
|
||||||
1.13. "Source Code Form"
|
|
||||||
means the form of the work preferred for making modifications.
|
|
||||||
|
|
||||||
1.14. "You" (or "Your")
|
|
||||||
means an individual or a legal entity exercising rights under this
|
|
||||||
License. For legal entities, "You" includes any entity that
|
|
||||||
controls, is controlled by, or is under common control with You. For
|
|
||||||
purposes of this definition, "control" means (a) the power, direct
|
|
||||||
or indirect, to cause the direction or management of such entity,
|
|
||||||
whether by contract or otherwise, or (b) ownership of more than
|
|
||||||
fifty percent (50%) of the outstanding shares or beneficial
|
|
||||||
ownership of such entity.
|
|
||||||
|
|
||||||
2. License Grants and Conditions
|
|
||||||
--------------------------------
|
|
||||||
|
|
||||||
2.1. Grants
|
|
||||||
|
|
||||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
|
||||||
non-exclusive license:
|
|
||||||
|
|
||||||
(a) under intellectual property rights (other than patent or trademark)
|
|
||||||
Licensable by such Contributor to use, reproduce, make available,
|
|
||||||
modify, display, perform, distribute, and otherwise exploit its
|
|
||||||
Contributions, either on an unmodified basis, with Modifications, or
|
|
||||||
as part of a Larger Work; and
|
|
||||||
|
|
||||||
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
|
||||||
for sale, have made, import, and otherwise transfer either its
|
|
||||||
Contributions or its Contributor Version.
|
|
||||||
|
|
||||||
2.2. Effective Date
|
|
||||||
|
|
||||||
The licenses granted in Section 2.1 with respect to any Contribution
|
|
||||||
become effective for each Contribution on the date the Contributor first
|
|
||||||
distributes such Contribution.
|
|
||||||
|
|
||||||
2.3. Limitations on Grant Scope
|
|
||||||
|
|
||||||
The licenses granted in this Section 2 are the only rights granted under
|
|
||||||
this License. No additional rights or licenses will be implied from the
|
|
||||||
distribution or licensing of Covered Software under this License.
|
|
||||||
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
|
||||||
Contributor:
|
|
||||||
|
|
||||||
(a) for any code that a Contributor has removed from Covered Software;
|
|
||||||
or
|
|
||||||
|
|
||||||
(b) for infringements caused by: (i) Your and any other third party's
|
|
||||||
modifications of Covered Software, or (ii) the combination of its
|
|
||||||
Contributions with other software (except as part of its Contributor
|
|
||||||
Version); or
|
|
||||||
|
|
||||||
(c) under Patent Claims infringed by Covered Software in the absence of
|
|
||||||
its Contributions.
|
|
||||||
|
|
||||||
This License does not grant any rights in the trademarks, service marks,
|
|
||||||
or logos of any Contributor (except as may be necessary to comply with
|
|
||||||
the notice requirements in Section 3.4).
|
|
||||||
|
|
||||||
2.4. Subsequent Licenses
|
|
||||||
|
|
||||||
No Contributor makes additional grants as a result of Your choice to
|
|
||||||
distribute the Covered Software under a subsequent version of this
|
|
||||||
License (see Section 10.2) or under the terms of a Secondary License (if
|
|
||||||
permitted under the terms of Section 3.3).
|
|
||||||
|
|
||||||
2.5. Representation
|
|
||||||
|
|
||||||
Each Contributor represents that the Contributor believes its
|
|
||||||
Contributions are its original creation(s) or it has sufficient rights
|
|
||||||
to grant the rights to its Contributions conveyed by this License.
|
|
||||||
|
|
||||||
2.6. Fair Use
|
|
||||||
|
|
||||||
This License is not intended to limit any rights You have under
|
|
||||||
applicable copyright doctrines of fair use, fair dealing, or other
|
|
||||||
equivalents.
|
|
||||||
|
|
||||||
2.7. Conditions
|
|
||||||
|
|
||||||
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
|
||||||
in Section 2.1.
|
|
||||||
|
|
||||||
3. Responsibilities
|
|
||||||
-------------------
|
|
||||||
|
|
||||||
3.1. Distribution of Source Form
|
|
||||||
|
|
||||||
All distribution of Covered Software in Source Code Form, including any
|
|
||||||
Modifications that You create or to which You contribute, must be under
|
|
||||||
the terms of this License. You must inform recipients that the Source
|
|
||||||
Code Form of the Covered Software is governed by the terms of this
|
|
||||||
License, and how they can obtain a copy of this License. You may not
|
|
||||||
attempt to alter or restrict the recipients' rights in the Source Code
|
|
||||||
Form.
|
|
||||||
|
|
||||||
3.2. Distribution of Executable Form
|
|
||||||
|
|
||||||
If You distribute Covered Software in Executable Form then:
|
|
||||||
|
|
||||||
(a) such Covered Software must also be made available in Source Code
|
|
||||||
Form, as described in Section 3.1, and You must inform recipients of
|
|
||||||
the Executable Form how they can obtain a copy of such Source Code
|
|
||||||
Form by reasonable means in a timely manner, at a charge no more
|
|
||||||
than the cost of distribution to the recipient; and
|
|
||||||
|
|
||||||
(b) You may distribute such Executable Form under the terms of this
|
|
||||||
License, or sublicense it under different terms, provided that the
|
|
||||||
license for the Executable Form does not attempt to limit or alter
|
|
||||||
the recipients' rights in the Source Code Form under this License.
|
|
||||||
|
|
||||||
3.3. Distribution of a Larger Work
|
|
||||||
|
|
||||||
You may create and distribute a Larger Work under terms of Your choice,
|
|
||||||
provided that You also comply with the requirements of this License for
|
|
||||||
the Covered Software. If the Larger Work is a combination of Covered
|
|
||||||
Software with a work governed by one or more Secondary Licenses, and the
|
|
||||||
Covered Software is not Incompatible With Secondary Licenses, this
|
|
||||||
License permits You to additionally distribute such Covered Software
|
|
||||||
under the terms of such Secondary License(s), so that the recipient of
|
|
||||||
the Larger Work may, at their option, further distribute the Covered
|
|
||||||
Software under the terms of either this License or such Secondary
|
|
||||||
License(s).
|
|
||||||
|
|
||||||
3.4. Notices
|
|
||||||
|
|
||||||
You may not remove or alter the substance of any license notices
|
|
||||||
(including copyright notices, patent notices, disclaimers of warranty,
|
|
||||||
or limitations of liability) contained within the Source Code Form of
|
|
||||||
the Covered Software, except that You may alter any license notices to
|
|
||||||
the extent required to remedy known factual inaccuracies.
|
|
||||||
|
|
||||||
3.5. Application of Additional Terms
|
|
||||||
|
|
||||||
You may choose to offer, and to charge a fee for, warranty, support,
|
|
||||||
indemnity or liability obligations to one or more recipients of Covered
|
|
||||||
Software. However, You may do so only on Your own behalf, and not on
|
|
||||||
behalf of any Contributor. You must make it absolutely clear that any
|
|
||||||
such warranty, support, indemnity, or liability obligation is offered by
|
|
||||||
You alone, and You hereby agree to indemnify every Contributor for any
|
|
||||||
liability incurred by such Contributor as a result of warranty, support,
|
|
||||||
indemnity or liability terms You offer. You may include additional
|
|
||||||
disclaimers of warranty and limitations of liability specific to any
|
|
||||||
jurisdiction.
|
|
||||||
|
|
||||||
4. Inability to Comply Due to Statute or Regulation
|
|
||||||
---------------------------------------------------
|
|
||||||
|
|
||||||
If it is impossible for You to comply with any of the terms of this
|
|
||||||
License with respect to some or all of the Covered Software due to
|
|
||||||
statute, judicial order, or regulation then You must: (a) comply with
|
|
||||||
the terms of this License to the maximum extent possible; and (b)
|
|
||||||
describe the limitations and the code they affect. Such description must
|
|
||||||
be placed in a text file included with all distributions of the Covered
|
|
||||||
Software under this License. Except to the extent prohibited by statute
|
|
||||||
or regulation, such description must be sufficiently detailed for a
|
|
||||||
recipient of ordinary skill to be able to understand it.
|
|
||||||
|
|
||||||
5. Termination
|
|
||||||
--------------
|
|
||||||
|
|
||||||
5.1. The rights granted under this License will terminate automatically
|
|
||||||
if You fail to comply with any of its terms. However, if You become
|
|
||||||
compliant, then the rights granted under this License from a particular
|
|
||||||
Contributor are reinstated (a) provisionally, unless and until such
|
|
||||||
Contributor explicitly and finally terminates Your grants, and (b) on an
|
|
||||||
ongoing basis, if such Contributor fails to notify You of the
|
|
||||||
non-compliance by some reasonable means prior to 60 days after You have
|
|
||||||
come back into compliance. Moreover, Your grants from a particular
|
|
||||||
Contributor are reinstated on an ongoing basis if such Contributor
|
|
||||||
notifies You of the non-compliance by some reasonable means, this is the
|
|
||||||
first time You have received notice of non-compliance with this License
|
|
||||||
from such Contributor, and You become compliant prior to 30 days after
|
|
||||||
Your receipt of the notice.
|
|
||||||
|
|
||||||
5.2. If You initiate litigation against any entity by asserting a patent
|
|
||||||
infringement claim (excluding declaratory judgment actions,
|
|
||||||
counter-claims, and cross-claims) alleging that a Contributor Version
|
|
||||||
directly or indirectly infringes any patent, then the rights granted to
|
|
||||||
You by any and all Contributors for the Covered Software under Section
|
|
||||||
2.1 of this License shall terminate.
|
|
||||||
|
|
||||||
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
|
||||||
end user license agreements (excluding distributors and resellers) which
|
|
||||||
have been validly granted by You or Your distributors under this License
|
|
||||||
prior to termination shall survive termination.
|
|
||||||
|
|
||||||
************************************************************************
|
|
||||||
* *
|
|
||||||
* 6. Disclaimer of Warranty *
|
|
||||||
* ------------------------- *
|
|
||||||
* *
|
|
||||||
* Covered Software is provided under this License on an "as is" *
|
|
||||||
* basis, without warranty of any kind, either expressed, implied, or *
|
|
||||||
* statutory, including, without limitation, warranties that the *
|
|
||||||
* Covered Software is free of defects, merchantable, fit for a *
|
|
||||||
* particular purpose or non-infringing. The entire risk as to the *
|
|
||||||
* quality and performance of the Covered Software is with You. *
|
|
||||||
* Should any Covered Software prove defective in any respect, You *
|
|
||||||
* (not any Contributor) assume the cost of any necessary servicing, *
|
|
||||||
* repair, or correction. This disclaimer of warranty constitutes an *
|
|
||||||
* essential part of this License. No use of any Covered Software is *
|
|
||||||
* authorized under this License except under this disclaimer. *
|
|
||||||
* *
|
|
||||||
************************************************************************
|
|
||||||
|
|
||||||
************************************************************************
|
|
||||||
* *
|
|
||||||
* 7. Limitation of Liability *
|
|
||||||
* -------------------------- *
|
|
||||||
* *
|
|
||||||
* Under no circumstances and under no legal theory, whether tort *
|
|
||||||
* (including negligence), contract, or otherwise, shall any *
|
|
||||||
* Contributor, or anyone who distributes Covered Software as *
|
|
||||||
* permitted above, be liable to You for any direct, indirect, *
|
|
||||||
* special, incidental, or consequential damages of any character *
|
|
||||||
* including, without limitation, damages for lost profits, loss of *
|
|
||||||
* goodwill, work stoppage, computer failure or malfunction, or any *
|
|
||||||
* and all other commercial damages or losses, even if such party *
|
|
||||||
* shall have been informed of the possibility of such damages. This *
|
|
||||||
* limitation of liability shall not apply to liability for death or *
|
|
||||||
* personal injury resulting from such party's negligence to the *
|
|
||||||
* extent applicable law prohibits such limitation. Some *
|
|
||||||
* jurisdictions do not allow the exclusion or limitation of *
|
|
||||||
* incidental or consequential damages, so this exclusion and *
|
|
||||||
* limitation may not apply to You. *
|
|
||||||
* *
|
|
||||||
************************************************************************
|
|
||||||
|
|
||||||
8. Litigation
|
|
||||||
-------------
|
|
||||||
|
|
||||||
Any litigation relating to this License may be brought only in the
|
|
||||||
courts of a jurisdiction where the defendant maintains its principal
|
|
||||||
place of business and such litigation shall be governed by laws of that
|
|
||||||
jurisdiction, without reference to its conflict-of-law provisions.
|
|
||||||
Nothing in this Section shall prevent a party's ability to bring
|
|
||||||
cross-claims or counter-claims.
|
|
||||||
|
|
||||||
9. Miscellaneous
|
|
||||||
----------------
|
|
||||||
|
|
||||||
This License represents the complete agreement concerning the subject
|
|
||||||
matter hereof. If any provision of this License is held to be
|
|
||||||
unenforceable, such provision shall be reformed only to the extent
|
|
||||||
necessary to make it enforceable. Any law or regulation which provides
|
|
||||||
that the language of a contract shall be construed against the drafter
|
|
||||||
shall not be used to construe this License against a Contributor.
|
|
||||||
|
|
||||||
10. Versions of the License
|
|
||||||
---------------------------
|
|
||||||
|
|
||||||
10.1. New Versions
|
|
||||||
|
|
||||||
Mozilla Foundation is the license steward. Except as provided in Section
|
|
||||||
10.3, no one other than the license steward has the right to modify or
|
|
||||||
publish new versions of this License. Each version will be given a
|
|
||||||
distinguishing version number.
|
|
||||||
|
|
||||||
10.2. Effect of New Versions
|
|
||||||
|
|
||||||
You may distribute the Covered Software under the terms of the version
|
|
||||||
of the License under which You originally received the Covered Software,
|
|
||||||
or under the terms of any subsequent version published by the license
|
|
||||||
steward.
|
|
||||||
|
|
||||||
10.3. Modified Versions
|
|
||||||
|
|
||||||
If you create software not governed by this License, and you want to
|
|
||||||
create a new license for such software, you may create and use a
|
|
||||||
modified version of this License if you rename the license and remove
|
|
||||||
any references to the name of the license steward (except to note that
|
|
||||||
such modified license differs from this License).
|
|
||||||
|
|
||||||
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
|
||||||
Licenses
|
|
||||||
|
|
||||||
If You choose to distribute Source Code Form that is Incompatible With
|
|
||||||
Secondary Licenses under the terms of this version of the License, the
|
|
||||||
notice described in Exhibit B of this License must be attached.
|
|
||||||
|
|
||||||
Exhibit A - Source Code Form License Notice
|
|
||||||
-------------------------------------------
|
|
||||||
|
|
||||||
This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
||||||
|
|
||||||
If it is not possible or desirable to put the notice in a particular
|
|
||||||
file, then You may include the notice in a location (such as a LICENSE
|
|
||||||
file in a relevant directory) where a recipient would be likely to look
|
|
||||||
for such a notice.
|
|
||||||
|
|
||||||
You may add additional accurate notices of copyright ownership.
|
|
||||||
|
|
||||||
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
|
||||||
---------------------------------------------------------
|
|
||||||
|
|
||||||
This Source Code Form is "Incompatible With Secondary Licenses", as
|
|
||||||
defined by the Mozilla Public License, v. 2.0.
|
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
"name": "napcat",
|
"name": "napcat",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "1.8.3",
|
"version": "1.8.6",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"watch:dev": "vite --mode development",
|
"watch:dev": "vite --mode development",
|
||||||
"watch:prod": "vite --mode production",
|
"watch:prod": "vite --mode production",
|
||||||
|
@@ -86,5 +86,5 @@ where wt >nul 2>nul
|
|||||||
if %errorlevel% equ 0 (
|
if %errorlevel% equ 0 (
|
||||||
wt "cmd" /c "%QQPath%" --enable-logging %*
|
wt "cmd" /c "%QQPath%" --enable-logging %*
|
||||||
) else (
|
) else (
|
||||||
%QQPath%" --enable-logging %*
|
"%QQPath%" --enable-logging %*
|
||||||
)
|
)
|
||||||
|
@@ -39,7 +39,7 @@ export function getAppidV2(): { appid: string, qua: string } {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
log(`[QQ版本兼容性检测] 获取Appid异常 请检测NapCat/QQNT是否正常`);
|
log('[QQ版本兼容性检测] 获取Appid异常 请检测NapCat/QQNT是否正常');
|
||||||
}
|
}
|
||||||
// 以下是兜底措施
|
// 以下是兜底措施
|
||||||
log(`[QQ版本兼容性检测] ${getFullQQVesion()} 版本兼容性不佳,可能会导致一些功能无法正常使用`);
|
log(`[QQ版本兼容性检测] ${getFullQQVesion()} 版本兼容性不佳,可能会导致一些功能无法正常使用`);
|
||||||
|
@@ -220,7 +220,7 @@ export class NTQQGroupApi {
|
|||||||
const _Pskey = (await NTQQUserApi.getPSkey(['qun.qq.com'])).domainPskeyMap.get('qun.qq.com')!;
|
const _Pskey = (await NTQQUserApi.getPSkey(['qun.qq.com'])).domainPskeyMap.get('qun.qq.com')!;
|
||||||
return napCatCore.session.getGroupService().uploadGroupBulletinPic(GroupCode, _Pskey, imageurl);
|
return napCatCore.session.getGroupService().uploadGroupBulletinPic(GroupCode, _Pskey, imageurl);
|
||||||
}
|
}
|
||||||
static async handleGroupRequest(flag: string, operateType: GroupRequestOperateTypes, reason?: string) {
|
static async handleGroupRequest(flag: string , operateType: GroupRequestOperateTypes, reason?: string) {
|
||||||
let flagitem = flag.split('|');
|
let flagitem = flag.split('|');
|
||||||
let groupCode = flagitem[0];
|
let groupCode = flagitem[0];
|
||||||
let seq = flagitem[1];
|
let seq = flagitem[1];
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
import { GetFileListParam, Peer, RawMessage, SendMessageElement, SendMsgElementConstructor } from '@/core/entities';
|
import { ChatType, ChatType2, GetFileListParam, Peer, RawMessage, SendMessageElement, SendMsgElementConstructor } from '@/core/entities';
|
||||||
import { friends, groups, selfInfo } from '@/core/data';
|
import { friends, getGroupMember, groups, selfInfo } from '@/core/data';
|
||||||
import { log, logWarn } from '@/common/utils/log';
|
import { log, logWarn } from '@/common/utils/log';
|
||||||
import { sleep } from '@/common/utils/helper';
|
import { sleep } from '@/common/utils/helper';
|
||||||
import { napCatCore, NTQQUserApi } from '@/core';
|
import { napCatCore, NTQQGroupApi, NTQQUserApi } from '@/core';
|
||||||
import { onGroupFileInfoUpdateParamType } from '@/core/listeners';
|
import { onGroupFileInfoUpdateParamType } from '@/core/listeners';
|
||||||
import { GeneralCallResult } from '@/core/services/common';
|
import { GeneralCallResult } from '@/core/services/common';
|
||||||
import { MessageUnique } from '../../../common/utils/MessageUnique';
|
import { MessageUnique } from '../../../common/utils/MessageUnique';
|
||||||
@@ -71,6 +71,29 @@ export class NTQQMsgApi {
|
|||||||
static async FetchLongMsg(peer: Peer, msgId: string) {
|
static async FetchLongMsg(peer: Peer, msgId: string) {
|
||||||
return napCatCore.session.getMsgService().fetchLongMsg(peer, msgId);
|
return napCatCore.session.getMsgService().fetchLongMsg(peer, msgId);
|
||||||
}
|
}
|
||||||
|
static async getTempChatInfo(chatType: ChatType2, peerUid: string) {
|
||||||
|
return napCatCore.session.getMsgService().getTempChatInfo(chatType, peerUid);
|
||||||
|
}
|
||||||
|
static async PrepareTempChat(toUserUid: string, GroupCode: string, nickname: string) {
|
||||||
|
//By Jadx/Ida Mlikiowa
|
||||||
|
let TempGameSession = {
|
||||||
|
nickname: "",
|
||||||
|
gameAppId: "",
|
||||||
|
selfTinyId: "",
|
||||||
|
peerRoleId: "",
|
||||||
|
peerOpenId: "",
|
||||||
|
};
|
||||||
|
return napCatCore.session.getMsgService().prepareTempChat({
|
||||||
|
chatType: ChatType2.KCHATTYPETEMPC2CFROMGROUP,
|
||||||
|
peerUid: toUserUid,
|
||||||
|
peerNickname: nickname,
|
||||||
|
fromGroupCode: GroupCode,
|
||||||
|
sig: "",
|
||||||
|
selfPhone: "",
|
||||||
|
selfUid: selfInfo.uid,
|
||||||
|
gameSession: TempGameSession
|
||||||
|
});
|
||||||
|
}
|
||||||
static async getMsgEmojiLikesList(peer: Peer, msgSeq: string, emojiId: string, emojiType: string, count: number = 20) {
|
static async getMsgEmojiLikesList(peer: Peer, msgSeq: string, emojiId: string, emojiType: string, count: number = 20) {
|
||||||
//console.log(peer, msgSeq, emojiId, emojiType, count);
|
//console.log(peer, msgSeq, emojiId, emojiType, count);
|
||||||
//注意此处emojiType 可选值一般为1-2 2好像是unicode表情dec值 大部分情况 Taged M likiowa
|
//注意此处emojiType 可选值一般为1-2 2好像是unicode表情dec值 大部分情况 Taged M likiowa
|
||||||
@@ -97,7 +120,7 @@ export class NTQQMsgApi {
|
|||||||
return napCatCore.session.getMsgService().getMultiMsg(peer, rootMsgId, parentMsgId);
|
return napCatCore.session.getMsgService().getMultiMsg(peer, rootMsgId, parentMsgId);
|
||||||
}
|
}
|
||||||
static async ForwardMsg(peer: Peer, msgIds: string[]) {
|
static async ForwardMsg(peer: Peer, msgIds: string[]) {
|
||||||
return napCatCore.session.getMsgService().forwardMsg(msgIds, peer, [peer], new Map());
|
return napCatCore.session.getMsgService().forwardMsg(msgIds, peer, [peer], []);
|
||||||
}
|
}
|
||||||
static async getLastestMsgByUids(peer: Peer, count: number = 20, isReverseOrder: boolean = false) {
|
static async getLastestMsgByUids(peer: Peer, count: number = 20, isReverseOrder: boolean = false) {
|
||||||
let ret = await napCatCore.session.getMsgService().queryMsgsWithFilterEx('0', '0', '0', {
|
let ret = await napCatCore.session.getMsgService().queryMsgsWithFilterEx('0', '0', '0', {
|
||||||
@@ -137,6 +160,16 @@ export class NTQQMsgApi {
|
|||||||
});
|
});
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @deprecated 从9.9.15-26702版本开始,该接口已经废弃,请使用getMsgsEx
|
||||||
|
* @param peer
|
||||||
|
* @param seq
|
||||||
|
* @param count
|
||||||
|
* @param desc
|
||||||
|
* @param z
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
static async getMsgsBySeqAndCount(peer: Peer, seq: string, count: number, desc: boolean, z: boolean) {
|
static async getMsgsBySeqAndCount(peer: Peer, seq: string, count: number, desc: boolean, z: boolean) {
|
||||||
return await napCatCore.session.getMsgService().getMsgsBySeqAndCount(peer, seq, count, desc, z);
|
return await napCatCore.session.getMsgService().getMsgsBySeqAndCount(peer, seq, count, desc, z);
|
||||||
}
|
}
|
||||||
@@ -172,6 +205,9 @@ export class NTQQMsgApi {
|
|||||||
}, msgIds);
|
}, msgIds);
|
||||||
}
|
}
|
||||||
static async sendMsgV2(peer: Peer, msgElements: SendMessageElement[], waitComplete = true, timeout = 10000) {
|
static async sendMsgV2(peer: Peer, msgElements: SendMessageElement[], waitComplete = true, timeout = 10000) {
|
||||||
|
if (peer.chatType === ChatType.temp) {
|
||||||
|
//await NTQQMsgApi.PrepareTempChat().then().catch();
|
||||||
|
}
|
||||||
function generateMsgId() {
|
function generateMsgId() {
|
||||||
const timestamp = Math.floor(Date.now() / 1000);
|
const timestamp = Math.floor(Date.now() / 1000);
|
||||||
const random = Math.floor(Math.random() * Math.pow(2, 32));
|
const random = Math.floor(Math.random() * Math.pow(2, 32));
|
||||||
@@ -225,7 +261,32 @@ export class NTQQMsgApi {
|
|||||||
}
|
}
|
||||||
static async sendMsg(peer: Peer, msgElements: SendMessageElement[], waitComplete = true, timeout = 10000) {
|
static async sendMsg(peer: Peer, msgElements: SendMessageElement[], waitComplete = true, timeout = 10000) {
|
||||||
//唉? !我有个想法
|
//唉? !我有个想法
|
||||||
let msgId = await NTQQMsgApi.getMsgUnique(peer.chatType, await NTQQMsgApi.getServerTime());
|
function generateMsgId() {
|
||||||
|
const timestamp = Math.floor(Date.now() / 1000);
|
||||||
|
const random = Math.floor(Math.random() * Math.pow(2, 32));
|
||||||
|
const buffer = Buffer.alloc(8);
|
||||||
|
buffer.writeUInt32BE(timestamp, 0);
|
||||||
|
buffer.writeUInt32BE(random, 4);
|
||||||
|
const msgId = BigInt("0x" + buffer.toString('hex')).toString();
|
||||||
|
return msgId;
|
||||||
|
}
|
||||||
|
// 此处有采用Hack方法 利用数据返回正确得到对应消息
|
||||||
|
// 与之前 Peer队列 MsgSeq队列 真正的MsgId并发不同
|
||||||
|
// 谨慎采用 目前测试暂无问题 Developer.Mlikiowa
|
||||||
|
let msgId: string;
|
||||||
|
try {
|
||||||
|
msgId = await NTQQMsgApi.getMsgUnique(peer.chatType, await NTQQMsgApi.getServerTime());
|
||||||
|
} catch (error) {
|
||||||
|
//if (!napCatCore.session.getMsgService()['generateMsgUniqueId'])
|
||||||
|
//兜底识别策略V2
|
||||||
|
msgId = generateMsgId();
|
||||||
|
}
|
||||||
|
if (peer.chatType === ChatType.temp && peer.guildId && peer.guildId !== '') {
|
||||||
|
let member = await getGroupMember(peer.guildId, peer.peerUid!);
|
||||||
|
if(member){
|
||||||
|
await NTQQMsgApi.PrepareTempChat(peer.peerUid,peer.guildId,member.nick);
|
||||||
|
}
|
||||||
|
}
|
||||||
peer.guildId = msgId;
|
peer.guildId = msgId;
|
||||||
let data = await NTEventDispatch.CallNormalEvent<
|
let data = await NTEventDispatch.CallNormalEvent<
|
||||||
(msgId: string, peer: Peer, msgElements: SendMessageElement[], map: Map<any, any>) => Promise<unknown>,
|
(msgId: string, peer: Peer, msgElements: SendMessageElement[], map: Map<any, any>) => Promise<unknown>,
|
||||||
@@ -268,7 +329,7 @@ export class NTQQMsgApi {
|
|||||||
return NTEventDispatch.CallNoListenerEvent<() => string>('NodeIKernelMsgService/getServerTime', 5000);
|
return NTEventDispatch.CallNoListenerEvent<() => string>('NodeIKernelMsgService/getServerTime', 5000);
|
||||||
}
|
}
|
||||||
static async forwardMsg(srcPeer: Peer, destPeer: Peer, msgIds: string[]) {
|
static async forwardMsg(srcPeer: Peer, destPeer: Peer, msgIds: string[]) {
|
||||||
return napCatCore.session.getMsgService().forwardMsg(msgIds, srcPeer, [destPeer], new Map());
|
return napCatCore.session.getMsgService().forwardMsg(msgIds, srcPeer, [destPeer], []);
|
||||||
}
|
}
|
||||||
static async multiForwardMsg(srcPeer: Peer, destPeer: Peer, msgIds: string[]): Promise<RawMessage> {
|
static async multiForwardMsg(srcPeer: Peer, destPeer: Peer, msgIds: string[]): Promise<RawMessage> {
|
||||||
const msgInfos = msgIds.map(id => {
|
const msgInfos = msgIds.map(id => {
|
||||||
|
@@ -80,9 +80,6 @@ export async function getGroupMember(groupQQ: string | number, memberUinOrUid: s
|
|||||||
}
|
}
|
||||||
return member;
|
return member;
|
||||||
}
|
}
|
||||||
// 考虑优化 移入QQ缓存或使用Api直接获取
|
|
||||||
export const tempGroupCodeMap: Record<string, string> = {}; // peerUid => 群号
|
|
||||||
|
|
||||||
// 保留 需要频繁读写
|
// 保留 需要频繁读写
|
||||||
export const stat = {
|
export const stat = {
|
||||||
packet_received: 0,
|
packet_received: 0,
|
||||||
|
@@ -12,6 +12,21 @@ export interface QueryMsgsParams {
|
|||||||
isReverseOrder: boolean,
|
isReverseOrder: boolean,
|
||||||
isIncludeCurrent: boolean
|
isIncludeCurrent: boolean
|
||||||
}
|
}
|
||||||
|
export interface TmpChatInfoApi {
|
||||||
|
errMsg: string;
|
||||||
|
result: number;
|
||||||
|
tmpChatInfo?: TmpChatInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TmpChatInfo {
|
||||||
|
chatType: number;
|
||||||
|
fromNick: string;
|
||||||
|
groupCode: string;
|
||||||
|
peerUid: string;
|
||||||
|
sessionType: number;
|
||||||
|
sig: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface NodeIKernelMsgService {
|
export interface NodeIKernelMsgService {
|
||||||
|
|
||||||
generateMsgUniqueId(chatType: number, time: string): string;
|
generateMsgUniqueId(chatType: number, time: string): string;
|
||||||
@@ -97,8 +112,8 @@ export interface NodeIKernelMsgService {
|
|||||||
recallMsg(...args: unknown[]): unknown;
|
recallMsg(...args: unknown[]): unknown;
|
||||||
|
|
||||||
reeditRecallMsg(...args: unknown[]): unknown;
|
reeditRecallMsg(...args: unknown[]): unknown;
|
||||||
|
//调用请检查除开commentElements其余参数不能为null
|
||||||
forwardMsg(...args: unknown[]): Promise<GeneralCallResult>;
|
forwardMsg(msgIds: string[], srcContact: Peer, dstContacts: Peer[], commentElements: MessageElement[]): Promise<GeneralCallResult>;
|
||||||
|
|
||||||
forwardMsgWithComment(...args: unknown[]): unknown;
|
forwardMsgWithComment(...args: unknown[]): unknown;
|
||||||
|
|
||||||
@@ -156,6 +171,7 @@ export interface NodeIKernelMsgService {
|
|||||||
|
|
||||||
getAioFirstViewLatestMsgs(peer: Peer, num: number): unknown;
|
getAioFirstViewLatestMsgs(peer: Peer, num: number): unknown;
|
||||||
|
|
||||||
|
//deprecated 从9.9.15-26702版本开始,该接口已经废弃,请使用getMsgsEx
|
||||||
getMsgs(peer: Peer, msgId: string, count: unknown, queryOrder: boolean): Promise<unknown>;
|
getMsgs(peer: Peer, msgId: string, count: unknown, queryOrder: boolean): Promise<unknown>;
|
||||||
|
|
||||||
getMsgsIncludeSelf(peer: Peer, msgId: string, count: number, queryOrder: boolean): Promise<GeneralCallResult & {
|
getMsgsIncludeSelf(peer: Peer, msgId: string, count: number, queryOrder: boolean): Promise<GeneralCallResult & {
|
||||||
@@ -608,7 +624,7 @@ export interface NodeIKernelMsgService {
|
|||||||
sendSsoCmdReqByContend(cmd: string, param: string): Promise<unknown>;
|
sendSsoCmdReqByContend(cmd: string, param: string): Promise<unknown>;
|
||||||
|
|
||||||
//chattype,uid->Promise<any>
|
//chattype,uid->Promise<any>
|
||||||
getTempChatInfo(ChatType: number, Uid: string): unknown;
|
getTempChatInfo(ChatType: number, Uid: string): Promise<TmpChatInfoApi>;
|
||||||
|
|
||||||
setContactLocalTop(...args: unknown[]): unknown;
|
setContactLocalTop(...args: unknown[]): unknown;
|
||||||
|
|
||||||
|
4
src/nwebui/Readme.md
Normal file
4
src/nwebui/Readme.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# NewWebui
|
||||||
|
基于Vue3实现的现代化轻量化NapCat管理面板
|
||||||
|
## 进度
|
||||||
|
画饼
|
@@ -2,7 +2,6 @@
|
|||||||
import { NTQQCollectionApi } from '@/core/apis/collection';
|
import { NTQQCollectionApi } from '@/core/apis/collection';
|
||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
import { NTQQUserApi } from '@/core/apis';
|
|
||||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
import { selfInfo } from '@/core/data';
|
import { selfInfo } from '@/core/data';
|
||||||
|
|
||||||
|
@@ -1,16 +1,12 @@
|
|||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
// import * as ntqqApi from "../../../ntqqapi/api";
|
|
||||||
import {
|
import {
|
||||||
NTQQMsgApi,
|
NTQQMsgApi,
|
||||||
NTQQFriendApi,
|
NTQQFriendApi,
|
||||||
NTQQGroupApi,
|
NTQQGroupApi,
|
||||||
NTQQUserApi,
|
NTQQUserApi,
|
||||||
NTQQFileApi,
|
NTQQFileApi,
|
||||||
// NTQQFileCacheApi,
|
|
||||||
} from '@/core';
|
} from '@/core';
|
||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
import { log, logDebug } from '@/common/utils/log';
|
|
||||||
|
|
||||||
interface Payload {
|
interface Payload {
|
||||||
method: string,
|
method: string,
|
||||||
args: any[],
|
args: any[],
|
||||||
@@ -20,12 +16,8 @@ export default class Debug extends BaseAction<Payload, any> {
|
|||||||
actionName = ActionName.Debug;
|
actionName = ActionName.Debug;
|
||||||
|
|
||||||
protected async _handle(payload: Payload): Promise<any> {
|
protected async _handle(payload: Payload): Promise<any> {
|
||||||
//logDebug('debug call ntqq api', payload);
|
const ntqqApi = [NTQQMsgApi, NTQQFriendApi, NTQQGroupApi, NTQQUserApi, NTQQFileApi,];
|
||||||
const ntqqApi = [NTQQMsgApi, NTQQFriendApi, NTQQGroupApi, NTQQUserApi, NTQQFileApi,
|
|
||||||
// NTQQFileCacheApi,
|
|
||||||
];
|
|
||||||
for (const ntqqApiClass of ntqqApi) {
|
for (const ntqqApiClass of ntqqApi) {
|
||||||
// logDebug('ntqqApiClass', ntqqApiClass);
|
|
||||||
const method = (<any>ntqqApiClass)[payload.method];
|
const method = (<any>ntqqApiClass)[payload.method];
|
||||||
if (method) {
|
if (method) {
|
||||||
const result = method(...payload.args);
|
const result = method(...payload.args);
|
||||||
@@ -36,8 +28,5 @@ export default class Debug extends BaseAction<Payload, any> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw `${payload.method}方法 不存在`;
|
throw `${payload.method}方法 不存在`;
|
||||||
|
|
||||||
// const info = await NTQQApi.getUserDetailInfo(friends[0].uid);
|
|
||||||
// return info
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -24,9 +24,9 @@ export class FetchEmojioLike extends BaseAction<Payload, any> {
|
|||||||
PayloadSchema = SchemaData;
|
PayloadSchema = SchemaData;
|
||||||
protected async _handle(payload: Payload) {
|
protected async _handle(payload: Payload) {
|
||||||
const msgIdPeer = MessageUnique.getMsgIdAndPeerByShortId(parseInt(payload.message_id.toString()));
|
const msgIdPeer = MessageUnique.getMsgIdAndPeerByShortId(parseInt(payload.message_id.toString()));
|
||||||
if(!msgIdPeer) throw new Error('消息不存在');
|
if (!msgIdPeer) throw new Error('消息不存在');
|
||||||
const msg = (await NTQQMsgApi.getMsgsByMsgId(msgIdPeer.Peer, [msgIdPeer.MsgId])).msgList[0];
|
const msg = (await NTQQMsgApi.getMsgsByMsgId(msgIdPeer.Peer, [msgIdPeer.MsgId])).msgList[0];
|
||||||
const ret = await NTQQMsgApi.getMsgEmojiLikesList(msgIdPeer.Peer,msg.msgSeq,payload.emojiId,payload.emojiType,payload.count);
|
const ret = await NTQQMsgApi.getMsgEmojiLikesList(msgIdPeer.Peer, msg.msgSeq, payload.emojiId, payload.emojiType, payload.count);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,9 +2,7 @@
|
|||||||
import { NTQQCollectionApi } from '@/core/apis/collection';
|
import { NTQQCollectionApi } from '@/core/apis/collection';
|
||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
import { NTQQUserApi } from '@/core/apis';
|
|
||||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
import { selfInfo } from '@/core/data';
|
|
||||||
|
|
||||||
const SchemaData = {
|
const SchemaData = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
|
@@ -5,7 +5,6 @@ export class GetRobotUinRange extends BaseAction<void, Array<any>> {
|
|||||||
actionName = ActionName.GetRobotUinRange;
|
actionName = ActionName.GetRobotUinRange;
|
||||||
|
|
||||||
protected async _handle(payload: void) {
|
protected async _handle(payload: void) {
|
||||||
// console.log(await NTQQUserApi.getRobotUinRange());
|
|
||||||
return await NTQQUserApi.getRobotUinRange();
|
return await NTQQUserApi.getRobotUinRange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -20,7 +20,7 @@ export class OCRImage extends BaseAction<Payload, any> {
|
|||||||
actionName = ActionName.OCRImage;
|
actionName = ActionName.OCRImage;
|
||||||
PayloadSchema = SchemaData;
|
PayloadSchema = SchemaData;
|
||||||
protected async _handle(payload: Payload) {
|
protected async _handle(payload: Payload) {
|
||||||
const { path, isLocal, errMsg,success } = (await uri2local(payload.image));
|
const { path, isLocal, errMsg, success } = (await uri2local(payload.image));
|
||||||
if (!success) {
|
if (!success) {
|
||||||
throw `OCR ${payload.image}失败,image字段可能格式不正确`;
|
throw `OCR ${payload.image}失败,image字段可能格式不正确`;
|
||||||
}
|
}
|
||||||
|
@@ -1,10 +1,8 @@
|
|||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import { ActionName, BaseCheckResult } from '../types';
|
import { ActionName, BaseCheckResult } from '../types';
|
||||||
import * as fs from 'node:fs';
|
import * as fs from 'node:fs';
|
||||||
import { NTQQUserApi } from '@/core/apis/user';
|
|
||||||
import { checkFileReceived, uri2local } from '@/common/utils/file';
|
import { checkFileReceived, uri2local } from '@/common/utils/file';
|
||||||
import { NTQQGroupApi } from '@/core';
|
import { NTQQGroupApi } from '@/core';
|
||||||
// import { log } from "../../../common/utils";
|
|
||||||
|
|
||||||
interface Payload {
|
interface Payload {
|
||||||
file: string,
|
file: string,
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
import { NTQQUserApi } from '@/core/apis';
|
import { NTQQUserApi } from '@/core/apis';
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import { ActionName, BaseCheckResult } from '../types';
|
import { ActionName } from '../types';
|
||||||
import { NTQQUserApi } from '@/core/apis';
|
import { NTQQUserApi } from '@/core/apis';
|
||||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
// 设置在线状态
|
// 设置在线状态
|
||||||
@@ -20,12 +20,6 @@ export class SetOnlineStatus extends BaseAction<Payload, null> {
|
|||||||
actionName = ActionName.SetOnlineStatus;
|
actionName = ActionName.SetOnlineStatus;
|
||||||
PayloadSchema = SchemaData;
|
PayloadSchema = SchemaData;
|
||||||
protected async _handle(payload: Payload) {
|
protected async _handle(payload: Payload) {
|
||||||
// 可设置状态
|
|
||||||
// { status: 10, extStatus: 1027, batteryStatus: 0 }
|
|
||||||
// { status: 30, extStatus: 0, batteryStatus: 0 }
|
|
||||||
// { status: 50, extStatus: 0, batteryStatus: 0 }
|
|
||||||
// { status: 60, extStatus: 0, batteryStatus: 0 }
|
|
||||||
// { status: 70, extStatus: 0, batteryStatus: 0 }
|
|
||||||
const ret = await NTQQUserApi.setSelfOnlineStatus(payload.status, payload.extStatus, payload.batteryStatus);
|
const ret = await NTQQUserApi.setSelfOnlineStatus(payload.status, payload.extStatus, payload.batteryStatus);
|
||||||
if (ret.result !== 0) {
|
if (ret.result !== 0) {
|
||||||
throw new Error('设置在线状态失败');
|
throw new Error('设置在线状态失败');
|
||||||
|
@@ -3,7 +3,6 @@ import { ActionName, BaseCheckResult } from '../types';
|
|||||||
import * as fs from 'node:fs';
|
import * as fs from 'node:fs';
|
||||||
import { NTQQUserApi } from '@/core/apis/user';
|
import { NTQQUserApi } from '@/core/apis/user';
|
||||||
import { checkFileReceived, uri2local } from '@/common/utils/file';
|
import { checkFileReceived, uri2local } from '@/common/utils/file';
|
||||||
// import { log } from "../../../common/utils";
|
|
||||||
|
|
||||||
interface Payload {
|
interface Payload {
|
||||||
file: string
|
file: string
|
||||||
@@ -24,7 +23,7 @@ export default class SetAvatar extends BaseAction<Payload, null> {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
protected async _handle(payload: Payload): Promise<null> {
|
protected async _handle(payload: Payload): Promise<null> {
|
||||||
const { path, isLocal, errMsg,success } = (await uri2local(payload.file));
|
const { path, isLocal, errMsg, success } = (await uri2local(payload.file));
|
||||||
if (!success) {
|
if (!success) {
|
||||||
throw `头像${payload.file}设置失败,file字段可能格式不正确`;
|
throw `头像${payload.file}设置失败,file字段可能格式不正确`;
|
||||||
}
|
}
|
||||||
|
@@ -18,9 +18,7 @@ export default class TestApi01 extends BaseAction<Payload, any> {
|
|||||||
actionName = ActionName.TestApi01;
|
actionName = ActionName.TestApi01;
|
||||||
// 用不着复杂检测
|
// 用不着复杂检测
|
||||||
protected async check(payload: Payload): Promise<BaseCheckResult> {
|
protected async check(payload: Payload): Promise<BaseCheckResult> {
|
||||||
return {
|
return { valid: true };
|
||||||
valid: true,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
protected async _handle(payload: Payload): Promise<any> {
|
protected async _handle(payload: Payload): Promise<any> {
|
||||||
return await napCatCore.session.getMsgService().sendSsoCmdReqByContend(payload.cmd, payload.param);
|
return await napCatCore.session.getMsgService().sendSsoCmdReqByContend(payload.cmd, payload.param);
|
||||||
|
@@ -1,9 +1,7 @@
|
|||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import { ActionName, BaseCheckResult } from '../types';
|
import { ActionName } from '../types';
|
||||||
import { NTQQSystemApi, NTQQUserApi } from '@/core/apis';
|
import { NTQQSystemApi } from '@/core/apis';
|
||||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
import Ajv from 'ajv';
|
|
||||||
// 设置在线状态
|
|
||||||
|
|
||||||
const SchemaData = {
|
const SchemaData = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
import { NTQQGroupApi, NTQQMsgApi, NTQQUserApi } from '@/core/apis';
|
import { NTQQGroupApi } from '@/core/apis';
|
||||||
|
|
||||||
const SchemaData = {
|
const SchemaData = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
|
@@ -2,7 +2,7 @@ import BaseAction from '../BaseAction';
|
|||||||
import fs from 'fs/promises';
|
import fs from 'fs/promises';
|
||||||
import { ob11Config } from '@/onebot11/config';
|
import { ob11Config } from '@/onebot11/config';
|
||||||
import { UUIDConverter } from '@/common/utils/helper';
|
import { UUIDConverter } from '@/common/utils/helper';
|
||||||
import { ActionName, BaseCheckResult } from '../types';
|
import { ActionName } from '../types';
|
||||||
import { ChatType, ElementType, FileElement, Peer, RawMessage, VideoElement } from '@/core/entities';
|
import { ChatType, ElementType, FileElement, Peer, RawMessage, VideoElement } from '@/core/entities';
|
||||||
import { NTQQFileApi, NTQQFriendApi, NTQQMsgApi, NTQQUserApi } from '@/core/apis';
|
import { NTQQFileApi, NTQQFriendApi, NTQQMsgApi, NTQQUserApi } from '@/core/apis';
|
||||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
|
@@ -24,12 +24,12 @@ export class GoCQHTTPGetForwardMsgAction extends BaseAction<Payload, any> {
|
|||||||
actionName = ActionName.GoCQHTTP_GetForwardMsg;
|
actionName = ActionName.GoCQHTTP_GetForwardMsg;
|
||||||
PayloadSchema = SchemaData;
|
PayloadSchema = SchemaData;
|
||||||
protected async _handle(payload: Payload): Promise<any> {
|
protected async _handle(payload: Payload): Promise<any> {
|
||||||
const msgId = payload.message_id || payload.id;
|
const msgIdMixOb11Id = payload.message_id || payload.id;
|
||||||
if (!msgId) {
|
if (!msgIdMixOb11Id) {
|
||||||
throw Error('message_id is required');
|
throw Error('message_id or id is required');
|
||||||
}
|
}
|
||||||
const rootMsgId = MessageUnique.getShortIdByMsgId(msgId);
|
const rootMsgId = MessageUnique.getShortIdByMsgId(msgIdMixOb11Id);
|
||||||
const rootMsg = MessageUnique.getMsgIdAndPeerByShortId(rootMsgId || parseInt(msgId));
|
const rootMsg = MessageUnique.getMsgIdAndPeerByShortId(rootMsgId || parseInt(msgIdMixOb11Id));
|
||||||
if (!rootMsg) {
|
if (!rootMsg) {
|
||||||
throw Error('msg not found');
|
throw Error('msg not found');
|
||||||
}
|
}
|
||||||
@@ -40,7 +40,7 @@ export class GoCQHTTPGetForwardMsgAction extends BaseAction<Payload, any> {
|
|||||||
const msgList = data.msgList;
|
const msgList = data.msgList;
|
||||||
const messages = await Promise.all(msgList.map(async msg => {
|
const messages = await Promise.all(msgList.map(async msg => {
|
||||||
const resMsg = await OB11Constructor.message(msg);
|
const resMsg = await OB11Constructor.message(msg);
|
||||||
resMsg.message_id = await MessageUnique.createMsg({ guildId:'',chatType:msg.chatType,peerUid:msg.peerUid },msg.msgId)!;
|
resMsg.message_id = MessageUnique.createMsg({ guildId: '', chatType: msg.chatType, peerUid: msg.peerUid }, msg.msgId)!;
|
||||||
return resMsg;
|
return resMsg;
|
||||||
}));
|
}));
|
||||||
messages.map(msg => {
|
messages.map(msg => {
|
||||||
|
@@ -50,6 +50,7 @@ export default class GetFriendMsgHistory extends BaseAction<Payload, Response> {
|
|||||||
await Promise.all(msgList.map(async msg => {
|
await Promise.all(msgList.map(async msg => {
|
||||||
msg.id = MessageUnique.createMsg({ guildId: '', chatType: msg.chatType, peerUid: msg.peerUid }, msg.msgId);
|
msg.id = MessageUnique.createMsg({ guildId: '', chatType: msg.chatType, peerUid: msg.peerUid }, msg.msgId);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
//转换消息
|
//转换消息
|
||||||
const ob11MsgList = await Promise.all(msgList.map(msg => OB11Constructor.message(msg)));
|
const ob11MsgList = await Promise.all(msgList.map(msg => OB11Constructor.message(msg)));
|
||||||
return { 'messages': ob11MsgList };
|
return { 'messages': ob11MsgList };
|
||||||
|
@@ -6,7 +6,7 @@ import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
|||||||
const SchemaData = {
|
const SchemaData = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
group_id: { type: [ 'number' , 'string' ] },
|
group_id: { type: ['number', 'string'] },
|
||||||
type: { enum: [WebHonorType.ALL, WebHonorType.EMOTION, WebHonorType.LEGEND, WebHonorType.PERFROMER, WebHonorType.STORONGE_NEWBI, WebHonorType.TALKACTIVE] }
|
type: { enum: [WebHonorType.ALL, WebHonorType.EMOTION, WebHonorType.LEGEND, WebHonorType.PERFROMER, WebHonorType.STORONGE_NEWBI, WebHonorType.TALKACTIVE] }
|
||||||
},
|
},
|
||||||
required: ['group_id']
|
required: ['group_id']
|
||||||
|
@@ -44,7 +44,6 @@ export default class GoCQHTTPGetStrangerInfo extends BaseAction<Payload, OB11Use
|
|||||||
} else {
|
} else {
|
||||||
const user_id = payload.user_id.toString();
|
const user_id = payload.user_id.toString();
|
||||||
const extendData = await NTQQUserApi.getUserDetailInfoByUinV2(user_id);
|
const extendData = await NTQQUserApi.getUserDetailInfoByUinV2(user_id);
|
||||||
//console.log(extendData);
|
|
||||||
const uid = (await NTQQUserApi.getUidByUin(user_id))!;
|
const uid = (await NTQQUserApi.getUidByUin(user_id))!;
|
||||||
if (!uid || uid.indexOf('*') != -1) {
|
if (!uid || uid.indexOf('*') != -1) {
|
||||||
const ret = {
|
const ret = {
|
||||||
|
@@ -54,8 +54,6 @@ export class SendGroupNotice extends BaseAction<Payload, null> {
|
|||||||
if (PublishGroupBulletinResult.result != 0) {
|
if (PublishGroupBulletinResult.result != 0) {
|
||||||
throw `设置群公告失败,错误信息:${PublishGroupBulletinResult.errMsg}`;
|
throw `设置群公告失败,错误信息:${PublishGroupBulletinResult.errMsg}`;
|
||||||
}
|
}
|
||||||
// 下面实现扬了
|
|
||||||
//await WebApi.setGroupNotice(payload.group_id, payload.content) ;
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -4,7 +4,7 @@ import { ActionName } from '../types';
|
|||||||
import { SendMsgElementConstructor } from '@/core/entities/constructor';
|
import { SendMsgElementConstructor } from '@/core/entities/constructor';
|
||||||
import { ChatType, SendFileElement } from '@/core/entities';
|
import { ChatType, SendFileElement } from '@/core/entities';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { SendMsg, sendMsg } from '@/onebot11/action/msg/SendMsg';
|
import { sendMsg } from '@/onebot11/action/msg/SendMsg';
|
||||||
import { uri2local } from '@/common/utils/file';
|
import { uri2local } from '@/common/utils/file';
|
||||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
const SchemaData = {
|
const SchemaData = {
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import { getGroup } from '@/core/data';
|
|
||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
import { SendMsgElementConstructor } from '@/core/entities/constructor';
|
import { SendMsgElementConstructor } from '@/core/entities/constructor';
|
||||||
import { ChatType, Peer, SendFileElement } from '@/core/entities';
|
import { ChatType, Peer, SendFileElement } from '@/core/entities';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { SendMsg, sendMsg } from '@/onebot11/action/msg/SendMsg';
|
import { sendMsg } from '@/onebot11/action/msg/SendMsg';
|
||||||
import { uri2local } from '@/common/utils/file';
|
import { uri2local } from '@/common/utils/file';
|
||||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
import { NTQQFriendApi, NTQQUserApi } from '@/core';
|
import { NTQQFriendApi, NTQQUserApi } from '@/core';
|
||||||
|
@@ -1,9 +1,5 @@
|
|||||||
import { getGroup } from '@/core/data';
|
|
||||||
import { OB11Group } from '../../types';
|
|
||||||
import { OB11Constructor } from '../../constructor';
|
|
||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
import { NTQQMsgApi } from '@/core/apis/msg';
|
|
||||||
import { GroupEssenceMsgRet, WebApi } from '@/core/apis/webapi';
|
import { GroupEssenceMsgRet, WebApi } from '@/core/apis/webapi';
|
||||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
|
|
||||||
|
@@ -5,7 +5,6 @@ import { ActionName } from '../types';
|
|||||||
import { NTQQGroupApi } from '@/core/apis';
|
import { NTQQGroupApi } from '@/core/apis';
|
||||||
import { Group } from '@/core/entities';
|
import { Group } from '@/core/entities';
|
||||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
// no_cache get时传字符串
|
|
||||||
const SchemaData = {
|
const SchemaData = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
import { NTQQGroupApi, NTQQMsgApi } from '@/core';
|
import { NTQQGroupApi } from '@/core';
|
||||||
import { MessageUnique } from '@/common/utils/MessageUnique';
|
import { MessageUnique } from '@/common/utils/MessageUnique';
|
||||||
|
|
||||||
const SchemaData = {
|
const SchemaData = {
|
||||||
@@ -18,7 +18,7 @@ export default class SetEssenceMsg extends BaseAction<Payload, any> {
|
|||||||
actionName = ActionName.SetEssenceMsg;
|
actionName = ActionName.SetEssenceMsg;
|
||||||
PayloadSchema = SchemaData;
|
PayloadSchema = SchemaData;
|
||||||
protected async _handle(payload: Payload): Promise<any> {
|
protected async _handle(payload: Payload): Promise<any> {
|
||||||
const msg = await MessageUnique.getMsgIdAndPeerByShortId(parseInt(payload.message_id.toString()));
|
const msg = MessageUnique.getMsgIdAndPeerByShortId(parseInt(payload.message_id.toString()));
|
||||||
if (!msg) {
|
if (!msg) {
|
||||||
throw new Error('msg not found');
|
throw new Error('msg not found');
|
||||||
}
|
}
|
||||||
|
@@ -9,7 +9,7 @@ const SchemaData = {
|
|||||||
properties: {
|
properties: {
|
||||||
flag: { type: 'string' },
|
flag: { type: 'string' },
|
||||||
approve: { type: ['string', 'boolean'] },
|
approve: { type: ['string', 'boolean'] },
|
||||||
reason: { type: 'string', nullable: true, }
|
reason: { type: 'string', nullable: true }
|
||||||
},
|
},
|
||||||
required: ['flag'],
|
required: ['flag'],
|
||||||
} as const satisfies JSONSchema;
|
} as const satisfies JSONSchema;
|
||||||
@@ -24,7 +24,7 @@ export default class SetGroupAddRequest extends BaseAction<Payload, null> {
|
|||||||
const approve = payload.approve?.toString() !== 'false';
|
const approve = payload.approve?.toString() !== 'false';
|
||||||
await NTQQGroupApi.handleGroupRequest(flag,
|
await NTQQGroupApi.handleGroupRequest(flag,
|
||||||
approve ? GroupRequestOperateTypes.approve : GroupRequestOperateTypes.reject,
|
approve ? GroupRequestOperateTypes.approve : GroupRequestOperateTypes.reject,
|
||||||
payload.reason
|
payload.reason || ''
|
||||||
);
|
);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@@ -3,6 +3,7 @@ import { getGroupMember } from '@/core/data';
|
|||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
import { NTQQGroupApi } from '@/core/apis/group';
|
import { NTQQGroupApi } from '@/core/apis/group';
|
||||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
|
import { NTQQUserApi } from '@/core';
|
||||||
|
|
||||||
const SchemaData = {
|
const SchemaData = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
@@ -20,12 +21,8 @@ export default class SetGroupBan extends BaseAction<Payload, null> {
|
|||||||
actionName = ActionName.SetGroupBan;
|
actionName = ActionName.SetGroupBan;
|
||||||
PayloadSchema = SchemaData;
|
PayloadSchema = SchemaData;
|
||||||
protected async _handle(payload: Payload): Promise<null> {
|
protected async _handle(payload: Payload): Promise<null> {
|
||||||
const member = await getGroupMember(payload.group_id, payload.user_id);
|
|
||||||
if (!member) {
|
|
||||||
throw `群成员${payload.user_id}不存在`;
|
|
||||||
}
|
|
||||||
await NTQQGroupApi.banMember(payload.group_id.toString(),
|
await NTQQGroupApi.banMember(payload.group_id.toString(),
|
||||||
[{ uid: member.uid, timeStamp: parseInt(payload.duration.toString()) }]);
|
[{ uid: (await NTQQUserApi.getUidByUin(payload.user_id.toString()))!, timeStamp: parseInt(payload.duration.toString()) }]);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -3,6 +3,7 @@ import { getGroupMember } from '@/core/data';
|
|||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
import { NTQQGroupApi } from '@/core/apis/group';
|
import { NTQQGroupApi } from '@/core/apis/group';
|
||||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
|
import { NTQQUserApi } from '@/core';
|
||||||
|
|
||||||
|
|
||||||
const SchemaData = {
|
const SchemaData = {
|
||||||
@@ -21,12 +22,8 @@ export default class SetGroupKick extends BaseAction<Payload, null> {
|
|||||||
actionName = ActionName.SetGroupKick;
|
actionName = ActionName.SetGroupKick;
|
||||||
PayloadSchema = SchemaData;
|
PayloadSchema = SchemaData;
|
||||||
protected async _handle(payload: Payload): Promise<null> {
|
protected async _handle(payload: Payload): Promise<null> {
|
||||||
const member = await getGroupMember(payload.group_id, payload.user_id);
|
|
||||||
if (!member) {
|
|
||||||
throw `群成员${payload.user_id}不存在`;
|
|
||||||
}
|
|
||||||
const rejectReq = payload.reject_add_request?.toString() == 'true';
|
const rejectReq = payload.reject_add_request?.toString() == 'true';
|
||||||
await NTQQGroupApi.kickMember(payload.group_id.toString(), [member.uid], rejectReq);
|
await NTQQGroupApi.kickMember(payload.group_id.toString(), [(await NTQQUserApi.getUidByUin(payload.user_id.toString()))!], rejectReq);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -35,9 +35,7 @@ import SetGroupCard from './group/SetGroupCard';
|
|||||||
import GetImage from './file/GetImage';
|
import GetImage from './file/GetImage';
|
||||||
import GetRecord from './file/GetRecord';
|
import GetRecord from './file/GetRecord';
|
||||||
import { GoCQHTTPMarkMsgAsRead, MarkAllMsgAsRead, MarkGroupMsgAsRead, MarkPrivateMsgAsRead } from './msg/MarkMsgAsRead';
|
import { GoCQHTTPMarkMsgAsRead, MarkAllMsgAsRead, MarkGroupMsgAsRead, MarkPrivateMsgAsRead } from './msg/MarkMsgAsRead';
|
||||||
import CleanCache from './system/CleanCache';
|
|
||||||
import GoCQHTTPUploadGroupFile from './go-cqhttp/UploadGroupFile';
|
import GoCQHTTPUploadGroupFile from './go-cqhttp/UploadGroupFile';
|
||||||
import { GetConfigAction, SetConfigAction } from '@/onebot11/action/extends/Config';
|
|
||||||
import GetGroupAddRequest from '@/onebot11/action/extends/GetGroupAddRequest';
|
import GetGroupAddRequest from '@/onebot11/action/extends/GetGroupAddRequest';
|
||||||
import SetQQAvatar from '@/onebot11/action/extends/SetQQAvatar';
|
import SetQQAvatar from '@/onebot11/action/extends/SetQQAvatar';
|
||||||
import GoCQHTTPDownloadFile from './go-cqhttp/DownloadFile';
|
import GoCQHTTPDownloadFile from './go-cqhttp/DownloadFile';
|
||||||
|
@@ -28,20 +28,20 @@ class DeleteMsg extends BaseAction<Payload, void> {
|
|||||||
protected async _handle(payload: Payload) {
|
protected async _handle(payload: Payload) {
|
||||||
const msg = MessageUnique.getMsgIdAndPeerByShortId(Number(payload.message_id));
|
const msg = MessageUnique.getMsgIdAndPeerByShortId(Number(payload.message_id));
|
||||||
if (msg) {
|
if (msg) {
|
||||||
let ret = NTEventDispatch.RegisterListen<NodeIKernelMsgListener['onMsgInfoListUpdate']>
|
const ret = NTEventDispatch.RegisterListen<NodeIKernelMsgListener['onMsgInfoListUpdate']>
|
||||||
(
|
(
|
||||||
'NodeIKernelMsgListener/onMsgInfoListUpdate',
|
'NodeIKernelMsgListener/onMsgInfoListUpdate',
|
||||||
1,
|
1,
|
||||||
5000,
|
5000,
|
||||||
(msgs) => {
|
(msgs) => {
|
||||||
if (msgs.find(m => m.msgId === msg.MsgId && m.recallTime !== '0')) {
|
if (msgs.find(m => m.msgId === msg.MsgId && m.recallTime !== '0')) {
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
).catch(e => new Promise<undefined>((resolve, reject) => { resolve(undefined) }));
|
return false;
|
||||||
|
}
|
||||||
|
).catch(e => new Promise<undefined>((resolve, reject) => { resolve(undefined); }));
|
||||||
await NTQQMsgApi.recallMsg(msg.Peer, [msg.MsgId]);
|
await NTQQMsgApi.recallMsg(msg.Peer, [msg.MsgId]);
|
||||||
let data = await ret;
|
const data = await ret;
|
||||||
if (!data) {
|
if (!data) {
|
||||||
throw new Error('Recall failed');
|
throw new Error('Recall failed');
|
||||||
}
|
}
|
||||||
|
@@ -30,7 +30,7 @@ class ForwardSingleMsg extends BaseAction<Payload, null> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected async _handle(payload: Payload): Promise<null> {
|
protected async _handle(payload: Payload): Promise<null> {
|
||||||
const msg = await MessageUnique.getMsgIdAndPeerByShortId(payload.message_id);
|
const msg = MessageUnique.getMsgIdAndPeerByShortId(payload.message_id);
|
||||||
if (!msg) {
|
if (!msg) {
|
||||||
throw new Error(`无法找到消息${payload.message_id}`);
|
throw new Error(`无法找到消息${payload.message_id}`);
|
||||||
}
|
}
|
||||||
|
@@ -27,8 +27,8 @@ class GetMsg extends BaseAction<Payload, OB11Message> {
|
|||||||
if (!payload.message_id) {
|
if (!payload.message_id) {
|
||||||
throw Error('参数message_id不能为空');
|
throw Error('参数message_id不能为空');
|
||||||
}
|
}
|
||||||
const MsgShortId = await MessageUnique.getShortIdByMsgId(payload.message_id.toString());
|
const MsgShortId = MessageUnique.getShortIdByMsgId(payload.message_id.toString());
|
||||||
const msgIdWithPeer = await MessageUnique.getMsgIdAndPeerByShortId(MsgShortId || parseInt(payload.message_id.toString()));
|
const msgIdWithPeer = MessageUnique.getMsgIdAndPeerByShortId(MsgShortId || parseInt(payload.message_id.toString()));
|
||||||
if (!msgIdWithPeer) {
|
if (!msgIdWithPeer) {
|
||||||
throw ('消息不存在');
|
throw ('消息不存在');
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,7 @@ import { uri2local } from '@/common/utils/file';
|
|||||||
import { ob11Config } from '@/onebot11/config';
|
import { ob11Config } from '@/onebot11/config';
|
||||||
import { RequestUtil } from '@/common/utils/request';
|
import { RequestUtil } from '@/common/utils/request';
|
||||||
import { MessageUnique } from '@/common/utils/MessageUnique';
|
import { MessageUnique } from '@/common/utils/MessageUnique';
|
||||||
console.log(process.pid)
|
console.log(process.pid);
|
||||||
export type MessageContext = {
|
export type MessageContext = {
|
||||||
deleteAfterSentFiles: string[],
|
deleteAfterSentFiles: string[],
|
||||||
peer:Peer
|
peer:Peer
|
||||||
|
@@ -51,24 +51,24 @@ export async function handleForwardNode(destPeer: Peer, messageNodes: OB11Messag
|
|||||||
} else {
|
} else {
|
||||||
// 自定义的消息
|
// 自定义的消息
|
||||||
try {
|
try {
|
||||||
let OB11Data = normalize(messageNode.data.content);
|
const OB11Data = normalize(messageNode.data.content);
|
||||||
//筛选node消息
|
//筛选node消息
|
||||||
let isNodeMsg = OB11Data.filter(e => e.type === OB11MessageDataType.node).length;//找到子转发消息
|
const isNodeMsg = OB11Data.filter(e => e.type === OB11MessageDataType.node).length;//找到子转发消息
|
||||||
if (isNodeMsg !== 0) {
|
if (isNodeMsg !== 0) {
|
||||||
if (isNodeMsg !== OB11Data.length) { logError('子消息中包含非node消息 跳过不合法部分'); continue; }
|
if (isNodeMsg !== OB11Data.length) { logError('子消息中包含非node消息 跳过不合法部分'); continue; }
|
||||||
const nodeMsg = await handleForwardNode(selfPeer, OB11Data.filter(e => e.type === OB11MessageDataType.node));
|
const nodeMsg = await handleForwardNode(selfPeer, OB11Data.filter(e => e.type === OB11MessageDataType.node));
|
||||||
if (nodeMsg) { nodeMsgIds.push(nodeMsg.msgId); MessageUnique.createMsg(selfPeer, nodeMsg.msgId) };
|
if (nodeMsg) { nodeMsgIds.push(nodeMsg.msgId); MessageUnique.createMsg(selfPeer, nodeMsg.msgId); }
|
||||||
//完成子卡片生成跳过后续
|
//完成子卡片生成跳过后续
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const { sendElements } = await createSendElements(OB11Data, destPeer);
|
const { sendElements } = await createSendElements(OB11Data, destPeer);
|
||||||
//拆分消息
|
//拆分消息
|
||||||
let MixElement = sendElements.filter(element => element.elementType !== ElementType.FILE && element.elementType !== ElementType.VIDEO);
|
const MixElement = sendElements.filter(element => element.elementType !== ElementType.FILE && element.elementType !== ElementType.VIDEO);
|
||||||
let SingleElement = sendElements.filter(element => element.elementType === ElementType.FILE || element.elementType === ElementType.VIDEO).map(e => [e]);
|
const SingleElement = sendElements.filter(element => element.elementType === ElementType.FILE || element.elementType === ElementType.VIDEO).map(e => [e]);
|
||||||
let AllElement: SendMessageElement[][] = [MixElement, ...SingleElement].filter(e => e !== undefined && e.length !== 0);
|
const AllElement: SendMessageElement[][] = [MixElement, ...SingleElement].filter(e => e !== undefined && e.length !== 0);
|
||||||
const MsgNodeList: Promise<RawMessage | undefined>[] = [];
|
const MsgNodeList: Promise<RawMessage | undefined>[] = [];
|
||||||
for (const sendElementsSplitElement of AllElement) {
|
for (const sendElementsSplitElement of AllElement) {
|
||||||
MsgNodeList.push(sendMsg(selfPeer, sendElementsSplitElement, [], true).catch(e => new Promise((resolve, reject) => { resolve(undefined) })));
|
MsgNodeList.push(sendMsg(selfPeer, sendElementsSplitElement, [], true).catch(e => new Promise((resolve, reject) => { resolve(undefined); })));
|
||||||
}
|
}
|
||||||
(await Promise.allSettled(MsgNodeList)).map((result) => {
|
(await Promise.allSettled(MsgNodeList)).map((result) => {
|
||||||
if (result.status === 'fulfilled' && result.value) {
|
if (result.status === 'fulfilled' && result.value) {
|
||||||
@@ -85,7 +85,7 @@ export async function handleForwardNode(destPeer: Peer, messageNodes: OB11Messag
|
|||||||
let srcPeer: Peer | undefined = undefined;
|
let srcPeer: Peer | undefined = undefined;
|
||||||
let needSendSelf = false;
|
let needSendSelf = false;
|
||||||
//检测是否处于同一个Peer 不在同一个peer则全部消息由自身发送
|
//检测是否处于同一个Peer 不在同一个peer则全部消息由自身发送
|
||||||
for (let msgId of nodeMsgIds) {
|
for (const msgId of nodeMsgIds) {
|
||||||
const nodeMsgPeer = MessageUnique.getPeerByMsgId(msgId);
|
const nodeMsgPeer = MessageUnique.getPeerByMsgId(msgId);
|
||||||
if (!nodeMsgPeer) {
|
if (!nodeMsgPeer) {
|
||||||
logError('转发消息失败,未找到消息', msgId);
|
logError('转发消息失败,未找到消息', msgId);
|
||||||
|
@@ -67,7 +67,7 @@ export async function sendMsg(peer: Peer, sendElements: SendMessageElement[], de
|
|||||||
}
|
}
|
||||||
const returnMsg = await NTQQMsgApi.sendMsg(peer, sendElements, waitComplete, timeout);
|
const returnMsg = await NTQQMsgApi.sendMsg(peer, sendElements, waitComplete, timeout);
|
||||||
try {
|
try {
|
||||||
returnMsg!.id = await MessageUnique.createMsg({ chatType: peer.chatType, guildId: '', peerUid: peer.peerUid }, returnMsg!.msgId);
|
returnMsg!.id = MessageUnique.createMsg({ chatType: peer.chatType, guildId: '', peerUid: peer.peerUid }, returnMsg!.msgId);
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
logDebug('发送消息id获取失败', e);
|
logDebug('发送消息id获取失败', e);
|
||||||
returnMsg!.id = 0;
|
returnMsg!.id = 0;
|
||||||
@@ -94,7 +94,8 @@ async function createContext(payload: OB11PostSendMsg, contextMode: ContextMode)
|
|||||||
//console.log("[调试代码] UIN:", payload.user_id, " UID:", Uid, " IsBuddy:", isBuddy);
|
//console.log("[调试代码] UIN:", payload.user_id, " UID:", Uid, " IsBuddy:", isBuddy);
|
||||||
return {
|
return {
|
||||||
chatType: isBuddy ? ChatType.friend : ChatType.temp,
|
chatType: isBuddy ? ChatType.friend : ChatType.temp,
|
||||||
peerUid: Uid!
|
peerUid: Uid!,
|
||||||
|
guildId: payload.group_id || ''//临时主动发起时需要传入群号
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
throw '请指定 group_id 或 user_id';
|
throw '请指定 group_id 或 user_id';
|
||||||
|
@@ -11,5 +11,4 @@ class SendPrivateMsg extends SendMsg {
|
|||||||
return super.check(payload);
|
return super.check(payload);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default SendPrivateMsg;
|
export default SendPrivateMsg;
|
||||||
|
@@ -14,7 +14,6 @@ const SchemaData = {
|
|||||||
} as const satisfies JSONSchema;
|
} as const satisfies JSONSchema;
|
||||||
|
|
||||||
type Payload = FromSchema<typeof SchemaData>;
|
type Payload = FromSchema<typeof SchemaData>;
|
||||||
|
|
||||||
export class SetMsgEmojiLike extends BaseAction<Payload, any> {
|
export class SetMsgEmojiLike extends BaseAction<Payload, any> {
|
||||||
actionName = ActionName.SetMsgEmojiLike;
|
actionName = ActionName.SetMsgEmojiLike;
|
||||||
PayloadSchema = SchemaData;
|
PayloadSchema = SchemaData;
|
||||||
|
@@ -4,7 +4,6 @@ import CanSendRecord from './CanSendRecord';
|
|||||||
interface ReturnType {
|
interface ReturnType {
|
||||||
yes: boolean
|
yes: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class CanSendImage extends CanSendRecord {
|
export default class CanSendImage extends CanSendRecord {
|
||||||
actionName = ActionName.CanSendImage;
|
actionName = ActionName.CanSendImage;
|
||||||
}
|
}
|
||||||
|
@@ -3,8 +3,6 @@ import { OB11User } from '../../types';
|
|||||||
import { OB11Constructor } from '../../constructor';
|
import { OB11Constructor } from '../../constructor';
|
||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
import { napCatCore } from '@/core';
|
|
||||||
|
|
||||||
|
|
||||||
class GetLoginInfo extends BaseAction<null, OB11User> {
|
class GetLoginInfo extends BaseAction<null, OB11User> {
|
||||||
actionName = ActionName.GetLoginInfo;
|
actionName = ActionName.GetLoginInfo;
|
||||||
|
@@ -15,8 +15,8 @@ export interface InvalidCheckResult {
|
|||||||
|
|
||||||
export enum ActionName {
|
export enum ActionName {
|
||||||
// 以下为扩展napcat扩展
|
// 以下为扩展napcat扩展
|
||||||
SharePeer = 'ArkShareGroup',
|
SharePeer = 'ArkSharePeer',
|
||||||
ShareGroupEx = 'ArkSharePeer',
|
ShareGroupEx = 'ArkShareGroupEx',
|
||||||
RebootNormal = 'reboot_normal',//无快速登录重新启动
|
RebootNormal = 'reboot_normal',//无快速登录重新启动
|
||||||
GetRobotUinRange = 'get_robot_uin_range',
|
GetRobotUinRange = 'get_robot_uin_range',
|
||||||
SetOnlineStatus = 'set_online_status',
|
SetOnlineStatus = 'set_online_status',
|
||||||
|
@@ -6,8 +6,6 @@ import { ActionName } from '../types';
|
|||||||
import { NTQQFriendApi } from '@/core';
|
import { NTQQFriendApi } from '@/core';
|
||||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
import { requireMinNTQQBuild } from '@/common/utils/QQBasicInfo';
|
import { requireMinNTQQBuild } from '@/common/utils/QQBasicInfo';
|
||||||
|
|
||||||
|
|
||||||
// no_cache get时传字符串
|
// no_cache get时传字符串
|
||||||
const SchemaData = {
|
const SchemaData = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
|
@@ -13,7 +13,6 @@ const SchemaData = {
|
|||||||
} as const satisfies JSONSchema;
|
} as const satisfies JSONSchema;
|
||||||
|
|
||||||
type Payload = FromSchema<typeof SchemaData>;
|
type Payload = FromSchema<typeof SchemaData>;
|
||||||
|
|
||||||
export default class SendLike extends BaseAction<Payload, null> {
|
export default class SendLike extends BaseAction<Payload, null> {
|
||||||
actionName = ActionName.SendLike;
|
actionName = ActionName.SendLike;
|
||||||
PayloadSchema = SchemaData;
|
PayloadSchema = SchemaData;
|
||||||
|
@@ -1,10 +1,4 @@
|
|||||||
import fs from 'node:fs';
|
|
||||||
import path from 'node:path';
|
|
||||||
import { selfInfo } from '@/core/data';
|
|
||||||
import { logDebug, logError } from '@/common/utils/log';
|
|
||||||
import { ConfigBase } from '@/common/utils/ConfigBase';
|
import { ConfigBase } from '@/common/utils/ConfigBase';
|
||||||
import { json } from 'stream/consumers';
|
|
||||||
|
|
||||||
export interface OB11Config {
|
export interface OB11Config {
|
||||||
http: {
|
http: {
|
||||||
enable: boolean;
|
enable: boolean;
|
||||||
@@ -36,7 +30,7 @@ export interface OB11Config {
|
|||||||
Record: boolean,
|
Record: boolean,
|
||||||
RecordList: Array<string>
|
RecordList: Array<string>
|
||||||
},
|
},
|
||||||
read(): OB11Config;
|
read(): OB11Config | null;
|
||||||
|
|
||||||
save(config: OB11Config): void;
|
save(config: OB11Config): void;
|
||||||
}
|
}
|
||||||
|
@@ -12,6 +12,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
AtType,
|
AtType,
|
||||||
ChatType,
|
ChatType,
|
||||||
|
ChatType2,
|
||||||
FaceIndex,
|
FaceIndex,
|
||||||
Friend,
|
Friend,
|
||||||
FriendV2,
|
FriendV2,
|
||||||
@@ -42,7 +43,7 @@ import { OB11GroupTitleEvent } from './event/notice/OB11GroupTitleEvent';
|
|||||||
import { OB11GroupCardEvent } from './event/notice/OB11GroupCardEvent';
|
import { OB11GroupCardEvent } from './event/notice/OB11GroupCardEvent';
|
||||||
import { OB11GroupDecreaseEvent } from './event/notice/OB11GroupDecreaseEvent';
|
import { OB11GroupDecreaseEvent } from './event/notice/OB11GroupDecreaseEvent';
|
||||||
import { ob11Config } from '@/onebot11/config';
|
import { ob11Config } from '@/onebot11/config';
|
||||||
import { deleteGroup, getGroupMember, groupMembers, selfInfo, tempGroupCodeMap } from '@/core/data';
|
import { deleteGroup, getGroupMember, groupMembers, selfInfo } from '@/core/data';
|
||||||
import { NTQQFileApi, NTQQGroupApi, NTQQMsgApi, NTQQUserApi } from '@/core/apis';
|
import { NTQQFileApi, NTQQGroupApi, NTQQMsgApi, NTQQUserApi } from '@/core/apis';
|
||||||
import { OB11GroupMsgEmojiLikeEvent } from '@/onebot11/event/notice/OB11MsgEmojiLikeEvent';
|
import { OB11GroupMsgEmojiLikeEvent } from '@/onebot11/event/notice/OB11MsgEmojiLikeEvent';
|
||||||
import { OB11FriendPokeEvent, OB11GroupPokeEvent } from './event/notice/OB11PokeEvent';
|
import { OB11FriendPokeEvent, OB11GroupPokeEvent } from './event/notice/OB11PokeEvent';
|
||||||
@@ -96,11 +97,15 @@ export class OB11Constructor {
|
|||||||
//const user = await NTQQUserApi.getUserDetailInfoByUin(msg.senderUin!);
|
//const user = await NTQQUserApi.getUserDetailInfoByUin(msg.senderUin!);
|
||||||
//resMsg.sender.nickname = user.info.nick;
|
//resMsg.sender.nickname = user.info.nick;
|
||||||
}
|
}
|
||||||
else if (msg.chatType == ChatType.temp) {
|
else if (msg.chatType as unknown as ChatType2 == ChatType2.KCHATTYPETEMPC2CFROMGROUP) {
|
||||||
resMsg.sub_type = 'group';
|
resMsg.sub_type = 'group';
|
||||||
const tempGroupCode = tempGroupCodeMap[msg.peerUin];
|
let ret = await NTQQMsgApi.getTempChatInfo(ChatType2.KCHATTYPETEMPC2CFROMGROUP, msg.senderUid);
|
||||||
if (tempGroupCode) {
|
if (ret.result === 0) {
|
||||||
resMsg.group_id = parseInt(tempGroupCode);
|
resMsg.group_id = parseInt(ret.tmpChatInfo!.groupCode);
|
||||||
|
resMsg.sender.nickname = ret.tmpChatInfo!.fromNick;
|
||||||
|
} else {
|
||||||
|
resMsg.group_id = 284840486;//兜底数据
|
||||||
|
resMsg.sender.nickname = "临时会话";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const element of msg.elements) {
|
for (const element of msg.elements) {
|
||||||
@@ -223,16 +228,18 @@ export class OB11Constructor {
|
|||||||
const videoElement: VideoElement = element.videoElement;
|
const videoElement: VideoElement = element.videoElement;
|
||||||
//读取视频链接并兜底
|
//读取视频链接并兜底
|
||||||
let videoUrl;//Array
|
let videoUrl;//Array
|
||||||
if (msg.peerUin = '284840486') {
|
let peer:Peer = {
|
||||||
|
chatType: msg.chatType,
|
||||||
|
peerUid: msg.peerUid,
|
||||||
|
guildId: '0'
|
||||||
|
};
|
||||||
|
if (msg.peerUin == '284840486') {
|
||||||
|
peer = msg.parentMsgPeer;
|
||||||
//合并消息内部 应该进行特殊处理 可能需要重写peer 待测试与研究 Mlikiowa Taged TODO
|
//合并消息内部 应该进行特殊处理 可能需要重写peer 待测试与研究 Mlikiowa Taged TODO
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|
||||||
videoUrl = await NTQQFileApi.getVideoUrl({
|
videoUrl = await NTQQFileApi.getVideoUrl(peer, msg.msgId, element.elementId);
|
||||||
chatType: msg.chatType,
|
|
||||||
peerUid: msg.peerUid,
|
|
||||||
guildId: '0'
|
|
||||||
}, msg.msgId, element.elementId);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
videoUrl = undefined;
|
videoUrl = undefined;
|
||||||
}
|
}
|
||||||
@@ -340,17 +347,17 @@ export class OB11Constructor {
|
|||||||
msg.parentMsgIdList.push(msg.msgId);
|
msg.parentMsgIdList.push(msg.msgId);
|
||||||
//let parentMsgId = msg.parentMsgIdList[msg.parentMsgIdList.length - 2 < 0 ? 0 : msg.parentMsgIdList.length - 2];
|
//let parentMsgId = msg.parentMsgIdList[msg.parentMsgIdList.length - 2 < 0 ? 0 : msg.parentMsgIdList.length - 2];
|
||||||
//加入自身MsgId
|
//加入自身MsgId
|
||||||
let MultiMsgs = (await NTQQMsgApi.getMultiMsg(ParentMsgPeer, msg.parentMsgIdList[0], msg.msgId))?.msgList;
|
const MultiMsgs = (await NTQQMsgApi.getMultiMsg(ParentMsgPeer, msg.parentMsgIdList[0], msg.msgId))?.msgList;
|
||||||
//拉取下级消息
|
//拉取下级消息
|
||||||
if (!MultiMsgs) continue;
|
if (!MultiMsgs) continue;
|
||||||
//拉取失败则跳过
|
//拉取失败则跳过
|
||||||
message_data['data']['content'] = [];
|
message_data['data']['content'] = [];
|
||||||
for (let MultiMsg of MultiMsgs) {
|
for (const MultiMsg of MultiMsgs) {
|
||||||
//对每条拉取的消息传递ParentMsgPeer修正Peer
|
//对每条拉取的消息传递ParentMsgPeer修正Peer
|
||||||
MultiMsg.parentMsgPeer = ParentMsgPeer;
|
MultiMsg.parentMsgPeer = ParentMsgPeer;
|
||||||
MultiMsg.parentMsgIdList = msg.parentMsgIdList;
|
MultiMsg.parentMsgIdList = msg.parentMsgIdList;
|
||||||
MultiMsg.id = MessageUnique.createMsg(ParentMsgPeer, MultiMsg.msgId);//该ID仅用查看 无法调用
|
MultiMsg.id = MessageUnique.createMsg(ParentMsgPeer, MultiMsg.msgId);//该ID仅用查看 无法调用
|
||||||
let msgList = await OB11Constructor.message(MultiMsg);
|
const msgList = await OB11Constructor.message(MultiMsg);
|
||||||
message_data['data']['content'].push(msgList);
|
message_data['data']['content'].push(msgList);
|
||||||
//console.log("合并消息", msgList);
|
//console.log("合并消息", msgList);
|
||||||
}
|
}
|
||||||
|
@@ -2,5 +2,5 @@ import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
|
|||||||
|
|
||||||
export class OB11GroupAdminNoticeEvent extends OB11GroupNoticeEvent {
|
export class OB11GroupAdminNoticeEvent extends OB11GroupNoticeEvent {
|
||||||
notice_type = 'group_admin';
|
notice_type = 'group_admin';
|
||||||
sub_type: 'set' | 'unset' = "set"; // "set" | "unset"
|
sub_type: 'set' | 'unset' = 'set'; // "set" | "unset"
|
||||||
}
|
}
|
@@ -3,13 +3,13 @@ import { OB11BaseNoticeEvent } from './OB11BaseNoticeEvent';
|
|||||||
export class OB11InputStatusEvent extends OB11BaseNoticeEvent {
|
export class OB11InputStatusEvent extends OB11BaseNoticeEvent {
|
||||||
notice_type = 'notify';
|
notice_type = 'notify';
|
||||||
sub_type = 'input_status';
|
sub_type = 'input_status';
|
||||||
status_text = "对方正在输入..."
|
status_text = '对方正在输入...';
|
||||||
eventType = 1;
|
event_type = 1;
|
||||||
user_id = 0;
|
user_id = 0;
|
||||||
constructor(user_id: number, eventType: number, status_text: string) {
|
constructor(user_id: number, eventType: number, status_text: string) {
|
||||||
super();
|
super();
|
||||||
this.user_id = user_id;
|
this.user_id = user_id;
|
||||||
this.eventType = eventType;
|
this.event_type = eventType;
|
||||||
this.status_text = status_text;
|
this.status_text = status_text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -26,7 +26,7 @@ export async function logMessage(ob11Message: OB11Message) {
|
|||||||
if (ob11Message.message_type === 'group') {
|
if (ob11Message.message_type === 'group') {
|
||||||
if (ob11Message.group_id == 284840486) {
|
if (ob11Message.group_id == 284840486) {
|
||||||
group = await getGroup(ob11Message.group_id!);
|
group = await getGroup(ob11Message.group_id!);
|
||||||
prefix += `转发消息[外部来源] `;
|
prefix += '转发消息[外部来源] ';
|
||||||
} else {
|
} else {
|
||||||
group = await getGroup(ob11Message.group_id!);
|
group = await getGroup(ob11Message.group_id!);
|
||||||
prefix += `群[${group?.groupName}(${ob11Message.group_id})] `;
|
prefix += `群[${group?.groupName}(${ob11Message.group_id})] `;
|
||||||
|
@@ -19,7 +19,7 @@ import { OB11Config, ob11Config } from '@/onebot11/config';
|
|||||||
import { httpHeart, ob11HTTPServer } from '@/onebot11/server/http';
|
import { httpHeart, ob11HTTPServer } from '@/onebot11/server/http';
|
||||||
import { ob11WebsocketServer } from '@/onebot11/server/ws/WebsocketServer';
|
import { ob11WebsocketServer } from '@/onebot11/server/ws/WebsocketServer';
|
||||||
import { ob11ReverseWebsockets } from '@/onebot11/server/ws/ReverseWebsocket';
|
import { ob11ReverseWebsockets } from '@/onebot11/server/ws/ReverseWebsocket';
|
||||||
import { getGroup, getGroupMember, groupMembers, selfInfo, tempGroupCodeMap } from '@/core/data';
|
import { getGroup, getGroupMember, groupMembers, selfInfo } from '@/core/data';
|
||||||
import { BuddyListener, GroupListener, NodeIKernelBuddyListener } from '@/core/listeners';
|
import { BuddyListener, GroupListener, NodeIKernelBuddyListener } from '@/core/listeners';
|
||||||
import { OB11FriendRequestEvent } from '@/onebot11/event/request/OB11FriendRequest';
|
import { OB11FriendRequestEvent } from '@/onebot11/event/request/OB11FriendRequest';
|
||||||
import { NTQQGroupApi, NTQQUserApi, WebApi } from '@/core/apis';
|
import { NTQQGroupApi, NTQQUserApi, WebApi } from '@/core/apis';
|
||||||
@@ -104,10 +104,10 @@ export class NapCatOnebot11 {
|
|||||||
toUin: string;
|
toUin: string;
|
||||||
}
|
}
|
||||||
) => {
|
) => {
|
||||||
let uin = await NTQQUserApi.getUinByUid(data.fromUin);
|
const uin = await NTQQUserApi.getUinByUid(data.fromUin);
|
||||||
logNotice(`[输入状态] ${uin} ${data.statusText}`);
|
logNotice(`[输入状态] ${uin} ${data.statusText}`);
|
||||||
postOB11Event(new OB11InputStatusEvent(parseInt(uin), data.eventType, data.statusText));
|
postOB11Event(new OB11InputStatusEvent(parseInt(uin), data.eventType, data.statusText));
|
||||||
}
|
};
|
||||||
msgListener.onRecvSysMsg = async (protobufData: number[]) => {
|
msgListener.onRecvSysMsg = async (protobufData: number[]) => {
|
||||||
// function buf2hex(buffer: Buffer) {
|
// function buf2hex(buffer: Buffer) {
|
||||||
// return [...new Uint8Array(buffer)]
|
// return [...new Uint8Array(buffer)]
|
||||||
@@ -222,9 +222,9 @@ export class NapCatOnebot11 {
|
|||||||
selfInfo.online = false;
|
selfInfo.online = false;
|
||||||
};
|
};
|
||||||
msgListener.onTempChatInfoUpdate = (tempChatInfo: TempOnRecvParams) => {
|
msgListener.onTempChatInfoUpdate = (tempChatInfo: TempOnRecvParams) => {
|
||||||
if (tempChatInfo.sessionType == 1 && tempChatInfo.chatType == ChatType.temp) {
|
// if (tempChatInfo.sessionType == 1 && tempChatInfo.chatType == ChatType.temp) {
|
||||||
tempGroupCodeMap[tempChatInfo.peerUid] = tempChatInfo.groupCode;
|
// tempGroupCodeMap[tempChatInfo.peerUid] = tempChatInfo.groupCode;
|
||||||
}
|
// }
|
||||||
// 临时会话更新 tempGroupCodeMap uid -> source/GroupCode
|
// 临时会话更新 tempGroupCodeMap uid -> source/GroupCode
|
||||||
};
|
};
|
||||||
msgListener.onRecvMsg = async (msg) => {
|
msgListener.onRecvMsg = async (msg) => {
|
||||||
|
@@ -1 +1 @@
|
|||||||
export const version = '1.8.3';
|
export const version = '1.8.6';
|
||||||
|
@@ -29,7 +29,7 @@ async function onSettingWindowCreated(view: Element) {
|
|||||||
SettingItem(
|
SettingItem(
|
||||||
'<span id="napcat-update-title">Napcat</span>',
|
'<span id="napcat-update-title">Napcat</span>',
|
||||||
undefined,
|
undefined,
|
||||||
SettingButton('V1.8.3', 'napcat-update-button', 'secondary')
|
SettingButton('V1.8.6', 'napcat-update-button', 'secondary')
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
SettingList([
|
SettingList([
|
||||||
|
@@ -163,7 +163,7 @@ async function onSettingWindowCreated(view) {
|
|||||||
SettingItem(
|
SettingItem(
|
||||||
'<span id="napcat-update-title">Napcat</span>',
|
'<span id="napcat-update-title">Napcat</span>',
|
||||||
void 0,
|
void 0,
|
||||||
SettingButton("V1.8.3", "napcat-update-button", "secondary")
|
SettingButton("V1.8.6", "napcat-update-button", "secondary")
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
SettingList([
|
SettingList([
|
||||||
|
Reference in New Issue
Block a user