mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
Compare commits
79 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
d7e8c82624 | ||
![]() |
5affbdebb9 | ||
![]() |
aee36e7ca3 | ||
![]() |
d8a9633a00 | ||
![]() |
6c66a0116a | ||
![]() |
ba0108fe50 | ||
![]() |
5a7d31c411 | ||
![]() |
9959359c21 | ||
![]() |
9453b71943 | ||
![]() |
0fb30df1bc | ||
![]() |
62e23614fb | ||
![]() |
5514bf0bb8 | ||
![]() |
f5d093cc45 | ||
![]() |
44c6debd01 | ||
![]() |
2c1d12e04b | ||
![]() |
110193ea15 | ||
![]() |
fafcf058b1 | ||
![]() |
825c7c8e29 | ||
![]() |
c8d5eebe5d | ||
![]() |
466a3e4d66 | ||
![]() |
f6263375f1 | ||
![]() |
f79581d97e | ||
![]() |
56f26e9aa8 | ||
![]() |
9e03071629 | ||
![]() |
1f02c98c8f | ||
![]() |
e1e5c278b9 | ||
![]() |
104839f7ea | ||
![]() |
bb8771a5b4 | ||
![]() |
4a2523463b | ||
![]() |
a23a99310a | ||
![]() |
5c5105ce88 | ||
![]() |
1bf5e41bdc | ||
![]() |
cd679cc041 | ||
![]() |
eabee466bb | ||
![]() |
d3f93257ce | ||
![]() |
33f340ca81 | ||
![]() |
0d27ef7ebc | ||
![]() |
479e8c9d25 | ||
![]() |
e3dffa24f8 | ||
![]() |
30b8793ee1 | ||
![]() |
edf7a97269 | ||
![]() |
66335ddf9b | ||
![]() |
70b3005005 | ||
![]() |
ac5fe4d275 | ||
![]() |
4aadcd5288 | ||
![]() |
2f74de667e | ||
![]() |
8b89fd7a0b | ||
![]() |
8239e9a243 | ||
![]() |
951afea794 | ||
![]() |
a4beeba528 | ||
![]() |
9b32140f87 | ||
![]() |
e10a67ce05 | ||
![]() |
e07c06f3e9 | ||
![]() |
0d8d3ac24f | ||
![]() |
9d0f9e7096 | ||
![]() |
e988908784 | ||
![]() |
b40c81c5cb | ||
![]() |
457ffc0922 | ||
![]() |
41822eb052 | ||
![]() |
0bc6e23343 | ||
![]() |
9ec09c6eee | ||
![]() |
0876e4645f | ||
![]() |
36d990e328 | ||
![]() |
d5875c9e5b | ||
![]() |
a58fb31f8e | ||
![]() |
f9270c38cf | ||
![]() |
e5ab6134cd | ||
![]() |
24f09d485e | ||
![]() |
f400d43b8a | ||
![]() |
1c6364d98f | ||
![]() |
ac07c98ae1 | ||
![]() |
6c66dab3dc | ||
![]() |
936b1d911c | ||
![]() |
1876dd29ac | ||
![]() |
64c5eb6c04 | ||
![]() |
476d498e44 | ||
![]() |
b03bcf9a7c | ||
![]() |
9284fc7e8a | ||
![]() |
1d63473a04 |
354
LICENSE
354
LICENSE
@ -1,25 +1,339 @@
|
||||
MIT Without Public Social Media Promotion License
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (c) 2024 LLOneBot
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
Preamble
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
You may use this software in accordance with the above terms, but you are not
|
||||
allowed to promote this project or your projects based on this project on any
|
||||
public social media.
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
|
343
NapCatQQ-LICENSE
Normal file
343
NapCatQQ-LICENSE
Normal file
@ -0,0 +1,343 @@
|
||||
GNU GENERAL PUBLIC Without Social media promotion LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
d)You may use this software in accordance with the above terms,
|
||||
but you are not allowed to promote this project or your projects
|
||||
based on this project on any public social media.
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
@ -23,9 +23,13 @@ TG 群:<https://t.me/+nLZEnpne-pQ1OWFl>
|
||||
|
||||
[](https://starchart.cc/LLOneBot/LLOneBot)
|
||||
|
||||
## 贡献者
|
||||
|
||||
[](https://github.com/LOneBot/LLOneBot/graphs/contributors)
|
||||
|
||||
## 鸣谢
|
||||
|
||||
- [NapCatQQ](https://github.com/NapNeko/NapCatQQ)
|
||||
- [NapCatQQ](https://github.com/NapNeko/NapCatQQ),依照开源协议参考了其部分代码
|
||||
- [LiteLoaderQQNT](https://liteloaderqqnt.github.io/guide/install.html)
|
||||
- [Chronocat](https://github.com/chrononeko/chronocat)
|
||||
- [koishi-plugin-adapter-onebot](https://github.com/koishijs/koishi-plugin-adapter-onebot)
|
||||
|
@ -39,6 +39,7 @@ const config: ElectronViteConfig = {
|
||||
...external.map(genCpModule),
|
||||
{ src: './manifest.json', dest: 'dist' },
|
||||
{ src: './icon.webp', dest: 'dist' },
|
||||
// { src: './src/ntqqapi/native/napcat-protocol-packet/Moehoo/*', dest: 'dist/main/Moehoo' },
|
||||
],
|
||||
}),
|
||||
],
|
||||
|
@ -4,7 +4,7 @@
|
||||
"name": "LLOneBot",
|
||||
"slug": "LLOneBot",
|
||||
"description": "实现 OneBot 11 和 Satori 协议,用于 QQ 机器人开发",
|
||||
"version": "4.1.3",
|
||||
"version": "4.4.1",
|
||||
"icon": "./icon.webp",
|
||||
"authors": [
|
||||
{
|
||||
@ -34,4 +34,4 @@
|
||||
"main": "./main/main.cjs",
|
||||
"preload": "./preload/preload.cjs"
|
||||
}
|
||||
}
|
||||
}
|
@ -26,7 +26,7 @@
|
||||
"cosmokit": "^1.6.3",
|
||||
"express": "^5.0.1",
|
||||
"fluent-ffmpeg": "^2.1.3",
|
||||
"minato": "^3.6.0",
|
||||
"minato": "^3.6.1",
|
||||
"protobufjs": "^7.4.0",
|
||||
"silk-wasm": "^3.6.3",
|
||||
"ts-case-convert": "^2.1.0",
|
||||
@ -35,14 +35,14 @@
|
||||
"devDependencies": {
|
||||
"@types/cors": "^2.8.17",
|
||||
"@types/express": "^5.0.0",
|
||||
"@types/fluent-ffmpeg": "^2.1.26",
|
||||
"@types/fluent-ffmpeg": "^2.1.27",
|
||||
"@types/node": "^20.14.15",
|
||||
"@types/ws": "^8.5.12",
|
||||
"@types/ws": "^8.5.13",
|
||||
"electron": "^31.4.0",
|
||||
"electron-vite": "^2.3.0",
|
||||
"protobufjs-cli": "^1.1.3",
|
||||
"typescript": "^5.6.3",
|
||||
"vite": "^5.4.10 ",
|
||||
"vite": "^5.4.10",
|
||||
"vite-plugin-cp": "^4.0.8"
|
||||
},
|
||||
"packageManager": "yarn@4.5.1"
|
||||
|
@ -13,6 +13,10 @@ const manifest = {
|
||||
{
|
||||
name: 'linyuchen',
|
||||
link: 'https://github.com/linyuchen'
|
||||
},
|
||||
{
|
||||
"name": "idranme",
|
||||
"link": "https://github.com/idranme"
|
||||
}
|
||||
],
|
||||
repository: {
|
||||
|
@ -27,9 +27,10 @@ export function checkFileReceived(path: string, timeout: number = 3000): Promise
|
||||
|
||||
export function calculateFileMD5(filePath: string): Promise<string> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const hash = createHash('md5')
|
||||
|
||||
// 创建一个流式读取器
|
||||
const stream = fs.createReadStream(filePath)
|
||||
const hash = createHash('md5')
|
||||
|
||||
stream.on('data', (data: Buffer) => {
|
||||
// 当读取到数据时,更新哈希对象的状态
|
||||
@ -122,8 +123,7 @@ export async function uri2local(ctx: Context, uri: string, needExt?: boolean): P
|
||||
const { type } = checkUriType(uri)
|
||||
|
||||
if (type === FileUriType.FileURL) {
|
||||
const fileUri = uri.replace('%', '%25').replace('#', '%23')
|
||||
const filePath = fileURLToPath(fileUri)
|
||||
const filePath = fileURLToPath(uri)
|
||||
const fileName = path.basename(filePath)
|
||||
// console.log('fileURLToPath', filePath)
|
||||
// console.log('fileName', fileName)
|
||||
|
9
src/common/utils/window.ts
Normal file
9
src/common/utils/window.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import { BrowserWindow } from 'electron'
|
||||
import { log } from '@/common/utils'
|
||||
|
||||
export function getAllWindowIds(): number[] {
|
||||
const allWindows = BrowserWindow.getAllWindows();
|
||||
const ids = allWindows.map(window => window.id);
|
||||
log('getAllWindowIds', ids);
|
||||
return ids;
|
||||
}
|
@ -35,6 +35,7 @@ import {
|
||||
NTQQWindowApi
|
||||
} from '../ntqqapi/api'
|
||||
import { existsSync, mkdirSync } from 'node:fs'
|
||||
import { NTQQSystemApi } from '@/ntqqapi/api/system'
|
||||
|
||||
declare module 'cordis' {
|
||||
interface Events {
|
||||
@ -74,6 +75,7 @@ function onLoad() {
|
||||
ctx.plugin(NTQQWebApi)
|
||||
ctx.plugin(NTQQWindowApi)
|
||||
ctx.plugin(Database)
|
||||
ctx.plugin(NTQQSystemApi)
|
||||
|
||||
let started = false
|
||||
|
||||
@ -180,7 +182,6 @@ function onLoad() {
|
||||
if (self.uin) {
|
||||
clearInterval(intervalId)
|
||||
log('process pid', process.pid)
|
||||
|
||||
const config = getConfigUtil().getConfig()
|
||||
|
||||
if (config.enableLLOB && (config.satori.enable || config.ob11.enable)) {
|
||||
@ -191,7 +192,6 @@ function onLoad() {
|
||||
log('LLOneBot 开关设置为关闭,不启动 LLOneBot')
|
||||
return
|
||||
}
|
||||
|
||||
ctx.plugin(Log, {
|
||||
enable: config.log!,
|
||||
filename: logFileName
|
||||
@ -230,6 +230,9 @@ function onLoad() {
|
||||
|
||||
// 创建窗口时触发
|
||||
function onBrowserWindowCreated(window: BrowserWindow) {
|
||||
if (window.id === 2) {
|
||||
mainWindow = window
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -107,7 +107,7 @@ export class NTQQFriendApi extends Service {
|
||||
return ret.arkMsg
|
||||
}
|
||||
|
||||
async setBuddyRemark(uid: string, remark: string) {
|
||||
async setBuddyRemark(uid: string, remark = '') {
|
||||
return await invoke('nodeIKernelBuddyService/setBuddyRemark', [{
|
||||
remarkParams: { uid, remark }
|
||||
}])
|
||||
@ -122,4 +122,8 @@ export class NTQQFriendApi extends Service {
|
||||
}
|
||||
}])
|
||||
}
|
||||
|
||||
async setBuddyCategory(uid: string, categoryId: number) {
|
||||
return await invoke('nodeIKernelBuddyService/setBuddyCategory', [{ uid, categoryId }])
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,8 @@ import {
|
||||
PublishGroupBulletinReq,
|
||||
GroupAllInfo,
|
||||
GroupFileInfo,
|
||||
GroupBulletinListResult
|
||||
GroupBulletinListResult,
|
||||
GroupMsgMask
|
||||
} from '../types'
|
||||
import { invoke, NTClass, NTMethod } from '../ntcall'
|
||||
import { GeneralCallResult } from '../services'
|
||||
@ -341,4 +342,12 @@ export class NTQQGroupApi extends Service {
|
||||
[{ groupId }]
|
||||
)
|
||||
}
|
||||
|
||||
async setGroupMsgMask(groupCode: string, msgMask: GroupMsgMask) {
|
||||
return await invoke('nodeIKernelGroupService/setGroupMsgMask', [{ groupCode, msgMask }])
|
||||
}
|
||||
|
||||
async setGroupRemark(groupCode: string, groupRemark = '') {
|
||||
return await invoke('nodeIKernelGroupService/modifyGroupRemark', [{ groupCode, groupRemark }])
|
||||
}
|
||||
}
|
||||
|
38
src/ntqqapi/api/system.ts
Normal file
38
src/ntqqapi/api/system.ts
Normal file
@ -0,0 +1,38 @@
|
||||
import { Context, Service } from 'cordis'
|
||||
import { invoke, NTClass } from '@/ntqqapi/ntcall'
|
||||
|
||||
declare module 'cordis' {
|
||||
interface Context {
|
||||
ntSystemApi: NTQQSystemApi
|
||||
}
|
||||
}
|
||||
|
||||
export class NTQQSystemApi extends Service {
|
||||
constructor(protected ctx: Context) {
|
||||
super(ctx, 'ntSystemApi', true)
|
||||
}
|
||||
|
||||
async restart() {
|
||||
// todo: 调用此接口后会将 NTQQ 设置里面的自动登录和无需手机确认打开,重启后将状态恢复到之前的状态
|
||||
|
||||
// 设置自动登录
|
||||
await this.setSettingAutoLogin(true)
|
||||
// 退出账号
|
||||
invoke('quitAccount', [], {
|
||||
className: NTClass.BUSINESS_API
|
||||
}).then()
|
||||
invoke('notifyQQClose', [{ type: 1 }], { className: NTClass.QQ_EX_API }).then()
|
||||
// 等待登录界面,模拟点击登录按钮?还是直接调用登录方法?
|
||||
}
|
||||
|
||||
async getSettingAutoLogin() {
|
||||
// 查询是否自动登录
|
||||
return invoke('nodeIKernelNodeMiscService/queryAutoRun', [])
|
||||
}
|
||||
|
||||
async setSettingAutoLogin(state: boolean) {
|
||||
await invoke('nodeIKernelSettingService/setNeedConfirmSwitch', [{ state: 1 }]) // 1:不需要手机确认,2:需要手机确认
|
||||
|
||||
await invoke('nodeIKernelSettingService/setAutoLoginSwitch', [{ state }])
|
||||
}
|
||||
}
|
@ -19,7 +19,7 @@ import {
|
||||
import { selfInfo } from '../common/globalVars'
|
||||
import { version } from '../version'
|
||||
import { invoke } from './ntcall'
|
||||
import { Native } from './native/index'
|
||||
import { Native } from './native/crychic'
|
||||
|
||||
declare module 'cordis' {
|
||||
interface Context {
|
||||
|
@ -2,6 +2,7 @@ import { NTMethod } from './ntcall'
|
||||
import { log } from '@/common/utils'
|
||||
import { randomUUID } from 'node:crypto'
|
||||
import { ipcMain } from 'electron'
|
||||
import { Dict } from 'cosmokit'
|
||||
|
||||
export const hookApiCallbacks: Record<string, (res: any) => void> = {}
|
||||
|
||||
@ -40,30 +41,31 @@ const callHooks: Array<{
|
||||
}> = []
|
||||
|
||||
export function startHook() {
|
||||
log('start hook')
|
||||
|
||||
const senderExclude = Symbol()
|
||||
|
||||
ipcMain.emit = new Proxy(ipcMain.emit, {
|
||||
apply(target, thisArg, args: [eventName: string, ...args: any]) {
|
||||
if (args[2]?.eventName.startsWith('ns-LoggerApi')) {
|
||||
apply(target, thisArg, args: [channel: string, ...args: any]) {
|
||||
if (args[2]?.eventName?.startsWith('ns-LoggerApi')) {
|
||||
return target.apply(thisArg, args)
|
||||
}
|
||||
if (logHook) {
|
||||
log('request', args)
|
||||
}
|
||||
|
||||
const event = args[1]
|
||||
if (event.sender && !event.sender[senderExclude]) {
|
||||
event.sender[senderExclude] = true
|
||||
event.sender.send = new Proxy(event.sender.send, {
|
||||
apply(target, thisArg, args: any[]) {
|
||||
if (args[1].eventName?.startsWith('ns-LoggerApi')) {
|
||||
apply(target, thisArg, args: [channel: string, meta: Dict, data: Dict[]]) {
|
||||
if (args[1]?.eventName?.startsWith('ns-LoggerApi')) {
|
||||
return target.apply(thisArg, args)
|
||||
}
|
||||
if (logHook) {
|
||||
log('received', args)
|
||||
}
|
||||
|
||||
const callbackId = args[1].callbackId
|
||||
const callbackId = args[1]?.callbackId
|
||||
if (callbackId) {
|
||||
if (hookApiCallbacks[callbackId]) {
|
||||
Promise.resolve(hookApiCallbacks[callbackId](args[2]))
|
||||
@ -95,7 +97,7 @@ export function startHook() {
|
||||
}
|
||||
}
|
||||
return target.apply(thisArg, args)
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { Context } from 'cordis'
|
||||
import { Dict } from 'cosmokit'
|
||||
import { getBuildVersion } from '@/common/utils/misc'
|
||||
import { TEMP_DIR } from '@/common/globalVars'
|
||||
import { getBuildVersion } from '../../../common/utils/misc'
|
||||
import { TEMP_DIR } from '../../../common/globalVars'
|
||||
import { copyFile } from 'fs/promises'
|
||||
import { ChatType, Peer } from '../types'
|
||||
import { ChatType, Peer } from '../../types'
|
||||
import path from 'node:path'
|
||||
import addon from './external/crychic-win32-x64.node?asset'
|
||||
|
||||
@ -11,7 +11,7 @@ export class Native {
|
||||
public activated = false
|
||||
private crychic?: Dict
|
||||
private seq = 0
|
||||
private cb: Map<number, Function> = new Map()
|
||||
private cb: Map<number, (res: any) => void> = new Map()
|
||||
|
||||
constructor(private ctx: Context) {
|
||||
ctx.on('ready', () => {
|
@ -1,6 +1,6 @@
|
||||
import { ipcMain } from 'electron'
|
||||
import { hookApiCallbacks, registerReceiveHook, removeReceiveHook } from './hook'
|
||||
import { getBuildVersion, log } from '../common/utils'
|
||||
import { log } from '../common/utils'
|
||||
import { randomUUID } from 'node:crypto'
|
||||
import {
|
||||
GeneralCallResult,
|
||||
@ -29,7 +29,8 @@ export enum NTClass {
|
||||
SKEY_API = 'ns-SkeyApi',
|
||||
GROUP_HOME_WORK = 'ns-GroupHomeWork',
|
||||
GROUP_ESSENCE = 'ns-GroupEssence',
|
||||
NODE_STORE_API = 'ns-NodeStoreApi'
|
||||
NODE_STORE_API = 'ns-NodeStoreApi',
|
||||
QQ_EX_API = 'ns-QQEXApi',
|
||||
}
|
||||
|
||||
export enum NTMethod {
|
||||
@ -108,13 +109,26 @@ interface InvokeOptions<ReturnType> {
|
||||
timeout?: number
|
||||
}
|
||||
|
||||
let channel: NTChannel
|
||||
|
||||
function getChannel() {
|
||||
if (channel) {
|
||||
return channel
|
||||
}
|
||||
if (ipcMain.eventNames().includes(NTChannel.IPC_UP_2)) {
|
||||
return channel = NTChannel.IPC_UP_2
|
||||
} else {
|
||||
return channel = NTChannel.IPC_UP_3
|
||||
}
|
||||
}
|
||||
|
||||
export function invoke<
|
||||
R extends Awaited<ReturnType<Extract<NTService[S][M], (...args: any) => unknown>>>,
|
||||
S extends keyof NTService = any,
|
||||
M extends keyof NTService[S] & string = any
|
||||
>(method: Extract<unknown, `${S}/${M}`> | string, args: unknown[], options: InvokeOptions<R> = {}) {
|
||||
const className = options.className ?? NTClass.NT_API
|
||||
const channel = options.channel ?? getBuildVersion() >= 28788 ? NTChannel.IPC_UP_3 : NTChannel.IPC_UP_2
|
||||
const channel = options.channel ?? getChannel()
|
||||
const timeout = options.timeout ?? 5000
|
||||
const afterFirstCmd = options.afterFirstCmd ?? true
|
||||
let eventName = className + '-' + channel[channel.length - 1]
|
||||
|
@ -13,7 +13,7 @@ export interface NodeIKernelBuddyService {
|
||||
}[]
|
||||
}>
|
||||
|
||||
setBuddyRemark(arg: unknown): void
|
||||
setBuddyRemark(arg: unknown): Promise<GeneralCallResult>
|
||||
|
||||
isBuddy(uid: string): boolean
|
||||
|
||||
|
@ -12,4 +12,6 @@ export interface NodeIKernelNodeMiscService {
|
||||
score: ''
|
||||
}[]
|
||||
}>
|
||||
|
||||
queryAutoRun(): Promise<boolean>
|
||||
}
|
||||
|
@ -1,10 +1,3 @@
|
||||
export enum GroupListUpdateType {
|
||||
REFRESHALL,
|
||||
GETALL,
|
||||
MODIFIED,
|
||||
REMOVE
|
||||
}
|
||||
|
||||
export interface Group {
|
||||
groupCode: string
|
||||
maxMember: number
|
||||
@ -188,3 +181,10 @@ export interface GroupBulletinListResult {
|
||||
nextIndex: number
|
||||
jointime: string
|
||||
}
|
||||
|
||||
export enum GroupMsgMask {
|
||||
AllowNotify = 1, // 允许提醒
|
||||
AllowNotNotify = 4, // 接受消息不提醒
|
||||
BoxNotNotify = 2, // 收进群助手不提醒
|
||||
NotAllow = 3, // 屏蔽
|
||||
}
|
||||
|
@ -442,6 +442,7 @@ export interface RawMessage {
|
||||
attrType: number
|
||||
attrId: string
|
||||
}>
|
||||
isOnlineMsg: boolean
|
||||
}
|
||||
|
||||
export interface Peer {
|
||||
|
@ -12,6 +12,7 @@ interface Payload {
|
||||
interface Response extends OB11User {
|
||||
reg_time: number
|
||||
long_nick: string
|
||||
city: string
|
||||
}
|
||||
|
||||
export class GetStrangerInfo extends BaseAction<Payload, Response> {
|
||||
@ -33,7 +34,8 @@ export class GetStrangerInfo extends BaseAction<Payload, Response> {
|
||||
level: data.detail.commonExt.qqLevel && calcQQLevel(data.detail.commonExt.qqLevel) || 0,
|
||||
login_days: 0,
|
||||
reg_time: data.detail.commonExt.regTime,
|
||||
long_nick: data.detail.simpleInfo.baseInfo.longNick
|
||||
long_nick: data.detail.simpleInfo.baseInfo.longNick,
|
||||
city: data.detail.commonExt.city
|
||||
}
|
||||
} else {
|
||||
const data = await this.ctx.ntUserApi.getUserDetailInfoByUin(uin)
|
||||
@ -46,7 +48,8 @@ export class GetStrangerInfo extends BaseAction<Payload, Response> {
|
||||
level: data.info.qqLevel && calcQQLevel(data.info.qqLevel) || 0,
|
||||
login_days: 0,
|
||||
reg_time: data.info.regTime,
|
||||
long_nick: data.info.longNick
|
||||
long_nick: data.info.longNick,
|
||||
city: data.info.city
|
||||
}
|
||||
}
|
||||
}
|
||||
|
19
src/onebot11/action/go-cqhttp/SendGroupSign.ts
Normal file
19
src/onebot11/action/go-cqhttp/SendGroupSign.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { BaseAction, Schema } from '../BaseAction'
|
||||
import { ActionName } from '../types'
|
||||
import { selfInfo } from '@/common/globalVars'
|
||||
|
||||
interface Payload {
|
||||
group_id: number | string
|
||||
}
|
||||
|
||||
export class SendGroupSign extends BaseAction<Payload, null> {
|
||||
actionName = ActionName.GoCQHTTP_SendGroupSign
|
||||
payloadSchema = Schema.object({
|
||||
group_id: Schema.union([Number, String]).required(),
|
||||
})
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
throw new Error('暂未实现群签到功能')
|
||||
return null
|
||||
}
|
||||
}
|
30
src/onebot11/action/go-cqhttp/SetGroupSpecialTitle.ts
Normal file
30
src/onebot11/action/go-cqhttp/SetGroupSpecialTitle.ts
Normal file
@ -0,0 +1,30 @@
|
||||
import { BaseAction, Schema } from '../BaseAction'
|
||||
import { ActionName } from '../types'
|
||||
import { selfInfo } from '@/common/globalVars'
|
||||
import { GroupMemberRole } from '@/ntqqapi/types'
|
||||
|
||||
interface Payload {
|
||||
group_id: number | string
|
||||
user_id: number | string
|
||||
special_title?: string
|
||||
}
|
||||
|
||||
export class SetGroupSpecialTitle extends BaseAction<Payload, null> {
|
||||
actionName = ActionName.GoCQHTTP_SetGroupSpecialTitle
|
||||
payloadSchema = Schema.object({
|
||||
group_id: Schema.union([Number, String]).required(),
|
||||
user_id: Schema.union([Number, String]).required(),
|
||||
special_title: Schema.string()
|
||||
})
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
const uid = await this.ctx.ntUserApi.getUidByUin(payload.user_id.toString(), payload.group_id.toString())
|
||||
if (!uid) throw new Error(`用户${payload.user_id}的uid获取失败`)
|
||||
const self = await this.ctx.ntGroupApi.getGroupMember(payload.group_id.toString(), selfInfo.uid, false)
|
||||
if (self.role !== GroupMemberRole.Owner){
|
||||
throw new Error(`不是群${payload.group_id}的群主,无法设置群头衔`)
|
||||
}
|
||||
throw new Error('暂未实现设置群头衔功能')
|
||||
return null
|
||||
}
|
||||
}
|
@ -15,8 +15,16 @@ class GetGroupInfo extends BaseAction<Payload, OB11Group> {
|
||||
|
||||
protected async _handle(payload: Payload) {
|
||||
const groupCode = payload.group_id.toString()
|
||||
const group = (await this.ctx.ntGroupApi.getGroups()).find(e => e.groupCode === groupCode)
|
||||
let group = (await this.ctx.ntGroupApi.getGroups()).find(e => e.groupCode === groupCode)
|
||||
if (group) {
|
||||
try{
|
||||
const groupAllInfo = await this.ctx.ntGroupApi.getGroupAllInfo(groupCode)
|
||||
this.ctx.logger.info(groupAllInfo)
|
||||
return {...OB11Entities.group(group), ...groupAllInfo}
|
||||
}
|
||||
catch (e) {
|
||||
this.ctx.logger.error('获取群完整详细信息失败', e)
|
||||
}
|
||||
return OB11Entities.group(group)
|
||||
}
|
||||
throw new Error(`群${payload.group_id}不存在`)
|
||||
|
@ -78,6 +78,13 @@ import { GroupPoke } from './llonebot/GroupPoke'
|
||||
import { FriendPoke } from './llonebot/FriendPoke'
|
||||
import { GetGroupFileSystemInfo } from './go-cqhttp/GetGroupFileSystemInfo'
|
||||
import { GetCredentials } from './system/GetCredentials'
|
||||
import { SetGroupSpecialTitle } from '@/onebot11/action/go-cqhttp/SetGroupSpecialTitle'
|
||||
import { SendGroupSign } from '@/onebot11/action/go-cqhttp/SendGroupSign'
|
||||
import { SetRestart } from '@/onebot11/action/system/SetRestart'
|
||||
import { SetFriendCategory } from '@/onebot11/action/llonebot/SetFriendCategory'
|
||||
import { SetFriendRemark } from '@/onebot11/action/llonebot/SetFriendRemark'
|
||||
import { SetGroupMsgMask } from '@/onebot11/action/llonebot/SetGroupMsgMask'
|
||||
import { SetGroupRemark } from '@/onebot11/action/llonebot/SetGroupRemark'
|
||||
|
||||
export function initActionMap(adapter: Adapter) {
|
||||
const actionHandlers = [
|
||||
@ -98,6 +105,10 @@ export function initActionMap(adapter: Adapter) {
|
||||
new GetRobotUinRange(adapter),
|
||||
new GroupPoke(adapter),
|
||||
new FriendPoke(adapter),
|
||||
new SetFriendCategory(adapter),
|
||||
new SetFriendRemark(adapter),
|
||||
new SetGroupMsgMask(adapter),
|
||||
new SetGroupRemark(adapter),
|
||||
// onebot11
|
||||
new SendLike(adapter),
|
||||
new GetMsg(adapter),
|
||||
@ -131,6 +142,7 @@ export function initActionMap(adapter: Adapter) {
|
||||
new ForwardFriendSingleMsg(adapter),
|
||||
new ForwardGroupSingleMsg(adapter),
|
||||
new GetCredentials(adapter),
|
||||
new SetRestart(adapter),
|
||||
// go-cqhttp
|
||||
new GetEssenceMsgList(adapter),
|
||||
new GetGroupHonorInfo(adapter),
|
||||
@ -161,6 +173,8 @@ export function initActionMap(adapter: Adapter) {
|
||||
new DeleteFriend(adapter),
|
||||
new OCRImage(adapter),
|
||||
new GetGroupFileSystemInfo(adapter),
|
||||
new SetGroupSpecialTitle(adapter),
|
||||
new SendGroupSign(adapter),
|
||||
]
|
||||
const actionMap = new Map()
|
||||
for (const action of actionHandlers) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { BaseAction, Schema } from '../BaseAction'
|
||||
import { ActionName } from '../types'
|
||||
import { getBuildVersion } from '@/common/utils/misc'
|
||||
import { getBuildVersion } from '@/common/utils'
|
||||
|
||||
interface Payload {
|
||||
user_id: number | string
|
||||
@ -13,13 +13,13 @@ export class FriendPoke extends BaseAction<Payload, null> {
|
||||
})
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
if (!this.ctx.app.native.checkPlatform()) {
|
||||
throw new Error('当前系统平台或架构不支持')
|
||||
if (!this.ctx.app.native.checkPlatform() || !this.ctx.app.native.checkVersion()) {
|
||||
// await this.ctx.app.packet.sendPokePacket(+payload.user_id)
|
||||
throw new Error('戳一戳暂时只支持Windows QQ 27333 ~ 275970版本')
|
||||
}
|
||||
if (!this.ctx.app.native.checkVersion()) {
|
||||
throw new Error(`当前 QQ 版本 ${getBuildVersion()} 不支持,可尝试其他版本 27333—27597`)
|
||||
else{
|
||||
await this.ctx.app.native.sendFriendPoke(+payload.user_id)
|
||||
}
|
||||
await this.ctx.app.native.sendFriendPoke(+payload.user_id)
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { BaseAction, Schema } from '../BaseAction'
|
||||
import { ActionName } from '../types'
|
||||
import { getBuildVersion } from '@/common/utils/misc'
|
||||
import { getBuildVersion } from '@/common/utils'
|
||||
|
||||
interface Payload {
|
||||
group_id: number | string
|
||||
@ -15,13 +15,12 @@ export class GroupPoke extends BaseAction<Payload, null> {
|
||||
})
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
if (!this.ctx.app.native.checkPlatform()) {
|
||||
throw new Error('当前系统平台或架构不支持')
|
||||
if (!this.ctx.app.native.checkPlatform() || !this.ctx.app.native.checkVersion()) {
|
||||
throw new Error('戳一戳暂时只支持Windows QQ 27333 ~ 275970版本')
|
||||
}
|
||||
if (!this.ctx.app.native.checkVersion()) {
|
||||
throw new Error(`当前 QQ 版本 ${getBuildVersion()} 不支持,可尝试其他版本 27333—27597`)
|
||||
else{
|
||||
await this.ctx.app.native.sendGroupPoke(+payload.group_id, +payload.user_id)
|
||||
}
|
||||
await this.ctx.app.native.sendGroupPoke(+payload.group_id, +payload.user_id)
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
21
src/onebot11/action/llonebot/SetFriendCategory.ts
Normal file
21
src/onebot11/action/llonebot/SetFriendCategory.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { BaseAction, Schema } from '../BaseAction'
|
||||
import { ActionName } from '../types'
|
||||
|
||||
interface Payload {
|
||||
user_id: number | string
|
||||
category_id: number | string
|
||||
}
|
||||
|
||||
export class SetFriendCategory extends BaseAction<Payload, unknown> {
|
||||
actionName = ActionName.SetFriendCategory
|
||||
payloadSchema = Schema.object({
|
||||
user_id: Schema.union([Number, String]).required(),
|
||||
category_id: Schema.union([Number, String]).required()
|
||||
})
|
||||
|
||||
protected async _handle(payload: Payload) {
|
||||
const uid = await this.ctx.ntUserApi.getUidByUin(payload.user_id.toString())
|
||||
if (!uid) throw new Error('无法获取好友信息')
|
||||
return this.ctx.ntFriendApi.setBuddyCategory(uid, +payload.category_id)
|
||||
}
|
||||
}
|
21
src/onebot11/action/llonebot/SetFriendRemark.ts
Normal file
21
src/onebot11/action/llonebot/SetFriendRemark.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { BaseAction, Schema } from '../BaseAction'
|
||||
import { ActionName } from '../types'
|
||||
|
||||
interface Payload {
|
||||
user_id: number | string
|
||||
remark?: string
|
||||
}
|
||||
|
||||
export class SetFriendRemark extends BaseAction<Payload, unknown> {
|
||||
actionName = ActionName.SetFriendRemark
|
||||
payloadSchema = Schema.object({
|
||||
user_id: Schema.union([Number, String]).required(),
|
||||
remark: Schema.string()
|
||||
})
|
||||
|
||||
protected async _handle(payload: Payload) {
|
||||
const uid = await this.ctx.ntUserApi.getUidByUin(payload.user_id.toString())
|
||||
if (!uid) throw new Error('无法获取好友信息')
|
||||
return this.ctx.ntFriendApi.setBuddyRemark(uid, payload.remark || '')
|
||||
}
|
||||
}
|
19
src/onebot11/action/llonebot/SetGroupMsgMask.ts
Normal file
19
src/onebot11/action/llonebot/SetGroupMsgMask.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { BaseAction, Schema } from '../BaseAction'
|
||||
import { ActionName } from '../types'
|
||||
|
||||
interface Payload {
|
||||
group_id: number | string
|
||||
mask: number | string // 1, 2, 3, 4
|
||||
}
|
||||
|
||||
export class SetGroupMsgMask extends BaseAction<Payload, unknown> {
|
||||
actionName = ActionName.SetGroupMsgMask
|
||||
payloadSchema = Schema.object({
|
||||
group_id: Schema.union([Number, String]).required(),
|
||||
mask: Schema.union([Number, String]).required()
|
||||
})
|
||||
|
||||
protected async _handle(payload: Payload) {
|
||||
return this.ctx.ntGroupApi.setGroupMsgMask(payload.group_id.toString(), +payload.mask)
|
||||
}
|
||||
}
|
15
src/onebot11/action/llonebot/SetGroupRemark.ts
Normal file
15
src/onebot11/action/llonebot/SetGroupRemark.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import { BaseAction } from '../BaseAction'
|
||||
import { ActionName } from '../types'
|
||||
|
||||
interface Payload {
|
||||
group_id: string,
|
||||
remark?: string
|
||||
}
|
||||
|
||||
export class SetGroupRemark extends BaseAction<Payload, unknown> {
|
||||
actionName = ActionName.SetGroupRemark
|
||||
|
||||
protected async _handle(payload: Payload): Promise<unknown>{
|
||||
return this.ctx.ntGroupApi.setGroupRemark(payload.group_id.toString(), payload.remark)
|
||||
}
|
||||
}
|
@ -7,62 +7,52 @@ import { ChatCacheListItemBasic, CacheFileType } from '@/ntqqapi/types'
|
||||
export default class CleanCache extends BaseAction<void, void> {
|
||||
actionName = ActionName.CleanCache
|
||||
|
||||
protected _handle(): Promise<void> {
|
||||
return new Promise<void>(async (res, rej) => {
|
||||
try {
|
||||
// dbUtil.clearCache()
|
||||
const cacheFilePaths: string[] = []
|
||||
protected async _handle(): Promise<void> {
|
||||
const cacheFilePaths: string[] = []
|
||||
|
||||
await this.ctx.ntFileCacheApi.setCacheSilentScan(false)
|
||||
await this.ctx.ntFileCacheApi.setCacheSilentScan(false)
|
||||
|
||||
cacheFilePaths.push(await this.ctx.ntFileCacheApi.getHotUpdateCachePath())
|
||||
cacheFilePaths.push(await this.ctx.ntFileCacheApi.getDesktopTmpPath())
|
||||
cacheFilePaths.push(await this.ctx.ntFileCacheApi.getHotUpdateCachePath())
|
||||
cacheFilePaths.push(await this.ctx.ntFileCacheApi.getDesktopTmpPath())
|
||||
|
||||
const list = await this.ctx.ntFileCacheApi.getCacheSessionPathList()
|
||||
list.forEach((e) => cacheFilePaths.push(e.value))
|
||||
const list = await this.ctx.ntFileCacheApi.getCacheSessionPathList()
|
||||
list.forEach((e) => cacheFilePaths.push(e.value))
|
||||
|
||||
// await NTQQApi.addCacheScannedPaths(); // XXX: 调用就崩溃,原因目前还未知
|
||||
const cacheScanResult = await this.ctx.ntFileCacheApi.scanCache()
|
||||
const cacheSize = parseInt(cacheScanResult.size[6])
|
||||
// await NTQQApi.addCacheScannedPaths(); // XXX: 调用就崩溃,原因目前还未知
|
||||
const cacheScanResult = await this.ctx.ntFileCacheApi.scanCache()
|
||||
const cacheSize = parseInt(cacheScanResult.size[6])
|
||||
|
||||
if (cacheScanResult.result !== 0) {
|
||||
throw 'Something went wrong while scanning cache. Code: ' + cacheScanResult.result
|
||||
}
|
||||
if (cacheScanResult.result !== 0) {
|
||||
throw 'Something went wrong while scanning cache. Code: ' + cacheScanResult.result
|
||||
}
|
||||
|
||||
await this.ctx.ntFileCacheApi.setCacheSilentScan(true)
|
||||
if (cacheSize > 0 && cacheFilePaths.length > 2) {
|
||||
// 存在缓存文件且大小不为 0 时执行清理动作
|
||||
// await NTQQApi.clearCache([ 'tmp', 'hotUpdate', ...cacheScanResult ]) // XXX: 也是调用就崩溃,调用 fs 删除得了
|
||||
deleteCachePath(cacheFilePaths)
|
||||
}
|
||||
await this.ctx.ntFileCacheApi.setCacheSilentScan(true)
|
||||
if (cacheSize > 0 && cacheFilePaths.length > 2) {
|
||||
// 存在缓存文件且大小不为 0 时执行清理动作
|
||||
// await NTQQApi.clearCache([ 'tmp', 'hotUpdate', ...cacheScanResult ]) // XXX: 也是调用就崩溃,调用 fs 删除得了
|
||||
deleteCachePath(cacheFilePaths)
|
||||
}
|
||||
|
||||
// 获取聊天记录列表
|
||||
// NOTE: 以防有人不需要删除聊天记录,暂时先注释掉,日后加个开关
|
||||
// const privateChatCache = await getCacheList(ChatType.friend); // 私聊消息
|
||||
// const groupChatCache = await getCacheList(ChatType.group); // 群聊消息
|
||||
// const chatCacheList = [ ...privateChatCache, ...groupChatCache ];
|
||||
const chatCacheList: ChatCacheListItemBasic[] = []
|
||||
// 获取聊天记录列表
|
||||
// NOTE: 以防有人不需要删除聊天记录,暂时先注释掉,日后加个开关
|
||||
// const privateChatCache = await getCacheList(ChatType.friend); // 私聊消息
|
||||
// const groupChatCache = await getCacheList(ChatType.group); // 群聊消息
|
||||
// const chatCacheList = [ ...privateChatCache, ...groupChatCache ];
|
||||
const chatCacheList: ChatCacheListItemBasic[] = []
|
||||
|
||||
// 获取聊天缓存文件列表
|
||||
const cacheFileList: string[] = []
|
||||
// 获取聊天缓存文件列表
|
||||
const cacheFileList: string[] = []
|
||||
|
||||
for (const name in CacheFileType) {
|
||||
if (!isNaN(parseInt(name))) continue
|
||||
for (const name in CacheFileType) {
|
||||
if (!isNaN(parseInt(name))) continue
|
||||
|
||||
const fileTypeAny: any = CacheFileType[name]
|
||||
const fileType: CacheFileType = fileTypeAny
|
||||
const fileType = CacheFileType[name] as unknown as CacheFileType
|
||||
|
||||
cacheFileList.push(...(await this.ctx.ntFileCacheApi.getFileCacheInfo(fileType)).infos.map((file) => file.fileKey))
|
||||
}
|
||||
cacheFileList.push(...(await this.ctx.ntFileCacheApi.getFileCacheInfo(fileType)).infos.map((file) => file.fileKey))
|
||||
}
|
||||
|
||||
// 一并清除
|
||||
await this.ctx.ntFileCacheApi.clearChatCache(chatCacheList, cacheFileList)
|
||||
res()
|
||||
} catch (e) {
|
||||
console.error('清理缓存时发生了错误')
|
||||
rej(e)
|
||||
}
|
||||
})
|
||||
// 一并清除
|
||||
await this.ctx.ntFileCacheApi.clearChatCache(chatCacheList, cacheFileList)
|
||||
}
|
||||
}
|
||||
|
||||
|
10
src/onebot11/action/system/SetRestart.ts
Normal file
10
src/onebot11/action/system/SetRestart.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import { BaseAction } from '@/onebot11/action/BaseAction'
|
||||
import { ActionName } from '@/onebot11/action/types'
|
||||
|
||||
export class SetRestart extends BaseAction<null, void> {
|
||||
actionName = ActionName.SetRestart
|
||||
|
||||
protected async _handle() {
|
||||
await this.ctx.ntSystemApi.restart()
|
||||
}
|
||||
}
|
@ -29,6 +29,10 @@ export enum ActionName {
|
||||
GetRobotUinRange = 'get_robot_uin_range',
|
||||
GroupPoke = 'group_poke',
|
||||
FriendPoke = 'friend_poke',
|
||||
SetFriendRemark = 'set_friend_remark',
|
||||
SetFriendCategory = 'set_friend_category',
|
||||
SetGroupMsgMask = 'set_group_msg_mask',
|
||||
SetGroupRemark = 'set_group_remark',
|
||||
// onebot 11
|
||||
SendLike = 'send_like',
|
||||
GetLoginInfo = 'get_login_info',
|
||||
@ -47,6 +51,7 @@ export enum ActionName {
|
||||
SetGroupLeave = 'set_group_leave',
|
||||
GetVersionInfo = 'get_version_info',
|
||||
GetStatus = 'get_status',
|
||||
SetRestart = 'set_restart',
|
||||
CanSendRecord = 'can_send_record',
|
||||
CanSendImage = 'can_send_image',
|
||||
SetGroupKick = 'set_group_kick',
|
||||
@ -91,4 +96,6 @@ export enum ActionName {
|
||||
GoCQHTTP_DeleteFriend = 'delete_friend',
|
||||
GoCQHTTP_OCRImage = 'ocr_image',
|
||||
GoCQHTTP_GetGroupFileSystemInfo = 'get_group_file_system_info',
|
||||
GoCQHTTP_SetGroupSpecialTitle = 'set_group_special_title',
|
||||
GoCQHTTP_SendGroupSign = 'send_group_sign',
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ export class MessageEncoder {
|
||||
}
|
||||
}
|
||||
|
||||
async generate(content: any[]) {
|
||||
async generate(content: OB11MessageData[]) {
|
||||
await this.render(content)
|
||||
return {
|
||||
multiMsgItems: [{
|
||||
|
@ -11,6 +11,10 @@ function isEmpty(value: unknown) {
|
||||
}
|
||||
|
||||
async function onSettingWindowCreated(view: Element) {
|
||||
console.log(view)
|
||||
if (!view){
|
||||
return
|
||||
}
|
||||
const config = await window.llonebot.getConfig()
|
||||
const ob11Config = { ...config.ob11 }
|
||||
|
||||
@ -247,7 +251,9 @@ async function onSettingWindowCreated(view: Element) {
|
||||
} else {
|
||||
errDom?.classList.add('show')
|
||||
}
|
||||
errCodeDom!.innerHTML = errMsg
|
||||
if (errCodeDom) {
|
||||
errCodeDom.innerHTML = errMsg
|
||||
}
|
||||
}
|
||||
showError().then()
|
||||
|
||||
@ -456,8 +462,8 @@ async function onSettingWindowCreated(view: Element) {
|
||||
}
|
||||
window.llonebot.checkVersion().then(checkVersionFunc)
|
||||
window.addEventListener('beforeunload', () => {
|
||||
window.llonebot.getConfig().then(oldConfig=>{
|
||||
if(JSON.stringify(oldConfig) !== JSON.stringify(config)){
|
||||
window.llonebot.getConfig().then(oldConfig => {
|
||||
if (JSON.stringify(oldConfig) !== JSON.stringify(config)) {
|
||||
window.llonebot.setConfig(true, config)
|
||||
}
|
||||
})
|
||||
|
@ -91,7 +91,7 @@ class SatoriAdapter extends Service {
|
||||
input.subMsgType === 12 &&
|
||||
input.elements[0]?.grayTipElement?.xmlElement?.templId === '10382'
|
||||
) {
|
||||
|
||||
// 机器人被表情回应
|
||||
}
|
||||
else {
|
||||
// 普通的消息
|
||||
|
@ -1 +1 @@
|
||||
export const version = '4.1.3'
|
||||
export const version = '4.4.1'
|
||||
|
Loading…
x
Reference in New Issue
Block a user