update .gitignore

This commit is contained in:
hibiki 2021-05-20 18:23:54 +08:00
commit 8e70766783
943 changed files with 28183 additions and 0 deletions

1
.env Normal file
View File

@ -0,0 +1 @@
ENVIRONMENT=dev

14
.env.dev Normal file
View File

@ -0,0 +1,14 @@
SUPERUSERS=["775757368"]
COMMAND_START=[""]
SESSION_RUNNING_EXPRESSION="别急呀,小真寻要宕机了!QAQ"
NICKNAME=["A"]
SESSION_EXPIRE_TIMEOUT=30
DEBUG=true
# 服务器和端口
HOST = 127.0.0.1
PORT = 8080

2
.gitgignore Normal file
View File

@ -0,0 +1,2 @@
*/__pycache__/
/.idea/

674
LICENSE Normal file
View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. 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
them 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 prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. 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.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey 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;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If 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 convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU 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 that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
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.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
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.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
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
state 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 3 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, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program 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, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU 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. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

520
README.md Normal file
View File

@ -0,0 +1,520 @@
<div align=center><img width="320" height="320" src="https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/zhenxun.jpg"/></div>
![maven](https://img.shields.io/badge/python-3.8%2B-blue)
![maven](https://img.shields.io/badge/nonebot-2.0.0-yellow)
![maven](https://img.shields.io/badge/go--cqhttp-0.9.40--fix4-red)
# 绪山真寻Bot
****
此项目基于 Nonebot2 和 go-cqhttp 开发,以 postgresql 作为数据库的QQ群娱乐机器人
## 关于
用爱发电,某些功能学习借鉴了大佬们的代码,因为绪山真寻实在太可爱了因此开发了
绪山真寻bot实现了一些对群友的娱乐功能和实用功能大概
如果该项目的图片等等侵犯豆腐猫老师权益请联系我删除!
## 声明
此项目仅用于学习交流,请勿用于非法用途
## 真寻的帮助
请对真寻说: '真寻帮助' or '管理员帮助' or '超级用户帮助' or '对应指令 帮助'
## 功能列表
<details>
<summary>已实现的功能</summary>
### 已实现的常用功能
- [x] 昵称系统(群与群与私聊分开.
- [x] 图灵AI会把'你'等关键字替换为你的昵称),且带有 [AnimeThesaurus](https://github.com/Kyomotoi/AnimeThesaurus),够味
- [x] 签到/我的签到/好感度排行(影响色图概率和开箱次数,支持配置)
- [x] 发送某文件夹下的随机图片(支持自定义,默认:美图,萝莉,壁纸)
- [x] 色图(可配置是否存储到本地,并会判断该色图是否已在本地,存在则跳过)
- [x] coser
- [x] 黑白草图生成器
- [x] 鸡汤/语录
- [x] 骂我(钉宫语音)
- [x] 戳一戳(概率发送美图,钉宫语音或者戳回去)
- [x] 模拟开箱/我的开箱/群开箱统计/我的金色/设置cookiecsgo内置爬虫脚本需要提前抓取数据和图片需要session可能需要代理阿里云服务器等ip也许已经被ban了我无代理访问失败如果访问太多账号API调用可能被禁止访问api
- [x] 鲁迅说过
- [x] 构造假消息(自定义的分享链接)
- [x] 商店/我的金币/购买道具/使用道具
- [x] 原神/明日方舟/赛马娘的抽卡【原神抽卡设置小保底与大保底/重置原神抽卡次数】根据bwiki自动更新
- [x] 骰子娘nb2商店插件
- [x] 我有一个朋友想问问..pcrbot插件..重构)
- [x] 原神黄历
- [x] 原神今日素材/天赋材料
- [x] 原神资源查询
- [x] pil对图片的一些操作
- [x] BUFF饰品底价查询需要session
- [x] 天气查询
- [x] 疫情查询
- [x] bt搜索
- [x] reimu搜索上车
- [x] 靠图识番
- [x] 以图搜图
- [x] 搜番
- [x] 点歌
- [x] epic免费游戏
- [x] p站排行榜可含参数
- [x] p站搜图可含参数
- [x] 翻译(日英韩)
- [x] 群内csgo服务器如果没有csgo服务器请删除
- [x] 查看当前群欢迎消息
- [x] 查看该群自己的权限
- [x] 我的信息(只是为了看看什么时候入群)
- [x] 更新信息(如果继续更新的话)
- [x] go-cqhttp最新版下载和上传不需要请删除
- [x] 滴滴滴-(用户对超级用户发送消息)
### 已实现的管理员功能
- [x] 更新群组成员信息
- [x] 95%的群功能开关
- [x] 查看群内被动技能状态
- [x] 自定义群欢迎消息(是真寻的不是管家的!)
- [x] .ban/.unban支持设置ban时长
- [x] 刷屏禁言相关:刷屏检测设置/设置禁言时长/设置检测次数
- [x] 上传图片 (上传图片至指定图库)
- [x] 移动图片 (同上)
- [x] 删除图片 (同上)
### 已实现的超级用户功能
- [x] 添加/删除管理
- [x] 开启/关闭指定群的广播通知
- [x] 广播
- [x] 自检(检查系统状态)
- [x] 所有群组/所有好友
- [x] 退出指定群
- [x] 更新好友信息/更新群信息
- [x] /t对用户进行回复或发送消息
### 已实现的被动技能
- [x] 进群欢迎消息
- [x] 群早晚安
- [x] 每日开箱重置提醒
- [x] b站转发解析解析b站分享信息
- [x] 丢人爬(爬表情包)
- [x] epic通知每日发送epic免费游戏链接
- [x] 原神黄历提醒
- [x] 复读
### 已实现的看不见的技能!
- [x] 刷屏禁言检测
- [x] 功能调用统计
- [x] 检测恶意触发命令将被最高权限ban掉30分钟只有最高权限(9级)可以进行unban
- [x] 自动同意好友请求,加群请求将会提醒管理员,退群提示,加群欢迎等等
- [x] 群聊时间检测当群聊最后一人发言时间大于当前36小时后将关闭该群所有通知即被动技能
- [x] 支持对各个管理员功能的权限配置
- [x] 群管理员监控,自动为新晋管理员增加权限,为失去群管理员的用户删除权限
</details>
## 部分功能展示
<details>
<summary>部分功能展示及说明</summary>
### 帮助以及开关(功能控制)
群帮助将会在功能左侧展示该功能的开关,带有√或×的功能代表可以开关<br>
此插件使用 [nonebot_plugin_manager](https://github.com/Jigsaw111/nonebot_plugin_manager) 并魔改一点实现
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/help.PNG)
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/kg1.png)
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/kg3.png)
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/kg2.png)
<br>
如果你希望某功能暂时停用<br>
私聊发送 npm block xx xx=功能名)来锁定<br>
使用npm unblock xx 进行解锁
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/ocgn.png)
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/ocgn2.png)
### 签到
普普通通的签到,设置影响开箱次数和涩图触发成功的概率(可配置)<br>
开箱次数 = 初始开箱数量 + 好感度 / 3<br>
金币 = random.randint(100) + random.randint(好感度)【好感度获取的金币不会超过200】
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/sign.png)
### 黑白草图
整活生成器(从未设想的道路)
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/w2b.png)
### 发送文件夹下随机图片
提供了 美图589获取该图库下文件名589.jpg的图片方法图库内图片名称需要有序如:0.jpg,1.jpg....
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/send_img.png)
### 开箱csgo模拟开箱
我的开箱/群开箱统计/我的金色 功能是对开箱数据的统计展示 <br>
目前支持的武器箱(数据已备好):
* 狂牙大行动武器箱
* 突围大行动武器箱
* 命悬一线武器箱
* 裂空武器箱
* 光谱武器箱
<br>
BUFF账号可能会因为短时间内访问api次数过多被禁止访问api
如果是第一次启动请先使用命令 “更新价格”, “更新图片” 需要配置cookie如果经常超时请设置代理配置文件中的 buff_proxy!<br>
如果需要配置新的箱子,请在.config.py中配置好该箱子中的皮肤且列表名是箱子名称的大写拼音<br>
示例:光谱武器箱 GUANGPU_CASE_KNIFE,GUANGPU_CASE_RED...后面的颜色代表皮肤品质
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/kaixiang.png)
### BUFF皮肤底价查询
需要配置cookie<br>
如果经常超时请设置代理,配置文件中的 buff_proxy!
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/buff.png)
### coser
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/coser.png)
### 鸡汤/语录
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/jitang.png)
### 骂我
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/mawo.png)
### 鲁迅说
此插件使用 [nonebot2_luxun_says](https://github.com/NothAmor/nonebot2_luxun_says)
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/luxun.png)
### 假消息
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/jiaxiaoxi.png)
### 商店系统
商店内的道具支持自定义,但需要写触发后的效果...整不出活,到头来也就增加好感度概率的商品
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/shop.png)
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/daoju.png)
### 昵称系统
养成方法第一步让可爱的小真寻叫自己昵称替换ai中的'你'等等)
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/nicheng1.png)
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/nicheng2.png)
### 抽卡(原神/明日方舟/赛马娘)
已经上传至nb2商店不再放图片了项目地址[nonebot_plugin_gamedraw](https://github.com/HibiKier/nonebot_plugin_gamedraw)
### 我有一个朋友...
使用大佬的插件 [cappuccilo_plugins](https://github.com/pcrbot/cappuccilo_plugins#%E7%94%9F%E6%88%90%E5%99%A8%E6%8F%92%E4%BB%B6)
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/one_firend.png)
### 原神黄历/今日素材/丘丘语翻译/地图资源查询
使用大佬的插件 [Genshin_Impact_bot](https://github.com/H-K-Y/Genshin_Impact_bot)
### 对图片的操作
只是一些简单对图片操作(娱乐整活)
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/tupian.png)
### 识番
使用大佬的插件 [XUN_Langskip](https://github.com/Angel-Hair/XUN_Bot)
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/shifan.png)
### 识图
使用nb2商店插件 [nonebot_plugin_cocdicer](https://github.com/abrahum/nonebot_plugin_cocdicer) (可配置图片返回的最大数量)
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/shitu.png)
### epic免费游戏
访问rsshub获取数据解析<br>可以不玩,不能没有
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/epic.png)
### P站排行/搜图
访问rsshub获取数据解析<br>自己试试吧(# #
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/p_rank.png)
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/p_sou.png)
### 翻译
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/fanyi.png)
### 自定义群欢迎消息
关键字 [at] 判断是否艾特入群用户
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/qhyxx.png)
### 查看当前群欢迎消息
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/qunhuanying.png)
### 自检
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/check.png)
### .ban/.unban
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/ban.png)
### 查看被动技能(被动技能除复读外都提供了开关)
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/beidong.png)
### 自我介绍
只是一段简单自我介绍,但是,还是想放上来
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/jieshao.png)
### 我的信息/我的权限
![](https://raw.githubusercontent.com/HibiKier/zhenxun_bot/main/docs/info.png)
<br>
### 其他
点歌:使用 [nonebot_plugin_songpicker2](https://github.com/maxesisn/nonebot_plugin_songpicker2) 插件<br>
骰子娘:使用 [nonebot_plugin_cocdicer](https://github.com/abrahum/nonebot_plugin_cocdicer) 插件
<br><br>
## 其他功能请自己试一试
</details>
## Todo
- [ ] 提供更多对插件的控制
- [ ] 明日方舟卡片式的签到..(大概)
- [ ] 更多的群管理功能
## 部署
```
# 获取代码
git clone https://github.com/Angel-Hair/XUN_Bot.git
# 安装依赖
pip install -r requirements.txt
# 进入目录
cd zhenxun_bot
# 进行基础配置
####请查看 配置 部分####
# 开始运行
python bot.py
```
## 配置
在 ./configs/config.py 中默认为True
```
# 是否使用配置文件为True时这将会生成三份配置文件
./config.json主要配置
./configs/plugins2cmd_config.json: 功能模块与对应命令配置
./configs/other_config.json: 一些插件配置)
USE_CONFIG_FILE = True
# 如果不使用配置文件将USE_CONFIG_FILE设置为False可在./configs/config.py文件中修改配置在./configs/path_config.py修改资源路径
# 已在./configs/config.py和./configs/path_config.py中为各个配置提供注解
```
## 配置文件注解(如果使用配置文件的话)
<details>
<summary>配置文件注解</summary>
./config.json
```
{
# 必填(影响功能运行)
"apikey": {
"LOLICON_KEY": "", # loliconAPI缺失会导致色图功能异常
"TL_KEY": [] # 图灵Key为什么要用列表因为白嫖用户能拿5个apikey每个apikey每日限制100条
},
# (必填!!!)
# 数据库配置如果填写了bind后面就不用再填了)只是帮你拼接好)
# 示例:"bind": "postgresql://user:password@127.0.0.1:5432/database"
"sql": {
"bind": "",
"sql_name": "",
"user": "",
"password": "",
"address": "",
"port": "",
"database": ""
},
# 路径设置(不填则使用默认)
"path": {
"IMAGE_PATH": "", # 图片路径
"VOICE_PATH": "", # 音频路径
"TXT_PATH": "", # 文本路径
"LOG_PATH": "", # 日志路径
"DATA_PATH": "", # 数据路径
"DRAW_PATH": "" # 抽卡数据路径
"TEMP_PATH": "" # 临时图片路径
},
# 代理设置
"proxy": {
"system_proxy": "", # 系统代理
"buff_proxy": "" # buff代理
},
# RSSHUB地址
"rsshub": {
"RSSHUBAPP": "https:\/\/docs.rsshub.app\/"
},
# 各个管理员功能 对应的 权限
"level": {
"DELETE_IMG_LEVEL": 7,
"MOVE_IMG_LEVEL": 7,
"UPLOAD_LEVEL": 6,
"BAN_LEVEL": 5,
"OC_LEVEL": 2,
"MUTE_LEVEL": 5
}
}
```
./configs/plugins2cmd_config.json
```
# 单个例子注解
"send_img": [
"发送图片",
"萝莉",
"美图",
"壁纸"
]
# 发送 关闭发送图片/关闭萝莉/关闭美图/关闭壁纸 都将触发命令 关闭send_img
```
./configs/other_config.json
```
{
"base": {
# 图库配置,会影响 上传/删除/移动/发送图片等功能
"IMAGE_DIR_LIST": [
"色图",
"美图",
"萝莉",
"壁纸"
],
"BAN_RESULT": "才不会给你发消息." # 当被ban用户触发命令后发送的消息
},
"bool": {
"AUTO_ADD_FRIEND": true, # 是否自动添加好友
"DOWNLOAD_SETU": true # 是否下载bot发送过的色图不会重复
},
"max_count": {
"MAXINFO_REIMU": 7, # 上车(reimu)功能查找目的地的最大数
"COUNT_PER_DAY_REIMU": 5, # 每日上车(reimu)次数限制
"MAXINFO_BT": 10, # bt功能单次查找最大数
"MAXINFO_PRIVATE_ANIME": 20, # 私聊搜索动漫返回的最大数量
"MAXINFO_GROUP_ANIME": 5, # 群搜索动漫返回的最大数量
"MAX_FIND_IMG_COUNT": 3, # 识图最大返回数
"MAX_SIGN_GOLD": 200 # 签到好感度加成额外获得的最大金币数
},
"probability": {
"INITIAL_SETU_PROBABILITY": 0.7, # 涩图触发的基础概率(触发概率 = 基础概率 + 好感度)
"FUDU_PROBABILITY": 0.7 # 复读概率
},
# 注:即在 MALICIOUS_CHECK_TIME 时间内触发相同命令 MALICIOUS_BAN_COUNT 将被ban MALICIOUS_BAN_TIME 分钟
"malicious_ban": {
"MALICIOUS_BAN_TIME": 30, # 恶意触发命令被ban的时长分钟
"MALICIOUS_BAN_COUNT": 4, # 恶意触发命令的规定次数
"MALICIOUS_CHECK_TIME": 5 # 恶意触发命令的规定时间(秒)
},
"open_case": {
"INITIAL_OPEN_CASE_COUNT": 20 # 每日开箱的基本数量(总数量=基本数量 + 好感度/3
},
# 注:即在 MUTE_DEFAULT_TIME 内发送相似(包含)消息超过 MUTE_DEFAULT_COUNT 将会被 MUTE_DEFAULT_DURATION 分钟
# 这只是默认配置,各个群可以自由设置群内刷屏检测配置
"mute": {
"MUTE_DEFAULT_COUNT": 10, # 刷屏检测默认检测最大次数
"MUTE_DEFAULT_TIME": 7, # 刷屏检测默认规定时间(秒)
"MUTE_DEFAULT_DURATION": 10 # 刷屏检测默认禁言时长(分钟)
},
"other": {
"UPDATE_GOCQ_GROUP": [], # 是否需要为某些群上传最新版的gocq
"ADMIN_DEFAULT_AUTH": 5 # 默认群管理员权限
},
# 管理员功能 和 对应的 权限
"auth": {
"admin_plugins_auth": {
"admin_bot_manage": 2,
"ban": 5,
"delete_img": 7,
"move_img": 7,
"upload_img": 6,
"admin_help": 1,
"mute": 5
}
}
}
```
</details>
## 感谢
[Onebot](https://github.com/howmanybots/onebot)
<br>
[go-cqhttp](https://github.com/Mrs4s/go-cqhttp)
<br>
[nonebot2](https://github.com/nonebot/nonebot2)
<br>
[XUN_Langskip](https://github.com/Angel-Hair/XUN_Bot)
<br>
[cappuccilo_plugins](https://github.com/pcrbot/cappuccilo_plugins#%E7%94%9F%E6%88%90%E5%99%A8%E6%8F%92%E4%BB%B6)
<br>
[nonebot_plugin_cocdicer](https://github.com/abrahum/nonebot_plugin_cocdicer)
<br>
[nonebot_plugin_songpicker2](https://github.com/maxesisn/nonebot_plugin_songpicker2)
<br>
[nonebot_plugin_manager](https://github.com/Jigsaw111/nonebot_plugin_manager)
<br>
[Genshin_Impact_bot](https://github.com/H-K-Y/Genshin_Impact_bot)
<br>
[nonebot2_luxun_says](https://github.com/NothAmor/nonebot2_luxun_says)
<br>
[AnimeThesaurus](https://github.com/Kyomotoi/AnimeThesaurus)

191
bot.py Normal file
View File

@ -0,0 +1,191 @@
<<<<<<< HEAD
import nonebot
from nonebot.adapters.cqhttp import Bot as CQHTTPBot
from services.db_context import init, disconnect
nonebot.init()
driver = nonebot.get_driver()
driver.register_adapter("cqhttp", CQHTTPBot)
config = driver.config
driver.on_startup(init)
driver.on_shutdown(disconnect)
nonebot.load_builtin_plugins()
nonebot.load_plugins("plugins")
nonebot.load_plugins("plugins/shop")
nonebot.load_plugins("plugins/genshin")
if __name__ == "__main__":
nonebot.run()
# None
# ---------------------
# 775757368 print(event.get_user_id())
# 775757368 print(event.get_session_id())
# 天气 print(event.get_message())
# message.group.normal print(event.get_event_name())
# 天气 print(event.get_plaintext())
# -------
# 863633108 print(event.group_id)
# 775757368 print(event.user_id)
# 1851212230 print(event.message_id)
# event
# [request.group.invite]: {
# 'time': 1612430661, 'self_id': 3054557284, 'post_type': 'request', 'request_type': 'group', 'sub_type': 'invite',
# 'group_id': 863633108, 'user_id': 775757368, 'comment': '', 'flag': '1612430661235986'}
# [request.friend]: {'time': 1612431762, 'self_id': 3054557284, 'post_type': 'request',
# 'request_type': 'friend', 'user_id': 3238573864, 'comment': '', 'flag': '1612431762000000'}
# [notice.group_decrease.leave]: {'time': 1612620312,
# 'self_id': 3054557284, 'post_type': 'notice', 'notice_type': 'group_decrease',
# 'sub_type': 'leave', 'user_id': 3238573864, 'group_id': 863633108, 'operator_id': 3238573864}
# [notice.group_increase.approve]: {'time': 1612620506,
# 'self_id': 3054557284, 'post_type': 'notice', 'notice_type': 'group_increase',
# 'sub_type': 'approve', 'user_id': 3238573864, 'group_id': 863633108, 'operator_id': 0}
# get_group_list
# [{'group_id': 210287674, 'group_name': '豪爹头号粉丝⑧群', 'max_member_count': 200, 'member_count': 14},
# {'group_id': 863633108, 'group_name': 'Amireux、这里是、可…', 'max_member_count': 200, 'member_count': 4}]
# 消息event
# {"time": 1613886297, "self_id": 3054557284, "post_type": "message", "sub_type": "normal", "user_id": 3238573864,
# "message_type": "group", "message_id": 1933353523, "message": [{"type": "text", "data": {"text": "666"}}],
# "raw_message": "A666", "font": 0, "sender": {"user_id": 3238573864, "nickname":
# "\u53ef\u7231\u7684\u5c0f\u771f\u5bfb", "sex": "unknown", "age": 0, "card": "", "area": "", "level": "",
# "role": "member/admin/owner", "title": ""}, "to_me": true, "reply": null, "group_id": 863633108, "anonymous": null}
# bilibili转发
# {"app":"com.tencent.miniapp_01","config":{"autoSize":0,"ctime":1613992391,"forward":1,"height":0,"
# token":"f7f529900be6af62f4d864f8a92c94c9","type":"normal","width":0},"desc":"哔哩哔哩",
# "extra":{"app_type":1,"appid":100951776,"uin":775757368},"meta":{"detail_1":{"appid":"1109937557",
# "desc":"B 站 用 户 三 连 现 状","gamePoints":"","gamePointsUrl":"","host":{"nick":"这里是","uin":775757368},
# "icon":"http://miniapp.gtimg.cn/public/appicon/432b76be3a548fc128acaa6c1ec90131_200.jpg",
# "preview":"pubminishare-30161.picsz.qpic.cn/4f5a19fb-42d5-4bb5-bc0a-b92fa5a06519",
# "qqdocurl":"https://b23.tv/qDvchc?share_medium=android&share_source=qq&bbid=XYDEA6CD35717661AE594D9DD99A5E852E414&ts=1613992387314",
# "scene":1036,"shareTemplateData":{},"shareTemplateId":"8C8E89B49BE609866298ADDFF2DBABA4","showLittleTail":"","title":"哔哩哔哩",
# "url":"m.q.qq.com/a/s/130c1f9c2af58430805ebfda192caa9a"}},"needShareCallBack":false,"prompt":"[QQ小程序]哔哩哔哩","ver":"1.0.0.19",
# "view":"view_8C8E89B49BE609866298ADDFF2DBABA4"}
#event
# [notice.group_decrease.kick_me]: {'time': 1614143313, 'self_id': 3054557284, 'post_type': 'notice',
# 'notice_type': 'group_decrease', 'sub_type': 'kick_me', 'user_id': 3054557284, 'group_id': 863633108,
# 'operator_id': 775757368}
# [request.group.add]: {'time': 1614851972, 'self_id': 3238573864, 'post_type': 'request', 'request_type': 'group',
# 'sub_type': 'add', 'group_id': 774261838, 'user_id': 3054557284, 'comment': '问题:为啥加群鸭?\n答案哈哈哈',
# 'flag': '1614851972274444'}
=======
import nonebot
from nonebot.adapters.cqhttp import Bot as CQHTTPBot
from services.db_context import init, disconnect
nonebot.init()
driver = nonebot.get_driver()
driver.register_adapter("cqhttp", CQHTTPBot)
config = driver.config
driver.on_startup(init)
driver.on_shutdown(disconnect)
nonebot.load_builtin_plugins()
nonebot.load_plugins("plugins")
nonebot.load_plugins("plugins/shop")
nonebot.load_plugins("plugins/genshin")
if __name__ == "__main__":
nonebot.run()
# None
# ---------------------
# 775757368 print(event.get_user_id())
# 775757368 print(event.get_session_id())
# 天气 print(event.get_message())
# message.group.normal print(event.get_event_name())
# 天气 print(event.get_plaintext())
# -------
# 863633108 print(event.group_id)
# 775757368 print(event.user_id)
# 1851212230 print(event.message_id)
# event
# [request.group.invite]: {
# 'time': 1612430661, 'self_id': 3054557284, 'post_type': 'request', 'request_type': 'group', 'sub_type': 'invite',
# 'group_id': 863633108, 'user_id': 775757368, 'comment': '', 'flag': '1612430661235986'}
# [request.friend]: {'time': 1612431762, 'self_id': 3054557284, 'post_type': 'request',
# 'request_type': 'friend', 'user_id': 3238573864, 'comment': '', 'flag': '1612431762000000'}
# [notice.group_decrease.leave]: {'time': 1612620312,
# 'self_id': 3054557284, 'post_type': 'notice', 'notice_type': 'group_decrease',
# 'sub_type': 'leave', 'user_id': 3238573864, 'group_id': 863633108, 'operator_id': 3238573864}
# [notice.group_increase.approve]: {'time': 1612620506,
# 'self_id': 3054557284, 'post_type': 'notice', 'notice_type': 'group_increase',
# 'sub_type': 'approve', 'user_id': 3238573864, 'group_id': 863633108, 'operator_id': 0}
# get_group_list
# [{'group_id': 210287674, 'group_name': '豪爹头号粉丝⑧群', 'max_member_count': 200, 'member_count': 14},
# {'group_id': 863633108, 'group_name': 'Amireux、这里是、可…', 'max_member_count': 200, 'member_count': 4}]
# 消息event
# {"time": 1613886297, "self_id": 3054557284, "post_type": "message", "sub_type": "normal", "user_id": 3238573864,
# "message_type": "group", "message_id": 1933353523, "message": [{"type": "text", "data": {"text": "666"}}],
# "raw_message": "A666", "font": 0, "sender": {"user_id": 3238573864, "nickname":
# "\u53ef\u7231\u7684\u5c0f\u771f\u5bfb", "sex": "unknown", "age": 0, "card": "", "area": "", "level": "",
# "role": "member/admin/owner", "title": ""}, "to_me": true, "reply": null, "group_id": 863633108, "anonymous": null}
# bilibili转发
# {"app":"com.tencent.miniapp_01","config":{"autoSize":0,"ctime":1613992391,"forward":1,"height":0,"
# token":"f7f529900be6af62f4d864f8a92c94c9","type":"normal","width":0},"desc":"哔哩哔哩",
# "extra":{"app_type":1,"appid":100951776,"uin":775757368},"meta":{"detail_1":{"appid":"1109937557",
# "desc":"B 站 用 户 三 连 现 状","gamePoints":"","gamePointsUrl":"","host":{"nick":"这里是","uin":775757368},
# "icon":"http://miniapp.gtimg.cn/public/appicon/432b76be3a548fc128acaa6c1ec90131_200.jpg",
# "preview":"pubminishare-30161.picsz.qpic.cn/4f5a19fb-42d5-4bb5-bc0a-b92fa5a06519",
# "qqdocurl":"https://b23.tv/qDvchc?share_medium=android&share_source=qq&bbid=XYDEA6CD35717661AE594D9DD99A5E852E414&ts=1613992387314",
# "scene":1036,"shareTemplateData":{},"shareTemplateId":"8C8E89B49BE609866298ADDFF2DBABA4","showLittleTail":"","title":"哔哩哔哩",
# "url":"m.q.qq.com/a/s/130c1f9c2af58430805ebfda192caa9a"}},"needShareCallBack":false,"prompt":"[QQ小程序]哔哩哔哩","ver":"1.0.0.19",
# "view":"view_8C8E89B49BE609866298ADDFF2DBABA4"}
#event
# [notice.group_decrease.kick_me]: {'time': 1614143313, 'self_id': 3054557284, 'post_type': 'notice',
# 'notice_type': 'group_decrease', 'sub_type': 'kick_me', 'user_id': 3054557284, 'group_id': 863633108,
# 'operator_id': 775757368}
# [request.group.add]: {'time': 1614851972, 'self_id': 3238573864, 'post_type': 'request', 'request_type': 'group',
# 'sub_type': 'add', 'group_id': 774261838, 'user_id': 3054557284, 'comment': '问题:为啥加群鸭?\n答案哈哈哈',
# 'flag': '1614851972274444'}
>>>>>>> master

Binary file not shown.

Binary file not shown.

147
configs/config.py Normal file
View File

@ -0,0 +1,147 @@
from .utils.util import get_config_data
try:
import ujson as json
except ModuleNotFoundError:
import json
# 是否使用配置文件
USE_CONFIG_FILE = False
# 公开图库列表
IMAGE_DIR_LIST = ["色图", "美图", "萝莉", "壁纸"]
# 对被ban用户发送的消息
BAN_RESULT = "才不会给你发消息."
MAXINFO_REIMU: int = 7 # 上车功能查找目的地的最大数
COUNT_PER_DAY_REIMU: int = 5 # 每日上车次数限制
MAXINFO_BT: int = 10 # bt功能单次查找最大数
MAXINFO_PRIVATE_ANIME: int = 20 # 私聊单词搜索动漫最大数
MAXINFO_GROUP_ANIME: int = 5 # 群单词搜索动漫最大数
MAX_FIND_IMG_COUNT = 3 # 识图最大返回数
ADMIN_DEFAULT_AUTH = 5 # 默认群管理员权限
MAX_SIGN_GOLD = 200 # 好感度加成额外获得的最大金币数
INITIAL_SETU_PROBABILITY = 0.7 # 色图概率
FUDU_PROBABILITY = 0.7 # 复读概率
INITIAL_OPEN_CASE_COUNT = 20 # 初始开箱次数
MUTE_DEFAULT_COUNT = 10 # 刷屏禁言默认检测次数
MUTE_DEFAULT_TIME = 7 # 刷屏检测默认规定时间
MUTE_DEFAULT_DURATION = 10 # 刷屏检测默禁言时长(分钟)
# 注:即在 MALICIOUS_BAN_COUNT 时间内触发相同命令 MALICIOUS_CHECK_TIME 将被ban MALICIOUS_BAN_TIME 分钟
MALICIOUS_BAN_TIME = 30 # 恶意命令触发检测触发后ban的时长分钟
MALICIOUS_BAN_COUNT = 4 # 恶意命令触发检测规定时间内(秒)
MALICIOUS_CHECK_TIME = 5 # 恶意命令触发检测最大触发次数
# LEVEL
DELETE_IMG_LEVEL: int = 7
MOVE_IMG_LEVEL: int = 7
UPLOAD_LEVEL: int = 6
BAN_LEVEL: int = 5
OC_LEVEL: int = 2
MUTE_LEVEL: int = 5
# 需要更新gocq吗
UPDATE_GOCQ_GROUP = []
# 代理
system_proxy = 'http://127.0.0.1:7890'
buff_proxy = ''
# 是否存储色图
DOWNLOAD_SETU = True
# 是否使用本地色图
LOCAL_SETU = True
# 是否自动同意好友添加
AUTO_ADD_FRIEND = True
# API KEY
LOLICON_KEY: str = "336595836015174952daa2" # lolicon
RSSHUBAPP: str = "https://docs.rsshub.app/" # rsshub
# 图灵
TL_KEY = ["4474710fabbf4540bfaa569c192bb457", "6f4c0920d2ff4962b5cbd8148aef771b",
"f5595738894042fb9fad88ecdc4acf41", "c24400595fed48f9a5c5bc3ff03a3267", "efab135b75d84b02a59115f5b571f277"]
# 数据库
bind = 'postgresql://hibiki:KEWang130123@hibiki0v0.cn:5432/hibikibot'
sql_name = ''
user = ''
password = ''
address = ''
port = ''
database = ''
plugins2name_dict = {
'sign_in': ['签到'],
'send_img': ['发送图片', '萝莉', '美图', '壁纸'],
'send_setu': ['色图', '涩图', '瑟图', '查色图'],
'white2black': ['黑白图', '黑白草图'],
'coser': ['coser', 'cos'],
'quotations': ['语录'],
'jitang': ['鸡汤'],
'send_dinggong_voice': ['骂我', '骂老子', '骂劳资'],
'open_cases': ['开箱', '我的开箱', '群开箱统计', '我的金色'],
'luxun': ['鲁迅说过', '鲁迅说'],
'fake_msg': ['假消息'],
'buy': ['购买', '购买道具'],
'my_gold': ['我的金币'],
'my_props': ['我的道具'],
'shop_help': ['商店'],
'nonebot_plugin_cocdicer': ['骰子娘'],
'update_pic': ['图片', '操作图片', '修改图片'],
'search_buff_skin_price': ['查询皮肤'],
'weather': ['天气', '查询天气', '天气查询'],
'yiqing': ['疫情', '疫情查询', '查询疫情'],
'what_anime': ['识番'],
'search_anime': ['搜番'],
'songpicker2': ['点歌'],
'epic': ['epic'],
'pixiv': ['pixiv', 'p站排行', '搜图'],
'poke': ['戳一戳'],
'draw_card': ['游戏抽卡', '原神一井', '原神来一井', '方舟一井', '方舟来一井'],
'ai': ['ai', 'Ai', 'AI', 'aI'],
'one_friend': ['我有一个朋友', '我有一个朋友想问问'],
'translate': ['翻译', '英翻', '翻英', '日翻', '翻日', '韩翻', '翻韩'],
'nonebot_plugin_picsearcher': ['识图'],
'almanac': ['原神黄历', '黄历'],
'material_remind': ['今日素材', '天赋材料'],
'qiu_qiu_translation': ['丘丘翻译', '丘丘一下', '丘丘语翻译'],
'query_resource_points': ['原神资源查询', '原神资源列表'],
}
admin_plugins_auth = {
'admin_bot_manage': OC_LEVEL,
'ban': BAN_LEVEL,
'delete_img': DELETE_IMG_LEVEL,
'move_img': MOVE_IMG_LEVEL,
'upload_img': UPLOAD_LEVEL,
'admin_help': 1,
'mute': MUTE_LEVEL,
}
if USE_CONFIG_FILE:
config = get_config_data()
if config:
for key in config.keys():
if isinstance(config[key], str):
config[key] = config[key].strip()
# if not configs[key] and key.find("PATH") == -1:
# configs[key] = None
globals().update(config)

66
configs/path_config.py Normal file
View File

@ -0,0 +1,66 @@
from .utils.util import get_config_data
from pathlib import Path
from configs.config import USE_CONFIG_FILE
# 图片路径
IMAGE_PATH = Path("resources/img/")
# 音频路径
VOICE_PATH = Path("resources/voice/")
# 文本路径
TXT_PATH = Path("resources/txt/")
# 日志路径
LOG_PATH = Path("log/")
# 字体路径
TTF_PATH = Path("resources/ttf/")
# 数据路径
DATA_PATH = Path("data/")
# 抽卡数据路径
DRAW_PATH = Path("data/draw_card/")
# 临时图片路径
TEMP_PATH = Path("resources/img/temp/")
def init_path():
global IMAGE_PATH, VOICE_PATH, TXT_PATH, LOG_PATH, TTF_PATH, DATA_PATH, DRAW_PATH, TEMP_PATH
if USE_CONFIG_FILE:
data = get_config_data()
if data.get('IMAGE_PATH'):
IMAGE_PATH = Path(data['IMAGE_PATH'])
if data.get('VOICE_PATH'):
VOICE_PATH = Path(data['VOICE_PATH'])
if data.get('TXT_PATH'):
TXT_PATH = Path(data['TXT_PATH'])
if data.get('LOG_PATH'):
LOG_PATH = Path(data['LOG_PATH'])
if data.get('TTF_PATH'):
TTF_PATH = Path(data['TTF_PATH'])
if data.get('DATA_PATH'):
DATA_PATH = Path(data['DATA_PATH'])
if data.get('DRAW_PATH'):
DRAW_PATH = Path(data['DRAW_PATH'])
if data.get('TEMP_PATH'):
TEMP_PATH = Path(data['TEMP_PATH'])
IMAGE_PATH.mkdir(parents=True, exist_ok=True)
VOICE_PATH.mkdir(parents=True, exist_ok=True)
TXT_PATH.mkdir(parents=True, exist_ok=True)
LOG_PATH.mkdir(parents=True, exist_ok=True)
TTF_PATH.mkdir(parents=True, exist_ok=True)
DATA_PATH.mkdir(parents=True, exist_ok=True)
DRAW_PATH.mkdir(parents=True, exist_ok=True)
TEMP_PATH.mkdir(parents=True, exist_ok=True)
IMAGE_PATH = str(IMAGE_PATH.absolute()) + '/'
VOICE_PATH = str(VOICE_PATH.absolute()) + '/'
TXT_PATH = str(TXT_PATH.absolute()) + '/'
LOG_PATH = str(LOG_PATH.absolute()) + '/'
TTF_PATH = str(TTF_PATH.absolute()) + '/'
DATA_PATH = str(DATA_PATH.absolute()) + '/'
DRAW_PATH = str(DRAW_PATH.absolute()) + '/'
TEMP_PATH = str(TEMP_PATH.absolute()) + '/'
init_path()
if __name__ == '__main__':
print(IMAGE_PATH)

Binary file not shown.

35
configs/utils/util.py Normal file
View File

@ -0,0 +1,35 @@
from pathlib import Path
from services.init_config import init_config
try:
import ujson as json
except ModuleNotFoundError:
import json
data: dict = {}
def get_config_data():
global data
if not data:
try:
base_config = json.load(open(Path() / "config.json", 'r', encoding='utf8'))
plugins2cmd_config = json.load(open(Path() / 'configs' / 'plugins2cmd_config.json', 'r', encoding='utf8'))
other_config = json.load(open(Path() / 'configs' / 'other_config.json', 'r', encoding='utf8'))
for key in base_config.keys():
data.update(base_config[key])
for key in plugins2cmd_config.keys():
data.update(plugins2cmd_config[key])
for key in other_config.keys():
data.update(other_config[key])
except FileNotFoundError:
# logger.warning('配置文件不存在,生成默认配置....请填写数据库等必要数据后再次启动bot...')
init_config()
raise FileNotFoundError('配置文件不存在,生成默认配置....请填写数据库等必要数据后再次启动bot...')
except ValueError:
# logger.error('配置文件错误....')
raise ValueError('配置文件错误....')
return data

594
data/anime.json Normal file
View File

@ -0,0 +1,594 @@
{
"mua": [
"你想干嘛?(一脸嫌弃地后退)",
"诶……不可以随便亲亲啦",
"(亲了一下你)",
"只......只许这一次哦///////",
"唔...诶诶诶!!!",
"mua~",
"rua大hentai想...想亲咱就直说嘛⁄( ⁄•⁄ω⁄•⁄ )",
"!啾~~"
],
"摸摸": [
"感觉你就像咱很久之前认识的一个人呢,有种莫名安心的感觉(><)",
"舒服w蹭蹭~",
"唔。。头发要乱啦",
"呼噜呼噜~",
"再摸一次~",
"好舒服,蹭蹭~",
"不行那里不可以(´///ω/// `)",
"再摸咱就长不高啦~",
"你的手总是那么暖和呢~",
"好吧~_~,就一下下哦……唔~好了……都两下了……(害羞)",
"不可以总摸的哦不然的话会想那个的wwww",
"哼!谁稀罕你摸头啦!唔......为什么要做出那副表情......好啦好啦~咱......咱让你摸就是了......诶嘿嘿~好舒服......",
"呜姆呜姆~~~w害羞兴奋主人喵~(侧过脑袋蹭蹭你的手"
],
"上你": [
"(把你按在地上)这么弱还想欺负咱,真是不自量力呢",
"你再这样我就不理你了(>д<)"
],
"傻了": [
"超级讨厌你说咱傻的说"
],
"蹭": [
"唔...你这也是禁止事项哦→_→",
"嗯..好舒服呢",
"不要啊好痒的",
"不要过来啦讨厌!!!∑(°Д°ノ)"
],
"裸体": [
"下流!",
"Hentai!",
"喂?妖妖灵吗?这里有一只大变态!",
"エッチ!"
],
"贴贴": [
"贴什么贴.....只......只能......一下哦!",
"贴...贴贴(靠近)",
"蹭蹭…你以为咱会这么说吗baka死宅快到一边去啦"
],
"老婆": [
"咱和你谈婚论嫁是不是还太早了一点呢?",
"咱在呢(ノ>ω<)ノ",
"见谁都是一口一个老婆的人,要不要把你也变成女孩子呢?(*-`ω´-)✄",
"神经病,凡是美少女都是你老婆吗?",
"嘛嘛~本喵才不是你的老婆呢",
"你黐线,凡是美少女都系你老婆啊?"
],
"抱": [
"诶嘿~(钻进你怀中)",
"o(*////▽////*)q",
"只能一会哦(张开双手)",
"你就像个孩子一样呢...摸摸头(>^ω^<)抱一下~你会舒服些吗?",
"嘛,真是拿你没办法呢,就一会儿哦",
"抱住不忍心放开",
"嗯嗯,抱抱~",
"抱一下嘿w",
"抱抱ヾ(@^▽^@)",
"喵呜~w扑进怀里瘫软"
],
"亲亲": [
"啊好害羞啊那只能亲一下哦mua(⑅˃◡˂⑅)",
"亲~",
"啾~唔…不要总伸进来啊!",
"你怎么这么熟练呢?明明是咱先的",
"(〃ノωノ)亲…亲一个…啾w",
"(脸红)就只有这一次哦~你"
],
"草一下": [
"一下也不行!",
"想都不要想!",
"咬断!"
],
"一下": [
"一下也不行!"
],
"啪一下": [
"不可啪",
"不可以……你不可以做这种事情"
],
"咬一下": [
"啊呜~(反咬一口)",
"不可以咬咱咱会痛的QAQ",
"不要啦。咱怕疼",
"你是说咬呢……还是说……咬♂️呢?",
"不要啦很痛的QAQ"
],
"操": [
"(害怕)咱是不是应该报警呢"
],
"123": [
"boom你有没有被咱吓到",
"木头人~你不许动w",
"上山打老虎,老虎没打到\n咱来凑数——嗷呜嗷呜┗|O|┛嗷~~"
],
"进去": [
"不让!"
],
"调教": [
"总感觉你在欺负咱呢,对咱说调教什么的",
"啊!竟然在大街上明目张胆太过分啦!",
"你脑子里总是想着调教什么的,真是变态呢"
],
"内衣": [
"内...内衣才不给你看!(///////)",
"突然问这个干什么?",
"噫…你这个死变态想干嘛!居然想叫咱做这种事,死宅真恶心!快离我远点,我怕你污染到周围空气了(嫌弃脸)"
],
"摸头": [
"喂喂...不要停下来啊",
"欸...感觉..痒痒的呢",
"唔... 手...好温暖呢.....就像是......新出炉的蛋糕",
"走开啦,黑羽喵说过,被摸头会长不高的啦~~~",
"呜姆咪~~...好...好的说喵~...(害羞,猫耳往下压,任由"
],
"原味": [
"(/ω\)你真的要么……?记得还给咱~还有奶油爆米花(//??//)说好了呦~!"
],
"搓搓": [
"在搓哪里呢,,Ծ‸Ծ,,",
"呜,脸好疼呀...QAQ",
"不可以搓咱!"
],
"捏捏": [
"咱的脸...快捏红啦...快放手呀QAQ",
"晃休啦咱要型气了o(><)o",
"躲开",
"疼...你快放手",
"快点给我放开啦!",
"唔……好痛你这个baka在干什么…快给咱放开唔……"
],
"挤挤": [
"哎呀~你不要挤咱啊(红着脸挤在你怀里)"
],
"呐": [
"嗯?咱在哟~你怎么了呀OAO",
"呐呐呐~",
"嗯?你有什么事吗?"
],
"胖次": [
"(*/ω\*)hentai",
"透明的",
"粉...粉白条纹...(羞)",
"轻轻地脱下,给你~",
"你想看咱的胖次吗?噫,四斋蒸鹅心......",
"(掀裙)今天……是…白,白色的呢……请温柔对她……",
"这种东西当然不能给你啦!",
"咱才不会给你呢",
"hentai咱才不会跟你聊和胖…胖次有关的话题呢",
"今天……今天是蓝白色的",
"今……今天只有创口贴噢",
"你的胖次什么颜色?",
"噫…你这个死变态想干嘛!居然想叫咱做这种事,死宅真恶心!快离我远点,我怕你污染到周围空气了(嫌弃脸)",
"可爱吗?你喜欢的话,摸一下……也可以哦"
],
"内裤": [
"今天……没有穿……有没有心动呀",
"粉...粉白条纹...(羞)",
"你这个大变态,咱才不要",
"可爱吗?你喜欢的话,摸一下……也可以哦"
],
"ghs": [
"是的呢(点头点头)"
],
"批": [
"你在说什么呀,再这样,咱就不理你了!"
],
"kkp": [
"你在说什么呀,再这样,咱就不理你了!"
],
"咕": [
"咕咕咕是要被当成鸽子炖的哦(:з」∠)_",
"咕咕咕"
],
"骚": [
"说这种话咱会生气的"
],
"喜欢": [
"最喜欢你了,需要暖床吗?",
"当然是你啦",
"咱也是,非常喜欢你~",
"那么大张开手画圆手不够长。QAQ 咱真的最喜欢你了~",
"不可以哦,只可以喜欢咱一个人",
"突然说这种事...",
"喜欢⁄(⁄⁄•⁄ω⁄•⁄⁄)⁄咱最喜欢你了",
"咱也喜欢你哦",
"好啦好啦,咱知道了",
"有人喜欢咱,咱觉得很幸福",
"诶嘿嘿,好高兴"
],
"suki": [
"最喜欢你了,需要暖床吗?",
"当然是你啦",
"咱也是,非常喜欢你~",
"那么大张开手画圆手不够长。QAQ 咱真的最喜欢你了~",
"不可以哦,只可以喜欢咱一个人",
"突然说这种事...",
"喜欢⁄(⁄⁄•⁄ω⁄•⁄⁄)⁄咱最喜欢你了",
"咱也喜欢你哦",
"好啦好啦,咱知道了",
"有人喜欢咱,咱觉得很幸福",
"诶嘿嘿,好高兴"
],
"好き": [
"最喜欢你了,需要暖床吗?",
"当然是你啦",
"咱也是,非常喜欢你~",
"那么大张开手画圆手不够长。QAQ 咱真的最喜欢你了~",
"不可以哦,只可以喜欢咱一个人",
"突然说这种事...",
"喜欢⁄(⁄⁄•⁄ω⁄•⁄⁄)⁄咱最喜欢你了",
"咱也喜欢你哦",
"好啦好啦,咱知道了",
"有人喜欢咱,咱觉得很幸福",
"诶嘿嘿,好高兴"
],
"不能": [
"虽然很遗憾,那算了吧。"
],
"砸了": [
"不可以这么粗暴的对待它们!"
],
"透": [
"来啊来啊有本事就先插破屏幕啊",
"那你就先捅破屏幕啊baka",
"不给你一耳光你都不知道咱的厉害"
],
"口我": [
"再伸过来就帮你切掉",
"咱才不呢baka你居然想叫本小姐干那种事情哼(つд⊂)(生气)"
],
"草我": [
"这时候应该喊666吧..咱这么思考着..",
"baka你居然敢叫咱做这种事情讨厌讨厌讨厌(▼皿▼#)"
],
"自慰": [
"这个世界的人类还真是恶心呢。",
"咱才不想讨论那些恶心的事情呢。",
"咱才不呢baka你居然想叫本小姐干那种事情哼(つд⊂)(生气)",
"baka你居然敢叫咱做这种事情讨厌讨厌讨厌(▼皿▼#)"
],
"onani": [
"这个世界的人类还真是恶心呢。",
"咱才不想讨论那些恶心的事情呢。",
"咱才不呢baka你居然想叫本小姐干那种事情哼(つд⊂)(生气)",
"baka你居然敢叫咱做这种事情讨厌讨厌讨厌(▼皿▼#)"
],
"オナニー": [
"这个世界的人类还真是恶心呢。",
"咱才不想讨论那些恶心的事情呢。",
"咱才不呢baka你居然想叫本小姐干那种事情哼(つд⊂)(生气)",
"baka你居然敢叫咱做这种事情讨厌讨厌讨厌(▼皿▼#)"
],
"炸了": [
"你才炸了!",
"才没有呢",
"咱好好的呀"
],
"色图": [
"天天色图色图的,今天就把你变成色图!",
"咱没有色图",
"哈?你的脑子一天都在想些什么呢,咱才没有这种东西啦。"
],
"涩图": [
"天天色图色图的,今天就把你变成色图!",
"咱没有色图",
"哈?你的脑子一天都在想些什么呢,咱才没有这种东西啦。"
],
"告白": [
"欸?你要向咱告白吗..好害羞..",
"诶!?这么突然!?人家还......还没做好心理准备呢(脸红)"
],
"对不起": [
"嗯,咱已经原谅你了呢(笑)",
"道歉的时候要露出胸部,这是常识"
],
"回来": [
"欢迎回来~",
"欢迎回来,你想喝茶吗?咱去给你沏~",
"欢迎回来,咱等你很久了~",
"你回来啦,是先吃饭呢还是先洗澡呢或者是●先●吃●咱●——呢(///^.^///"
],
"吻": [
"你太突然了,咱还没有心理准备",
"公共场合不要这样子了啦",
"才...才没有感觉呢!可没有下次了,知道了吗!哼~"
],
"软": [
"软乎乎的呢(,,・ω・,,)"
],
"柔软": [
"(脸红)请,请不要说这么让人害羞的话呀……"
],
"壁咚": [
"呀!不要啊!等一...下~",
"呜...不要啦!不要戏弄咱~",
"不要这样子啦(*/ω\*)",
"太....太近啦。",
"你要壁咚咱吗?好害羞(灬ꈍ εꈍ灬)",
"为什么要把咱按在墙上呢?",
"呜哇(/ω\)…快…快放开咱!!",
"放开我,不然我揍你了!放开我!放…开我~",
"??????咱只是默默地抬起了膝盖",
"啊.....你...你要干什么?!走开.....走开啦大hentai一巴掌拍飞(╯‵□′)╯︵┻━┻"
],
"掰开": [
"噫…你这个死肥宅又想让咱干什么污秽的事情,真是恶心,离咱远点好吗(嫌弃)",
"ヽ(#`Д´)ノ在干什么呢"
],
"女友": [
"女友什么的,咱才不承认呢!"
],
"是": [
"是什么是,你个笨蛋",
"总感觉你在敷衍呢..."
],
"喵": [
"诶~~小猫咪不要害怕呦,在姐姐怀里乖乖的,姐姐带你回去哦。",
"不要这么卖萌啦~咱也不知道怎么办丫",
"摸头⊙ω⊙",
"汪汪汪!",
"嗷~喵~",
"喵~?喵呜~w"
],
"嗷呜": [
"嗷呜嗷呜嗷呜...恶龙咆哮┗|O|┛"
],
"叫": [
"喵呜~",
"嗷呜嗷呜嗷呜...恶龙咆哮┗|O|┛"
],
"拜": [
"拜拜~(ノ ̄▽ ̄)",
"拜拜,路上小心~要早点回来陪咱玩哦~",
"~\\(≧▽≦)/~拜拜,下次见喽!"
],
"佬": [
"不是巨佬,是萌新"
],
"awsl": [
"你别死啊!(抱住使劲晃)",
"你别死啊咱又要孤单一个人了QAQ"
],
"臭": [
"哪里有臭味?(疑惑)",
"快捏住鼻子"
],
"香": [
"咱闻不到呢⊙ω⊙"
],
"腿": [
"嗯?!不要啊...请停下来!",
"不给摸,再这样咱要生气了ヽ( ̄д ̄;)",
"你好恶心啊,讨厌!",
"你难道是足控?",
"就让你摸一会哟~(。??ω??。)…",
"呜哇!好害羞...不过既然是你的话,是没关系的哦",
"不可以玩咱的大腿啦",
"你就那么喜欢大腿吗?唔...有点害羞呢......"
],
"脚": [
"咿呀……不要……",
"不要ヽ(≧Д≦)ノ好痒(ಡωಡ),人家的丝袜都要漏了",
"不要ヽ(≧Д≦)ノ好痒(ಡωಡ)",
"好痒(把脚伸出去)"
],
"胸": [
"不要啦ヽ(≧Д≦)",
"(-`ェ´-╬)",
"(•̀へ •́ ╮ ) 怎么能对咱做这种事情",
"你好恶心啊,讨厌!",
"你的眼睛在看哪里!",
"就让你摸一会哟~(。??ω??。)…",
"请不要这样先生,你想剁手吗?"
],
"脸": [
"唔!不可以随便摸咱的脸啦!",
"非洲血统是没法改变的呢(笑)",
"啊姆!(含手指)",
"好舒服呢(脸红)",
"请不要放开手啦//A//"
],
"头发": [
"没问题,请尽情的摸吧",
"发型要乱…乱了啦(脸红)",
"就让你摸一会哟~(。??ω??。)…"
],
"手": [
"爪爪",
"//A//"
],
"pr": [
"咿呀……不要……",
"...变态!!",
"不要啊(脸红)",
"呀,不要太过分了啊~",
"当然可以(///",
"呀,不要太过分了啊~"
],
"舔": [
"呀,不要太过分了啊~",
"要...要融化了啦>╱╱╱<",
"不可以哦",
"呀,不要太过分了啊~"
],
"舔耳": [
"喵!好痒啊 不要这样子啦"
],
"穴": [
"你这么问很失礼呢!咱是粉粉嫩嫩的!",
"不行那里不可以(´///ω/// `)",
"不可以总摸的哦不然的话咱会想那个的wwww",
"ヽ(#`Д´)ノ在干什么呢"
],
"腰": [
"咱给你按摩一下吧~",
"快松手,咱好害羞呀..",
"咱又不是猫,你不要搂着咱啦",
"让咱来帮你捏捏吧!"
],
"诶嘿嘿": [
"又在想什么H的事呢(脸红)",
"诶嘿嘿(〃'▽'〃)",
"你傻笑什么呢,摸摸"
],
"可爱": [
"诶嘿嘿(〃'▽'〃)",
"才……才不是为了你呢!你不要多想哦!",
"才,才没有高兴呢!哼~",
"咱是世界上最可爱的",
"唔...谢谢你夸奖~0///0"
],
"扭蛋": [
"铛铛铛——你抽到了咱呢",
"嘿~恭喜抽中空气一份呢"
],
"鼻子": [
"啊——唔...没什么...阿嚏!ヽ(*。>Д<)o゜"
],
"眼睛": [
"就如同咱的眼睛一样能看透人的思想哦wwww忽闪忽闪的诶嘿嘿~"
],
"色气": [
"咱才不色气呢,一定是你看错了!"
],
"推": [
"逆推",
"唔~好害羞呢",
"你想对咱做什么呢...(捂脸)"
],
"床": [
"快来吧",
"男女不同床,可没有下次了。(鼓脸",
"嗯?咱吗…没办法呢。只有这一次哦……",
"哎?!!!给你暖床……也不是不行啦。(脸红)"
],
"手冲": [
"手冲什么的是不可以的哦"
],
"饿": [
"请问主人是想先吃饭,还是先吃我喵?~"
],
"变": [
"猫猫不会变呐(弱气,害羞",
"呜...呜姆...喵喵来报恩了喵...(害羞"
],
"敲": [
"喵呜~",
"唔~",
"脑瓜疼~呜姆> <",
"欸喵,好痛的说..."
],
"爬": [
"惹~呜~怎么爬呢~",
"呜...(弱弱爬走"
],
"怕": [
"不怕~(蹭蹭你姆~"
],
"冲": [
"呜,冲不动惹~",
"哭唧唧~冲不出来了惹~"
],
"射了": [
"呜咿~!?(惊,害羞",
"还不可以射哦~"
],
"不穿衣服": [
"呜姆~!(惊吓,害羞)变...变态喵~~~"
],
"迫害": [
"不...不要...不要...呜呜呜...(害怕,抽泣"
],
"猫粮": [
"呜咿姆~!?(惊,接住吃",
"呜姆~!(惊,害羞)呜...谢...谢谢主人..喵...(脸红,嚼嚼嚼,开心",
"呜?谢谢喵~~(嚼嚼嚼,嘎嘣脆)"
],
"揪尾巴": [
"呜哇咿~~~!(惊吓,疼痛地捂住尾巴",
"呜咿咿咿~~~!!哇啊咿~~~!(惊慌,惨叫,挣扎",
"呜咿...(瘫倒,无神,被",
"呜姆咿~~~!(惊吓,惨叫,捂尾巴,发抖",
"呜哇咿~~~!!!(惊吓,颤抖,娇叫,捂住尾巴,双腿发抖"
],
"薄荷": [
"咪呜~!喵~...喵~姆~...(高兴地嗅闻",
"呜...呜咿~~!咿...姆...(呜咽,渐渐瘫软,意识模糊",
"(小嘴被猫薄荷塞满了,呜咽",
"喵~...喵~...咪...咪呜姆~...嘶哈嘶哈...喵哈...喵哈...嘶哈...喵...(眼睛逐渐迷离,瘫软在地上,嘴角流口水,吸猫薄荷吸到意识模糊",
"呜姆咪~!?(惊)喵呜~!(兴奋地扑到猫薄荷上面",
"呜姆~!(惊,害羞)呜...谢...谢谢你..喵...(脸红,轻轻叼住,嚼嚼嚼,开心"
],
"边揪尾巴边猫薄荷": [
"呜...呜咿~~!咿...姆...(呜咽,渐渐瘫软,意识模糊"
],
"早": [
"早喵~",
"早上好的说~~",
"欸..早..早上好(揉眼睛"
],
"晚安": [
"晚安好梦哟~",
"欸,晚安的说"
],
"揉": [
"是是,想怎么揉就怎么揉啊!?来用力抓啊!?我就是特别允许你这么做了!请!?",
"快停下,咱的头发又乱啦(??????︿??????)",
"你快放手啦,咱还在工作呢",
"戳戳你肚子",
"你想揉就揉吧..就这一次哦?"
],
"榨": [
"是专门负责榨果汁的小姐姐嘛?(´・ω・`)",
"那咱就把你放进榨汁机里了哦?",
"咱又不是榨汁姬(/‵Д′)~ ╧╧"
],
"掐": [
"你讨厌!又掐澪的脸",
"晃休啦咱要型气了啦o(><)o",
"(一只手拎起你)这么鶸还想和咱抗衡,还差得远呢!"
],
"奶子": [
"下流!",
"对咱说这种话,你真是太过分了",
"咿呀~好奇怪的感觉(>_<)",
"(打你)快放手,不可以随便摸人家的胸部啦!"
],
"嫩": [
"很可爱吧(๑•̀ω•́)",
"唔,你指的是什么呀"
],
"蹭蹭": [
"(按住你的头)好痒呀 不要啦",
"嗯..好舒服呢",
"呀~好痒啊~哈哈~,停下来啦,哈哈哈",
"(害羞)"
],
"牵手": [
"只许牵一下哦",
"嗯!好的你~(伸手)",
"你的手有些凉呢,让澪来暖一暖吧。"
],
"握手": [
"你的手真暖和呢",
"举爪"
],
"拍照": [
"那就拜托你啦~请把咱拍得更可爱一些吧w"
],
"w": [
"www"
],
"www": [
"有什么好笑的吗?",
"草"
],
"太二了": [
"哼,你不也是吗`(*><*)",
"人家只是想和你一起玩耍的说(≧∀≦)ゞ",
"好..冷漠的说,大坏蛋再也不理你了!",
"不听不听不听,反弹ヾ(≧▽≦*)o"
]
}

BIN
docs/ban.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

BIN
docs/beidong.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

BIN
docs/buff.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

BIN
docs/check.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
docs/coser.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 KiB

BIN
docs/daoju.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

BIN
docs/epic.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 KiB

BIN
docs/fanyi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

BIN
docs/guanli.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
docs/help.PNG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 697 KiB

BIN
docs/huifu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
docs/info.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
docs/jiaxiaoxi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 KiB

BIN
docs/jieshao.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

BIN
docs/jitang.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
docs/kaixiang.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

BIN
docs/kg1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

BIN
docs/kg2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

BIN
docs/kg3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
docs/luxun.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 KiB

BIN
docs/mawo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
docs/nicheng1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
docs/nicheng2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
docs/ocgn.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
docs/ocgn2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

BIN
docs/one_firend.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
docs/p_rank.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
docs/p_sou.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

BIN
docs/qhyxx.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 KiB

BIN
docs/qunhuanying.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 KiB

BIN
docs/send_img.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 KiB

BIN
docs/shifan.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 KiB

BIN
docs/shitu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 KiB

BIN
docs/shop.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

BIN
docs/sign.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

BIN
docs/tupian.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
docs/w2b.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

BIN
docs/zhenxun.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

190
models/bag_user.py Normal file
View File

@ -0,0 +1,190 @@
from services.db_context import db
class UserBag(db.Model):
__tablename__ = 'bag_users'
id = db.Column(db.Integer(), primary_key=True)
user_qq = db.Column(db.BigInteger(), nullable=False)
belonging_group = db.Column(db.BigInteger(), nullable=False)
gold = db.Column(db.Integer(), default=100)
props = db.Column(db.TEXT(), nullable=False, default="")
spend_total_gold = db.Column(db.Integer(), default=0)
get_total_gold = db.Column(db.Integer(), default=0)
get_today_gold = db.Column(db.Integer(), default=0)
spend_today_gold = db.Column(db.Integer(), default=0)
_idx1 = db.Index('bag_group_users_idx1', 'user_qq', 'belonging_group', unique=True)
@classmethod
async def get_my_total_gold(cls, user_qq: int, belonging_group: int) -> str:
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
)
user = await query.gino.first()
if not user:
user = await cls.create(
user_qq=user_qq,
belonging_group=belonging_group,
)
return f'当前金币:{user.gold}\n今日获取金币:{user.get_today_gold}\n今日花费金币:{user.spend_today_gold}' \
f'\n今日收益:{user.get_today_gold - user.spend_today_gold}' \
f'\n总赚取金币:{user.get_total_gold}\n总花费金币:{user.spend_total_gold}'
@classmethod
async def get_gold(cls, user_qq: int, belonging_group: int) -> int:
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
)
user = await query.gino.first()
if user:
return user.gold
else:
await cls.create(
user_qq=user_qq,
belonging_group=belonging_group,
)
return 100
@classmethod
async def get_props(cls, user_qq: int, belonging_group: int) -> str:
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
)
user = await query.gino.first()
if user:
return user.props
else:
await cls.create(
user_qq=user_qq,
belonging_group=belonging_group,
)
return ''
@classmethod
async def add_glod(cls, user_qq: int, belonging_group: int, num: int) -> bool:
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
)
query = query.with_for_update()
user = await query.gino.first()
try:
if user:
await user.update(
gold=user.gold + num,
get_total_gold=user.get_total_gold + num,
get_today_gold=user.get_today_gold + num
).apply()
else:
await cls.create(
user_qq=user_qq,
belonging_group=belonging_group,
gold=100 + num,
get_total_gold=num,
get_today_gold=num,
)
return True
except Exception:
return False
@classmethod
async def spend_glod(cls, user_qq: int, belonging_group: int, num: int) -> bool:
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
)
query = query.with_for_update()
user = await query.gino.first()
try:
if user:
await user.update(
gold=user.gold - num,
spend_total_gold=user.spend_total_gold + num,
spend_today_gold=user.spend_today_gold + num
).apply()
else:
await cls.create(
user_qq=user_qq,
belonging_group=belonging_group,
gold=100 - num,
spend_total_gold=num,
spend_today_gold=num
)
return True
except Exception:
return False
@classmethod
async def add_props(cls, user_qq: int, belonging_group: int, name: str) -> bool:
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
)
query = query.with_for_update()
user = await query.gino.first()
try:
if user:
await user.update(
props=user.props + f'{name},'
).apply()
else:
await cls.create(
user_qq=user_qq,
belonging_group=belonging_group,
props=f'{name},'
)
return True
except Exception:
return False
@classmethod
async def del_props(cls, user_qq: int, belonging_group: int, name: str) -> bool:
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
)
query = query.with_for_update()
user = await query.gino.first()
try:
if user:
rst = ''
props = user.props
if props.find(name) != -1:
props = props.split(',')
try:
index = props.index(name)
except ValueError:
return False
props = props[:index] + props[index + 1:]
for p in props:
if p != '':
rst += p + ','
await user.update(
props=rst
).apply()
return True
else:
return False
else:
return False
except Exception:
return False
@classmethod
async def get_user_all(cls, group_id: int = None) -> list:
user_list = []
if not group_id:
query = await cls.query.gino.all()
else:
query = await cls.query.where(
(cls.belonging_group == group_id)
).gino.all()
for user in query:
user_list.append(user)
return user_list

84
models/ban_user.py Normal file
View File

@ -0,0 +1,84 @@
from services.db_context import db
import time
class BanUser(db.Model):
__tablename__ = 'ban_users'
user_qq = db.Column(db.BigInteger(), nullable=False, primary_key=True)
ban_level = db.Column(db.Integer(), nullable=False)
ban_time = db.Column(db.BigInteger())
duration = db.Column(db.BigInteger())
_idx1 = db.Index('ban_group_users_idx1', 'user_qq', unique=True)
@classmethod
async def check_ban_level(cls, user_qq: int, level: int) -> 'bool':
user = await cls.query.where(
(cls.user_qq == user_qq)
).gino.first()
if not user:
return False
if user.ban_level > level:
return True
return False
@classmethod
async def check_ban_time(cls, user_qq: int) -> 'str':
query = cls.query.where(
(cls.user_qq == user_qq)
)
user = await query.gino.first()
if not user:
return ''
if time.time() - (user.ban_time + user.duration) > 0 and user.duration != -1:
return ''
if user.duration == -1:
return ''
return time.time() - user.ban_time - user.duration
@classmethod
async def isban(cls, user_qq: int) -> 'bool':
if await cls.check_ban_time(user_qq):
return True
else:
await cls.unban(user_qq, True)
return False
@classmethod
async def ban(cls, user_qq: int, ban_level: int, duration: int, for_update: bool = False) -> 'bool':
query = cls.query.where(
(cls.user_qq == user_qq)
)
if for_update:
query = await query.with_for_update()
user = await query.gino.first()
if not await cls.check_ban_time(user_qq):
await cls.unban(user_qq)
user = None
if user is None:
await cls.create(
user_qq=user_qq,
ban_level=ban_level,
ban_time=time.time(),
duration=duration,
)
return True
else:
return False
@classmethod
async def unban(cls, user_qq: int, for_update: bool = False) -> 'bool':
query = cls.query.where(
(cls.user_qq == user_qq)
)
if for_update:
query = query.with_for_update()
user = await query.gino.first()
if user is None:
return False
else:
await cls.delete.where(
(cls.user_qq == user_qq)
).gino.status()
return True

33
models/buff_price.py Normal file
View File

@ -0,0 +1,33 @@
from datetime import datetime
from services.db_context import db
# 1.狂牙武器箱
class BuffPrice(db.Model):
__tablename__ = 'buff_prices'
id = db.Column(db.Integer(), primary_key=True)
case_id = db.Column(db.Integer(), nullable=False)
skin_name = db.Column(db.Unicode(), nullable=False)
skin_price = db.Column(db.Float(), nullable=False)
update_date = db.Column(db.DateTime(), nullable=False)
_idx1 = db.Index('buff_price_idx1', 'skin_name', unique=True)
@classmethod
async def ensure(cls, skin_name: str, for_update: bool = False) -> 'BuffPrice':
query = cls.query.where(
(cls.skin_name == skin_name)
)
if for_update:
query = query.with_for_update()
user = await query.gino.first()
return user or await cls.create(
case_id=1,
skin_name=skin_name,
skin_price=0,
update_date=datetime.min,
)

78
models/count_user.py Normal file
View File

@ -0,0 +1,78 @@
from services.db_context import db
class UserCount(db.Model):
__tablename__ = 'count_users'
user_qq = db.Column(db.BigInteger(), nullable=False, primary_key=True)
reimu_count = db.Column(db.Integer(), nullable=False, default=0)
setu_r18_count = db.Column(db.Integer(), nullable=False, default=0)
_idx1 = db.Index('sign_reimu_users_idx1', 'user_qq', unique=True)
@classmethod
async def add_user(cls, user_qq: int):
query = cls.query.where(
(cls.user_qq == user_qq)
)
query = query.with_for_update()
if not await query.gino.first():
await cls.create(
user_qq=user_qq,
)
@classmethod
async def add_count(cls, user_qq: int, name: str, count: int = 1):
query = cls.query.where(
(cls.user_qq == user_qq)
)
query = query.with_for_update()
user = await query.gino.first()
if user:
if name == 'reimu':
await user.update(
reimu_count=cls.reimu_count + count
).apply()
if name == 'setu_r18':
await user.update(
setu_r18_count=cls.setu_r18_count + count
).apply()
else:
await cls.create(
user_qq=user_qq
)
@classmethod
async def check_count(cls, user_qq: int, name: str, max_count: int) -> bool:
query = cls.query.where(
(cls.user_qq == user_qq)
)
user = await query.gino.first()
if user:
if name == 'reimu':
if user.reimu_count == max_count:
return True
else:
return False
if name == 'setu_r18':
if user.setu_r18_count == max_count:
return True
else:
return False
else:
await cls.add_user(user_qq)
return False
@classmethod
async def reset_count(cls):
for user in await cls.query.gino.all():
await user.update(
reimu_count=0,
setu_r18_count=0
).apply()

87
models/friend_user.py Normal file
View File

@ -0,0 +1,87 @@
from services.db_context import db
class FriendUser(db.Model):
__tablename__ = 'friend_users'
id = db.Column(db.Integer(), primary_key=True)
user_id = db.Column(db.BigInteger(), nullable=False)
user_name = db.Column(db.Unicode(), nullable=False, default="")
nickname = db.Column(db.Unicode())
_idx1 = db.Index('friend_users_idx1', 'user_id', unique=True)
@classmethod
async def get_user_name(cls, user_id: int) -> str:
query = cls.query.where(
cls.user_id == user_id
)
user = await query.gino.first()
if user:
return user.user_name
else:
return ''
@classmethod
async def add_friend_info(cls, user_id: int, user_name: str) -> 'bool':
try:
query = cls.query.where(
cls.user_id == user_id
)
user = await query.with_for_update().gino.first()
if not user:
await cls.create(
user_id=user_id,
user_name=user_name,
)
else:
await user.update(
user_name=user_name,
).apply()
return True
except Exception:
return False
@classmethod
async def delete_friend_info(cls, user_id: int) -> 'bool':
try:
query = cls.query.where(
cls.user_id == user_id
)
user = await query.with_for_update().gino.first()
if user:
await user.delete()
return True
except Exception:
return False
@classmethod
async def get_friend_nickname(cls, user_id: int) -> 'str':
query = cls.query.where(
cls.user_id == user_id
)
user = await query.with_for_update().gino.first()
if user:
if user.nickname:
return user.nickname
return ''
@classmethod
async def set_friend_nickname(cls, user_id: int, nickname: str) -> 'bool':
try:
query = cls.query.where(
cls.user_id == user_id
)
user = await query.with_for_update().gino.first()
if not user:
await cls.create(
user_id=user_id,
nickname=nickname,
)
else:
await user.update(
nickname=nickname,
).apply()
return True
except Exception:
return False

56
models/group_info.py Normal file
View File

@ -0,0 +1,56 @@
from services.db_context import db
class GroupInfo(db.Model):
__tablename__ = 'group_info'
group_id = db.Column(db.BigInteger(), nullable=False, primary_key=True)
group_name = db.Column(db.Unicode(), nullable=False, default="")
max_member_count = db.Column(db.Integer(), nullable=False, default=0)
member_count = db.Column(db.Integer(), nullable=False, default=0)
_idx1 = db.Index('group_info_idx1', 'group_id', unique=True)
@classmethod
async def get_group_info(cls, group_id: int) -> 'GroupInfo':
query = cls.query.where(
cls.group_id == group_id
)
return await query.gino.first()
@classmethod
async def add_group_info(cls, group_id: int, group_name: str, max_member_count: int, member_count: int) -> bool:
try:
group = await cls.query.where(
cls.group_id == group_id
).with_for_update().gino.first()
if group:
await cls.update(
group_id=group_id,
group_name=group_name,
max_member_count=max_member_count,
member_count=member_count,
).apply()
else:
await cls.create(
group_id=group_id,
group_name=group_name,
max_member_count=max_member_count,
member_count=member_count,
)
return True
except Exception:
return False
@classmethod
async def delete_group_info(cls, group_id: int) -> bool:
try:
await cls.delete.where(
cls.group_id == group_id
).gino.status()
return True
except Exception:
return False

View File

@ -0,0 +1,99 @@
from datetime import datetime
from services.db_context import db
class GroupInfoUser(db.Model):
__tablename__ = 'group_info_users'
id = db.Column(db.Integer(), primary_key=True)
user_qq = db.Column(db.BigInteger(), nullable=False)
user_name = db.Column(db.Unicode(), nullable=False)
belonging_group = db.Column(db.BigInteger(), nullable=False)
user_join_time = db.Column(db.DateTime(), nullable=False)
nickname = db.Column(db.Unicode())
_idx1 = db.Index('info_group_users_idx1', 'user_qq', 'belonging_group', unique=True)
@classmethod
async def insert(cls, user_qq: int, belonging_group: int, user_name: str, user_join_time: datetime) -> 'bool':
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
)
query = query.with_for_update()
try:
if await query.gino.first() is None:
await cls.create(
user_qq=user_qq,
user_name=user_name,
belonging_group=belonging_group,
user_join_time=user_join_time,
)
return True
except:
return False
@classmethod
async def select_member_info(cls, user_qq: int, belonging_group: int) -> 'GroupInfoUser':
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
)
return await query.gino.first()
@classmethod
async def delete_member_info(cls, user_qq: int, belonging_group: int) -> 'bool':
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
)
query = query.with_for_update()
user = await query.gino.first()
try:
if user is None:
return True
else:
await cls.delete.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
).gino.status()
return True
except:
return False
@classmethod
async def query_group_member_list(cls, belonging_group: int) -> 'list':
member_list = []
query = cls.query.where(
(cls.belonging_group == belonging_group)
)
for user in await query.gino.all():
member_list.append(user.user_qq)
return member_list
@classmethod
async def set_group_member_nickname(cls, user_qq: int, belonging_group: int, nickname: str) -> 'bool':
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
)
user = await query.gino.first()
if user:
await user.update(
nickname=nickname
).apply()
return True
return False
@classmethod
async def get_group_member_nickname(cls, user_qq: int, belonging_group: int) -> 'str':
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
)
user = await query.gino.first()
if user:
if user.nickname:
return user.nickname
return ''

100
models/group_remind.py Normal file
View File

@ -0,0 +1,100 @@
from services.db_context import db
class GroupRemind(db.Model):
__tablename__ = 'group_reminds'
id = db.Column(db.Integer(), primary_key=True)
group_id = db.Column(db.BigInteger(), nullable=False)
hy = db.Column(db.Boolean(), default=True) # 进群欢迎
kxcz = db.Column(db.Boolean(), default=True) # 开箱重置
zwa = db.Column(db.Boolean(), default=True) # 早晚安
gb = db.Column(db.Boolean(), default=True) # 广播
blpar = db.Column(db.Boolean(), default=True) # bilibili转发解析
pa = db.Column(db.Boolean(), default=True) # 爬
epic = db.Column(db.Boolean(), default=False) # epic
almanac = db.Column(db.Boolean(), default=False) # 原神黄历
_idx1 = db.Index('info_group_reminds_idx1', 'group_id', unique=True)
@classmethod
async def get_status(cls, group_id: int, name: str) -> bool:
group = await cls.query.where(
(cls.group_id == group_id)
).gino.first()
if not group:
group = await cls.create(
group_id=group_id,
)
if name == 'hy':
return group.hy
if name == 'kxcz':
return group.kxcz
if name == 'zwa':
return group.zwa
if name == 'gb':
return group.gb
if name == 'blpar':
return group.blpar
if name == 'epic':
return group.epic
if name == 'pa':
return group.pa
if name == 'almanac':
return group.almanac
@classmethod
async def set_status(cls, group_id: int, name: str, status: bool) -> bool:
try:
group = await cls.query.where(
(cls.group_id == group_id)
).gino.first()
if not group:
group = await cls.create(
group_id=group_id,
)
if name == 'hy':
await group.update(
hy=status,
).apply()
if name == 'kxcz':
await group.update(
kxcz=status,
).apply()
if name == 'zwa':
await group.update(
zwa=status,
).apply()
if name == 'gb':
await group.update(
gb=status,
).apply()
if name == 'blpar':
await group.update(
blpar=status,
).apply()
if name == 'epic':
await group.update(
epic=status,
).apply()
if name == 'pa':
await group.update(
pa=status,
).apply()
if name == 'almanac':
await group.update(
almanac=status,
).apply()
return True
except Exception as e:
return False

94
models/level_user.py Normal file
View File

@ -0,0 +1,94 @@
from services.db_context import db
class LevelUser(db.Model):
__tablename__ = 'level_users'
id = db.Column(db.Integer(), primary_key=True)
user_qq = db.Column(db.BigInteger(), nullable=False)
group_id = db.Column(db.BigInteger(), nullable=False)
user_level = db.Column(db.BigInteger(), nullable=False)
group_flag = db.Column(db.Integer(), nullable=False, default=0)
_idx1 = db.Index('level_group_users_idx1', 'user_qq', 'group_id', unique=True)
@classmethod
async def get_user_level(cls, user_qq: int, group_id: int) -> int:
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.group_id == group_id)
)
user = await query.gino.first()
if user:
return user.user_level
else:
return -1
@classmethod
async def set_level(cls, user_qq: int, group_id: int, level: int, group_flag: int = 0) -> 'bool':
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.group_id == group_id)
)
query = query.with_for_update()
user = await query.gino.first()
if user is None:
await cls.create(
user_qq=user_qq,
group_id=group_id,
user_level=level,
group_flag=group_flag,
)
return True
else:
await user.update(user_level=level, group_flag=group_flag).apply()
return False
@classmethod
async def delete_level(cls, user_qq: int, group_id: int, for_update: bool = False) -> 'bool':
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.group_id == group_id)
)
if for_update:
query = query.with_for_update()
user = await query.gino.first()
if user is None:
return False
else:
await user.delete()
return True
@classmethod
async def check_level(cls, user_qq: int, group_id: int, level: int) -> 'bool':
if group_id != 0:
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.group_id == group_id)
)
user = await query.gino.first()
if user is None:
return False
user_level = user.user_level
else:
query = cls.query.where(
cls.user_qq == user_qq
)
highest_level = 0
for user in await query.gino.all():
if user.user_level > highest_level:
highest_level = user.user_level
user_level = highest_level
if user_level >= level:
return True
else:
return False
@classmethod
async def is_group_flag(cls, user_qq: int, group_id: int) -> 'bool':
user = await cls.query.where(
(cls.user_qq == user_qq) & (cls.group_id == group_id)
).gino.first()
if not user:
return False
if user.group_flag == 1:
return True
else:
return False

59
models/open_cases_user.py Normal file
View File

@ -0,0 +1,59 @@
from datetime import datetime
from services.db_context import db
class OpenCasesUser(db.Model):
__tablename__ = 'open_cases_users'
id = db.Column(db.Integer(), primary_key=True)
user_qq = db.Column(db.BigInteger(), nullable=False)
belonging_group = db.Column(db.BigInteger(), nullable=False)
total_count = db.Column(db.Integer(), nullable=False, default=0)
blue_count = db.Column(db.Integer(), nullable=False, default=0)
blue_st_count = db.Column(db.Integer(), nullable=False, default=0)
purple_count = db.Column(db.Integer(), nullable=False, default=0)
purple_st_count = db.Column(db.Integer(), nullable=False, default=0)
pink_count = db.Column(db.Integer(), nullable=False, default=0)
pink_st_count = db.Column(db.Integer(), nullable=False, default=0)
red_count = db.Column(db.Integer(), nullable=False, default=0)
red_st_count = db.Column(db.Integer(), nullable=False, default=0)
knife_count = db.Column(db.Integer(), nullable=False, default=0)
knife_st_count = db.Column(db.Integer(), nullable=False, default=0)
spend_money = db.Column(db.Integer(), nullable=False, default=0)
make_money = db.Column(db.Float(), nullable=False, default=0)
today_open_total = db.Column(db.Integer(), nullable=False, default=0)
open_cases_time_last = db.Column(db.DateTime(timezone=True), nullable=False, default=datetime.now())
knifes_name = db.Column(db.Unicode(), nullable=False, default="")
_idx1 = db.Index('open_cases_group_users_idx1', 'user_qq', 'belonging_group', unique=True)
@classmethod
async def ensure(cls, user_qq: int, belonging_group: int, for_update: bool = False) -> 'OpenCasesUser':
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
)
if for_update:
query = query.with_for_update()
user = await query.gino.first()
return user or await cls.create(
user_qq=user_qq,
belonging_group=belonging_group,
)
@classmethod
async def get_user_all(cls, group_id: int = None) -> 'list':
user_list = []
if not group_id:
query = await cls.query.gino.all()
else:
query = await cls.query.where(
(cls.belonging_group == group_id)
).gino.all()
for user in query:
user_list.append(user)
return user_list

View File

@ -0,0 +1,59 @@
from datetime import datetime
from services.db_context import db
class SignGroupUser(db.Model):
__tablename__ = 'sign_group_users'
id = db.Column(db.Integer(), primary_key=True)
user_qq = db.Column(db.BigInteger(), nullable=False)
belonging_group = db.Column(db.BigInteger(), nullable=False)
checkin_count = db.Column(db.Integer(), nullable=False)
checkin_time_last = db.Column(db.DateTime(timezone=True), nullable=False)
impression = db.Column(db.Numeric(scale=3, asdecimal=False), nullable=False)
add_probability = db.Column(db.Numeric(scale=3, asdecimal=False), nullable=False, default=0)
specify_probability = db.Column(db.Numeric(scale=3, asdecimal=False), nullable=False, default=0)
_idx1 = db.Index('sign_group_users_idx1', 'user_qq', 'belonging_group', unique=True)
@classmethod
async def ensure(cls, user_qq: int, belonging_group: int, for_update: bool = False) -> 'SignGroupUser':
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
)
if for_update:
query = query.with_for_update()
user = await query.gino.first()
return user or await cls.create(
user_qq=user_qq,
belonging_group=belonging_group,
checkin_count=0,
checkin_time_last=datetime.min, # 从未签到过
impression=0,
)
@classmethod
async def query_impression_all(cls, belonging_group: int) -> 'list,list':
impression_list = []
user_qq_list = []
query = cls.query.where(
(cls.belonging_group == belonging_group)
)
for user in await query.gino.all():
impression_list.append(user.impression)
user_qq_list.append(user.user_qq)
return user_qq_list, impression_list
@classmethod
async def query_glod_all(cls, belonging_group: int) -> 'list,list':
glod_list = []
user_qq_list = []
query = cls.query.where(
(cls.belonging_group == belonging_group)
)
for user in await query.gino.all():
glod_list.append(user.glod)
user_qq_list.append(user.user_qq)
return user_qq_list, glod_list

0
plugins/__init__.py Normal file
View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More