diff --git a/assets/maimai/static/mai/pic/LICENSE b/assets/maimai/static/mai/pic/LICENSE new file mode 100644 index 00000000..a4715202 --- /dev/null +++ b/assets/maimai/static/mai/pic/LICENSE @@ -0,0 +1,121 @@ +Creative Commons Legal Code + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. \ No newline at end of file diff --git a/assets/maimai/static/mai/pic/UI_CMN_DXRating_S_01.png b/assets/maimai/static/mai/pic/UI_CMN_DXRating_S_01.png new file mode 100644 index 00000000..5a9c90da Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_CMN_DXRating_S_01.png differ diff --git a/assets/maimai/static/mai/pic/UI_CMN_DXRating_S_02.png b/assets/maimai/static/mai/pic/UI_CMN_DXRating_S_02.png new file mode 100644 index 00000000..fb630dd7 Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_CMN_DXRating_S_02.png differ diff --git a/assets/maimai/static/mai/pic/UI_CMN_DXRating_S_03.png b/assets/maimai/static/mai/pic/UI_CMN_DXRating_S_03.png new file mode 100644 index 00000000..59fbe417 Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_CMN_DXRating_S_03.png differ diff --git a/assets/maimai/static/mai/pic/UI_CMN_DXRating_S_04.png b/assets/maimai/static/mai/pic/UI_CMN_DXRating_S_04.png new file mode 100644 index 00000000..9aed9762 Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_CMN_DXRating_S_04.png differ diff --git a/assets/maimai/static/mai/pic/UI_CMN_DXRating_S_05.png b/assets/maimai/static/mai/pic/UI_CMN_DXRating_S_05.png new file mode 100644 index 00000000..2eefb2c5 Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_CMN_DXRating_S_05.png differ diff --git a/assets/maimai/static/mai/pic/UI_CMN_DXRating_S_06.png b/assets/maimai/static/mai/pic/UI_CMN_DXRating_S_06.png new file mode 100644 index 00000000..de4fd344 Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_CMN_DXRating_S_06.png differ diff --git a/assets/maimai/static/mai/pic/UI_CMN_DXRating_S_07.png b/assets/maimai/static/mai/pic/UI_CMN_DXRating_S_07.png new file mode 100644 index 00000000..688b65ae Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_CMN_DXRating_S_07.png differ diff --git a/assets/maimai/static/mai/pic/UI_CMN_DXRating_S_08.png b/assets/maimai/static/mai/pic/UI_CMN_DXRating_S_08.png new file mode 100644 index 00000000..18d8fc1e Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_CMN_DXRating_S_08.png differ diff --git a/assets/maimai/static/mai/pic/UI_CMN_DXRating_S_09.png b/assets/maimai/static/mai/pic/UI_CMN_DXRating_S_09.png new file mode 100644 index 00000000..ceb8056a Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_CMN_DXRating_S_09.png differ diff --git a/assets/maimai/static/mai/pic/UI_CMN_DXRating_S_10.png b/assets/maimai/static/mai/pic/UI_CMN_DXRating_S_10.png new file mode 100644 index 00000000..3b6e600b Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_CMN_DXRating_S_10.png differ diff --git a/assets/maimai/static/mai/pic/UI_CMN_MiniDialog_01.png b/assets/maimai/static/mai/pic/UI_CMN_MiniDialog_01.png new file mode 100644 index 00000000..729476dd Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_CMN_MiniDialog_01.png differ diff --git a/assets/maimai/static/mai/pic/UI_CMN_Name_DX.png b/assets/maimai/static/mai/pic/UI_CMN_Name_DX.png new file mode 100644 index 00000000..2c44b7db Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_CMN_Name_DX.png differ diff --git a/assets/maimai/static/mai/pic/UI_CMN_Shougou_Rainbow.png b/assets/maimai/static/mai/pic/UI_CMN_Shougou_Rainbow.png new file mode 100644 index 00000000..ecbc0bdc Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_CMN_Shougou_Rainbow.png differ diff --git a/assets/maimai/static/mai/pic/UI_CMN_TabTitle_MaimaiTitle_Ver214.png b/assets/maimai/static/mai/pic/UI_CMN_TabTitle_MaimaiTitle_Ver214.png new file mode 100644 index 00000000..1f07453f Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_CMN_TabTitle_MaimaiTitle_Ver214.png differ diff --git a/assets/maimai/static/mai/pic/UI_GAM_Rank_AAA.png b/assets/maimai/static/mai/pic/UI_GAM_Rank_AAA.png new file mode 100644 index 00000000..8da35021 Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_GAM_Rank_AAA.png differ diff --git a/assets/maimai/static/mai/pic/UI_GAM_Rank_B.png b/assets/maimai/static/mai/pic/UI_GAM_Rank_B.png new file mode 100644 index 00000000..efa112f0 Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_GAM_Rank_B.png differ diff --git a/assets/maimai/static/mai/pic/UI_GAM_Rank_BB.png b/assets/maimai/static/mai/pic/UI_GAM_Rank_BB.png new file mode 100644 index 00000000..ae198081 Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_GAM_Rank_BB.png differ diff --git a/assets/maimai/static/mai/pic/UI_GAM_Rank_BBB.png b/assets/maimai/static/mai/pic/UI_GAM_Rank_BBB.png new file mode 100644 index 00000000..c9a18b5b Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_GAM_Rank_BBB.png differ diff --git a/assets/maimai/static/mai/pic/UI_GAM_Rank_C.png b/assets/maimai/static/mai/pic/UI_GAM_Rank_C.png new file mode 100644 index 00000000..3647e7ac Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_GAM_Rank_C.png differ diff --git a/assets/maimai/static/mai/pic/UI_GAM_Rank_D.png b/assets/maimai/static/mai/pic/UI_GAM_Rank_D.png new file mode 100644 index 00000000..94aafc26 Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_GAM_Rank_D.png differ diff --git a/assets/maimai/static/mai/pic/UI_GAM_Rank_S.png b/assets/maimai/static/mai/pic/UI_GAM_Rank_S.png new file mode 100644 index 00000000..5947c4ce Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_GAM_Rank_S.png differ diff --git a/assets/maimai/static/mai/pic/UI_GAM_Rank_SS.png b/assets/maimai/static/mai/pic/UI_GAM_Rank_SS.png new file mode 100644 index 00000000..c8f027f5 Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_GAM_Rank_SS.png differ diff --git a/assets/maimai/static/mai/pic/UI_GAM_Rank_SSS.png b/assets/maimai/static/mai/pic/UI_GAM_Rank_SSS.png new file mode 100644 index 00000000..0897375d Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_GAM_Rank_SSS.png differ diff --git a/assets/maimai/static/mai/pic/UI_GAM_Rank_SSSp.png b/assets/maimai/static/mai/pic/UI_GAM_Rank_SSSp.png new file mode 100644 index 00000000..d798fd85 Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_GAM_Rank_SSSp.png differ diff --git a/assets/maimai/static/mai/pic/UI_GAM_Rank_SSp.png b/assets/maimai/static/mai/pic/UI_GAM_Rank_SSp.png new file mode 100644 index 00000000..df680fe7 Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_GAM_Rank_SSp.png differ diff --git a/assets/maimai/static/mai/pic/UI_GAM_Rank_Sp.png b/assets/maimai/static/mai/pic/UI_GAM_Rank_Sp.png new file mode 100644 index 00000000..4d36f49d Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_GAM_Rank_Sp.png differ diff --git a/assets/maimai/static/mai/pic/UI_MSS_MBase_Icon_AP_S.png b/assets/maimai/static/mai/pic/UI_MSS_MBase_Icon_AP_S.png new file mode 100644 index 00000000..fbb6af44 Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_MSS_MBase_Icon_AP_S.png differ diff --git a/assets/maimai/static/mai/pic/UI_MSS_MBase_Icon_APp_S.png b/assets/maimai/static/mai/pic/UI_MSS_MBase_Icon_APp_S.png new file mode 100644 index 00000000..b19804b7 Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_MSS_MBase_Icon_APp_S.png differ diff --git a/assets/maimai/static/mai/pic/UI_MSS_MBase_Icon_FC_S.png b/assets/maimai/static/mai/pic/UI_MSS_MBase_Icon_FC_S.png new file mode 100644 index 00000000..ff37604c Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_MSS_MBase_Icon_FC_S.png differ diff --git a/assets/maimai/static/mai/pic/UI_MSS_MBase_Icon_FCp_S.png b/assets/maimai/static/mai/pic/UI_MSS_MBase_Icon_FCp_S.png new file mode 100644 index 00000000..bc832181 Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_MSS_MBase_Icon_FCp_S.png differ diff --git a/assets/maimai/static/mai/pic/UI_MSS_MBase_Icon_FSD_S.png b/assets/maimai/static/mai/pic/UI_MSS_MBase_Icon_FSD_S.png new file mode 100644 index 00000000..bd617dab Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_MSS_MBase_Icon_FSD_S.png differ diff --git a/assets/maimai/static/mai/pic/UI_MSS_MBase_Icon_FSDp_S.png b/assets/maimai/static/mai/pic/UI_MSS_MBase_Icon_FSDp_S.png new file mode 100644 index 00000000..7df2fe9f Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_MSS_MBase_Icon_FSDp_S.png differ diff --git a/assets/maimai/static/mai/pic/UI_MSS_MBase_Icon_FS_S.png b/assets/maimai/static/mai/pic/UI_MSS_MBase_Icon_FS_S.png new file mode 100644 index 00000000..fab64acc Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_MSS_MBase_Icon_FS_S.png differ diff --git a/assets/maimai/static/mai/pic/UI_MSS_MBase_Icon_FSp_S.png b/assets/maimai/static/mai/pic/UI_MSS_MBase_Icon_FSp_S.png new file mode 100644 index 00000000..a2e2b852 Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_MSS_MBase_Icon_FSp_S.png differ diff --git a/assets/maimai/static/mai/pic/UI_NUM_Drating_0.png b/assets/maimai/static/mai/pic/UI_NUM_Drating_0.png new file mode 100644 index 00000000..0d1cf1cc Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_NUM_Drating_0.png differ diff --git a/assets/maimai/static/mai/pic/UI_NUM_Drating_1.png b/assets/maimai/static/mai/pic/UI_NUM_Drating_1.png new file mode 100644 index 00000000..f69f8700 Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_NUM_Drating_1.png differ diff --git a/assets/maimai/static/mai/pic/UI_NUM_Drating_2.png b/assets/maimai/static/mai/pic/UI_NUM_Drating_2.png new file mode 100644 index 00000000..3942ef59 Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_NUM_Drating_2.png differ diff --git a/assets/maimai/static/mai/pic/UI_NUM_Drating_3.png b/assets/maimai/static/mai/pic/UI_NUM_Drating_3.png new file mode 100644 index 00000000..7c91b782 Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_NUM_Drating_3.png differ diff --git a/assets/maimai/static/mai/pic/UI_NUM_Drating_4.png b/assets/maimai/static/mai/pic/UI_NUM_Drating_4.png new file mode 100644 index 00000000..78d845e3 Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_NUM_Drating_4.png differ diff --git a/assets/maimai/static/mai/pic/UI_NUM_Drating_5.png b/assets/maimai/static/mai/pic/UI_NUM_Drating_5.png new file mode 100644 index 00000000..77dcaa91 Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_NUM_Drating_5.png differ diff --git a/assets/maimai/static/mai/pic/UI_NUM_Drating_6.png b/assets/maimai/static/mai/pic/UI_NUM_Drating_6.png new file mode 100644 index 00000000..c8649130 Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_NUM_Drating_6.png differ diff --git a/assets/maimai/static/mai/pic/UI_NUM_Drating_7.png b/assets/maimai/static/mai/pic/UI_NUM_Drating_7.png new file mode 100644 index 00000000..cba0620f Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_NUM_Drating_7.png differ diff --git a/assets/maimai/static/mai/pic/UI_NUM_Drating_8.png b/assets/maimai/static/mai/pic/UI_NUM_Drating_8.png new file mode 100644 index 00000000..aa2dde9f Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_NUM_Drating_8.png differ diff --git a/assets/maimai/static/mai/pic/UI_NUM_Drating_9.png b/assets/maimai/static/mai/pic/UI_NUM_Drating_9.png new file mode 100644 index 00000000..0b7063f3 Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_NUM_Drating_9.png differ diff --git a/assets/maimai/static/mai/pic/UI_RSL_MBase_Parts_01.png b/assets/maimai/static/mai/pic/UI_RSL_MBase_Parts_01.png new file mode 100644 index 00000000..f9257867 Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_RSL_MBase_Parts_01.png differ diff --git a/assets/maimai/static/mai/pic/UI_RSL_MBase_Parts_02.png b/assets/maimai/static/mai/pic/UI_RSL_MBase_Parts_02.png new file mode 100644 index 00000000..c841e3d5 Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_RSL_MBase_Parts_02.png differ diff --git a/assets/maimai/static/mai/pic/UI_TST_PlateMask.png b/assets/maimai/static/mai/pic/UI_TST_PlateMask.png new file mode 100644 index 00000000..3476df05 Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_TST_PlateMask.png differ diff --git a/assets/maimai/static/mai/pic/UI_TTR_BG_Base_Plus.png b/assets/maimai/static/mai/pic/UI_TTR_BG_Base_Plus.png new file mode 100644 index 00000000..d287df6c Binary files /dev/null and b/assets/maimai/static/mai/pic/UI_TTR_BG_Base_Plus.png differ diff --git a/core/loader/__init__.py b/core/loader/__init__.py index 37f1b3bf..6308e25a 100644 --- a/core/loader/__init__.py +++ b/core/loader/__init__.py @@ -173,7 +173,7 @@ class ModulesManager: @classmethod def reload_module(cls, module_name: str): """ - 重载该小可模块(以及该模块所在文件的其它模块) + 重载该机器人模块(以及该模块所在文件的其它模块) """ py_module = cls.return_py_module(module_name) unbind_modules = cls.search_related_module(module_name) @@ -184,7 +184,7 @@ class ModulesManager: @classmethod def load_module(cls, module_name: str): """ - 加载该小可模块(以及该模块所在文件的其它模块) + 加载该机器人模块(以及该模块所在文件的其它模块) """ if module_name not in current_unloaded_modules: return False @@ -212,7 +212,7 @@ class ModulesManager: @classmethod def unload_module(cls, module_name: str): """ - 卸载该小可模块(以及该模块所在文件的其它模块) + 卸载该机器人模块(以及该模块所在文件的其它模块) """ unbind_modules = cls.search_related_module(module_name) cls.remove_modules(unbind_modules) @@ -223,7 +223,7 @@ class ModulesManager: @classmethod def reload_py_module(cls, module_name: str): """ - 重载该py模块 + 重载该Python模块 """ try: Logger.info(f'Reloading {module_name} ...') diff --git a/core/utils/bot.py b/core/utils/bot.py index ba4265ef..e9e3830b 100644 --- a/core/utils/bot.py +++ b/core/utils/bot.py @@ -36,7 +36,7 @@ async def init_async(start_scheduler=True) -> None: try: Info.version = os.popen('git rev-parse HEAD', 'r').read() except Exception as e: - Logger.warn(f'Failed to get git commit hash, is it a git repository?') + Logger.warn(f'Failed to get Git commit hash, is it a Git repository?') Logger.info(f'Hello, {bot_name}!') diff --git a/modules/core/__init__.py b/modules/core/__init__.py index ba5c9d3a..614eddc6 100644 --- a/modules/core/__init__.py +++ b/modules/core/__init__.py @@ -2,4 +2,5 @@ from .alias import * from .modules import * from .prefix import * from .su_utils import * +from .update import * from .utils import * diff --git a/modules/core/alias.py b/modules/core/alias.py index cd89a7f2..ea5d87d7 100644 --- a/modules/core/alias.py +++ b/modules/core/alias.py @@ -8,7 +8,8 @@ ali = module('alias', required_admin=True, base=True) @ali.command('add {{core.help.alias.add}}', 'remove {{core.help.alias.remove}}', 'reset {{core.help.alias.reset}}', - 'list {{core.help.alias.list}}') + 'list {{core.help.alias.list}}', + 'list legacy {{core.help.alias.list.legacy}}') async def set_alias(msg: Bot.MessageSession): aliases = msg.options.get('command_alias') alias = msg.parsed_msg.get('', False) @@ -41,15 +42,20 @@ async def set_alias(msg: Bot.MessageSession): msg.data.edit_option('command_alias', {}) await msg.finish(msg.locale.t("core.message.alias.reset.success")) elif 'list' in msg.parsed_msg: + legacy = True if len(aliases) == 0: await msg.finish(msg.locale.t("core.message.alias.list.none")) - else: + elif 'list' not in msg.parsed_msg: table = ImageTable([[k, aliases[k]] for k in aliases], [msg.locale.t("core.message.alias.list.table.header.alias"), msg.locale.t("core.message.alias.list.table.header.command")]) img = await image_table_render(table) if img: + legacy = False await msg.finish([msg.locale.t("core.message.alias.list"), Image(img)]) else: + pass + + if legacy: await msg.finish(f'{msg.locale.t("core.message.alias.list")}\n' + '\n'.join([f'{k} -> {aliases[k]}' for k in aliases])) diff --git a/modules/core/locales/en_us.json b/modules/core/locales/en_us.json index 60cb6e36..28026023 100644 --- a/modules/core/locales/en_us.json +++ b/modules/core/locales/en_us.json @@ -2,11 +2,12 @@ "core.help.admin": "Commands available to group administrators.", "core.help.admin.add": "Set members as bot administrators, implement the function of managing the robot without setting members as group administrators. It's no longer needed to set up it when you are already a group administrator.", "core.help.admin.ban": "Limit someone to use bot in the group.", - "core.help.admin.list": "List all bot administrators.", + "core.help.admin.list": "View all bot administrators.", "core.help.admin.remove": "Remove bot administrator from member.", "core.help.admin.unban": "Remove limit someone to use bot in the group.", "core.help.alias.add": "Add custom command alias.", - "core.help.alias.list": "List custom command alias.", + "core.help.alias.list": "View custom command alias.", + "core.help.alias.list.legacy": "View custom command alias. (Legacy)", "core.help.alias.remove": "Remove custom command alias.", "core.help.alias.reset": "Reset custom command alias.", "core.help.leave": "Let the bot leave the group.", @@ -26,7 +27,7 @@ "core.help.petal": "Get the number of petals in the current group.", "core.help.ping": "Get bot status.", "core.help.prefix.add": "Set custom command prefix.", - "core.help.prefix.list": "List custom command prefixes.", + "core.help.prefix.list": "View custom command prefixes.", "core.help.prefix.remove": "Remove custom command prefix.", "core.help.prefix.reset": "Reset custom command prefix.", "core.help.toggle.check": "Toggles whether to display command check prompts.", @@ -105,8 +106,8 @@ "core.message.module.load.success": "Successfully loaded module(s): ${module}", "core.message.module.module.help": "Help information for module \"${module}\": ", "core.message.module.recommends": "It is recommended to enable the following module(s) at the same time: \n${msgs}\nProceed?", + "core.message.module.reload.base": "Failed: \"${module}\" is a base module. To prevent exceptions in the bot, this operation has been blocked.", "core.message.module.reload.confirm": "This operation will reload the following modules at the same time: \n${modules}\nContinue?", - "core.message.module.reload.confirm.base": "You are trying to reload the base modules! Continue?", "core.message.module.reload.failed": "Failed to reload module.", "core.message.module.reload.no_more": "No remaining files were found.", "core.message.module.reload.success": "Successfully reloaded module(s):\n${module}", @@ -163,4 +164,4 @@ "core.message.whoami.admin": "(You have admin permission for this conversation)", "core.message.whoami.botadmin": "(You have bot admin permission for this conversation)", "core.message.whoami.superuser": "(You have superuser permission)" -} +} \ No newline at end of file diff --git a/modules/core/locales/zh_cn.json b/modules/core/locales/zh_cn.json index 47579cfc..7c989023 100644 --- a/modules/core/locales/zh_cn.json +++ b/modules/core/locales/zh_cn.json @@ -2,11 +2,12 @@ "core.help.admin": "一些群组管理员可使用的命令。", "core.help.admin.add": "设置成员为机器人管理员。以实现不设置成员为群组管理员的状況下管理机器人的效果。已是群组管理员无需设置此项目。", "core.help.admin.ban": "限制某人在本群使用机器人。", - "core.help.admin.list": "列出所有机器人管理员。", + "core.help.admin.list": "查看所有机器人管理员。", "core.help.admin.remove": "取消成员的机器人管理员。", "core.help.admin.unban": "解除对某人在本群使用机器人的限制。", "core.help.alias.add": "添加自定义命令别名。", - "core.help.alias.list": "列出自定义命令别名列表。", + "core.help.alias.list": "查看自定义命令别名列表。", + "core.help.alias.list.legacy": "查看自定义命令别名列表。(旧版)", "core.help.alias.remove": "移除自定义命令别名。", "core.help.alias.reset": "重置自定义命令别名。", "core.help.leave": "使机器人离开群组。", @@ -26,7 +27,7 @@ "core.help.petal": "获取当前群组的花瓣数。", "core.help.ping": "获取机器人状态。", "core.help.prefix.add": "设置自定义命令前缀。", - "core.help.prefix.list": "列出自定义命令前缀列表。", + "core.help.prefix.list": "查看自定义命令前缀列表。", "core.help.prefix.remove": "移除自定义命令前缀。", "core.help.prefix.reset": "重置自定义命令前缀。", "core.help.toggle.check": "切换是否展示命令错字检查提示。", @@ -105,8 +106,8 @@ "core.message.module.load.success": "成功加载模块:${module}", "core.message.module.module.help": "模块“${module}”的帮助信息:", "core.message.module.recommends": "建议同时开启以下模块:\n${msgs}\n是否一并开启?", + "core.message.module.reload.base": "失败:“${module}”模块为基础模块,为防止机器人发生异常,此操作已被阻止。", "core.message.module.reload.confirm": "该操作将额外同时重载以下模块:\n${modules}\n是否继续?", - "core.message.module.reload.confirm.base": "你正在尝试重载基础模块!是否继续?", "core.message.module.reload.failed": "重载模块失败。", "core.message.module.reload.no_more": "未发现已加载的其余文件。", "core.message.module.reload.success": "成功重载模块:\n${module}", @@ -163,4 +164,4 @@ "core.message.whoami.admin": "(你拥有本对话的管理员权限)", "core.message.whoami.botadmin": "(你拥有本对话的机器人管理员权限)", "core.message.whoami.superuser": "(你拥有本机器人的超级用户权限)" -} +} \ No newline at end of file diff --git a/modules/core/locales/zh_tw.json b/modules/core/locales/zh_tw.json index f34843e8..6b090021 100644 --- a/modules/core/locales/zh_tw.json +++ b/modules/core/locales/zh_tw.json @@ -2,11 +2,12 @@ "core.help.admin": "一些群組管理員可使用的指令。", "core.help.admin.add": "設定成員為機器人管理員,以實現不設定成員為群組管理員的狀況下管理機器人的效果。已是群組管理員無須設定此指令。", "core.help.admin.ban": "限制某人在此群組使用機器人。", - "core.help.admin.list": "列出所有機器人管理員。", + "core.help.admin.list": "檢視所有機器人管理員。", "core.help.admin.remove": "取消成員的機器人管理員。", "core.help.admin.unban": "解除對某人在此群組使用機器人的限制。", "core.help.alias.add": "新增自訂指令別名。", - "core.help.alias.list": "列出自訂指令別名列表。", + "core.help.alias.list": "檢視自訂指令別名列表。", + "core.help.alias.list.legacy": "檢視自訂指令別名列表。(舊版)", "core.help.alias.remove": "移除自訂指令別名。", "core.help.alias.reset": "重設自訂指令別名。", "core.help.leave": "使機器人離開群組。", @@ -26,7 +27,7 @@ "core.help.petal": "取得目前群組的花瓣數。", "core.help.ping": "取得機器人狀態。", "core.help.prefix.add": "設定自訂指令前綴。", - "core.help.prefix.list": "列出自訂指令前綴列表。", + "core.help.prefix.list": "檢視自訂指令前綴列表。", "core.help.prefix.remove": "移除自訂指令前綴。", "core.help.prefix.reset": "重設自訂指令前綴。", "core.help.toggle.check": "切換是否顯示指令錯誤檢查提醒。", @@ -106,7 +107,7 @@ "core.message.module.module.help": "模組「${module}」的說明資訊:", "core.message.module.recommends": "建議同時啟用以下模組:\n${msgs}\n是否一同啟用?", "core.message.module.reload.confirm": "此操作將額外同時重新載入以下模組:\n${modules}\n是否繼續?", - "core.message.module.reload.confirm.base": "你正在重新載入基礎模組!是否繼續?", + "core.message.module.reload.base": "失败:「${module}」為基礎模組,為防止機器人發生異常,此行為已被阻擋。", "core.message.module.reload.failed": "重新載入模組失敗。", "core.message.module.reload.no_more": "未發現已載入的其餘檔案。", "core.message.module.reload.success": "成功重新載入模組:\n${module}", diff --git a/modules/core/modules.py b/modules/core/modules.py index 31ac2635..968578ab 100644 --- a/modules/core/modules.py +++ b/modules/core/modules.py @@ -19,7 +19,6 @@ m = module('module', 'load': 'module load', 'reload': 'module reload', 'unload': 'module unload'}, - developers=['OasisAkari', 'Light-Beacon'], required_admin=True ) @@ -175,9 +174,7 @@ async def config_modules(msg: Bot.MessageSession): if msg.check_super_user(): def module_reload(module, extra_modules, base_mode=False): reload_count = ModulesManager.reload_module(module) - if base_mode and reload_count: - return msg.locale.t("core.message.module.reload.success.base") - elif reload_count > 1: + if reload_count > 1: return msg.locale.t('core.message.module.reload.success', module=module) + \ ('\n' if len(extra_modules) != 0 else '') + \ '\n'.join(extra_modules) + \ @@ -199,11 +196,7 @@ async def config_modules(msg: Bot.MessageSession): else: extra_reload_modules = ModulesManager.search_related_module(module_, False) if modules_[module_].base: - confirm = await msg.wait_confirm(msg.locale.t("core.message.module.reload.confirm.base"), append_instruction=False) - if confirm: - base_mode = True - else: - await msg.finish() + await msg.finish(msg.locale.t("core.message.module.reload.base", module=module_)) elif len(extra_reload_modules): confirm = await msg.wait_confirm(msg.locale.t("core.message.module.reload.confirm", @@ -292,10 +285,7 @@ async def config_modules(msg: Bot.MessageSession): await msg.finish() -hlp = module('help', - base=True, - developers=['OasisAkari', 'Dianliang233'], - ) +hlp = module('help', base=True) @hlp.command(' {{core.help.module.help.detail}}') @@ -344,9 +334,9 @@ async def bot_help(msg: Bot.MessageSession): malias.append(f'{a} -> {module_alias[a]}') if module_.developers is not None: devs = msg.locale.t('message.delimiter').join(module_.developers) + devs_msg = '\n' + msg.locale.t("core.message.module.help.author.type1") + devs else: - devs = '' - devs_msg = '\n' + msg.locale.t("core.message.module.help.author.type1") + devs + devs_msg = '' wiki_msg = '\n' + msg.locale.t("core.message.module.help.helpdoc.address", help_url=Config('help_url')) + '/' + help_name if len(doc) > 500 and msg.Feature.image: @@ -363,7 +353,7 @@ async def bot_help(msg: Bot.MessageSession): traceback.print_exc() if malias: doc += f'\n{msg.locale.t("core.help.alias")}\n' + '\n'.join(malias) - await msg.finish(doc + devs_msg + wiki_msg) + await msg.finish((doc + devs_msg + wiki_msg).lstrip()) else: await msg.finish(msg.locale.t("core.message.module.help.not_found")) diff --git a/modules/core/su_utils.py b/modules/core/su_utils.py index f8c0fbe9..6dee6e64 100644 --- a/modules/core/su_utils.py +++ b/modules/core/su_utils.py @@ -11,7 +11,7 @@ import ujson as json from dateutil.relativedelta import relativedelta from config import Config, CFG -from core.builtins import Bot, PrivateAssets, Image, Plain, ExecutionLockList, Temp, MessageTaskManager +from core.builtins import Bot, Image, Plain, Temp from core.component import module from core.loader import ModulesManager from core.logger import Logger @@ -23,7 +23,7 @@ from core.utils.info import Info from core.utils.storedata import get_stored_list, update_stored_list from database import BotDBUtil -su = module('superuser', alias='su', developers=['OasisAkari', 'Dianliang233'], required_superuser=True, base=True) +su = module('superuser', alias='su', required_superuser=True, base=True) @su.command('add ') @@ -147,7 +147,7 @@ async def _(msg: Bot.MessageSession): await msg.finish([Plain(result), Image(path)]) -purge = module('purge', developers=['DoroWolf'], required_superuser=True, base=True) +purge = module('purge', required_superuser=True, base=True) @purge.command() @@ -215,7 +215,7 @@ async def _(msg: Bot.MessageSession): await msg.finish(msg.locale.t("core.message.set.help.option.success", k=k, v=v)) -ae = module('abuse', alias='ae', developers=['Dianliang233'], required_superuser=True, base=True) +ae = module('abuse', alias='ae', required_superuser=True, base=True) @ae.command('check ') @@ -282,7 +282,6 @@ async def _(msg: Bot.MessageSession): if BotDBUtil.SenderInfo(user).edit('isInBlockList', False): await msg.finish(msg.locale.t("core.message.abuse.unban.success", user=user)) - if Info.subprocess: rst = module('restart', developers=['OasisAkari'], required_superuser=True, base=True) @@ -371,9 +370,8 @@ if Info.subprocess: else: await msg.send_message(msg.locale.t("core.message.update.failed")) restart() - if Bot.FetchTarget.name == 'QQ': - resume = module('resume', developers=['OasisAkari'], required_base_superuser=True) + resume = module('resume', required_base_superuser=True) @resume.command() async def resume_sending_group_message(msg: Bot.MessageSession): @@ -417,7 +415,7 @@ if Bot.FetchTarget.name == 'QQ': Temp.data['waiting_for_send_group_message'] = [] await msg.finish(msg.locale.t("core.message.resume.clear")) - forward_msg = module('forward_msg', developers=['OasisAkari'], required_superuser=True, base=True) + forward_msg = module('forward_msg', required_superuser=True, base=True) @forward_msg.command() async def _(msg: Bot.MessageSession): @@ -431,7 +429,7 @@ if Bot.FetchTarget.name == 'QQ': else: await msg.finish(msg.locale.t('core.message.forward_msg.disable')) -echo = module('echo', developers=['OasisAkari'], required_superuser=True, base=True) +echo = module('echo', required_superuser=True, base=True) @echo.command('') @@ -439,15 +437,14 @@ async def _(msg: Bot.MessageSession): await msg.finish(msg.parsed_msg['']) -say = module('say', developers=['OasisAkari'], required_superuser=True, base=True) +say = module('say', required_superuser=True, base=True) @say.command('') async def _(msg: Bot.MessageSession): await msg.finish(msg.parsed_msg[''], quote=False) - -rse = module('raise', developers=['OasisAkari'], required_superuser=True, base=True) +rse = module('raise', required_superuser=True, base=True) @rse.command() @@ -457,13 +454,15 @@ async def _(msg: Bot.MessageSession): if Config('enable_eval'): - _eval = module('eval', developers=['Dianliang233'], required_superuser=True, base=True) + _eval = module('eval', required_superuser=True, base=True) @_eval.command('') async def _(msg: Bot.MessageSession): await msg.finish(str(eval(msg.parsed_msg[''], {'msg': msg}))) +_config = module('config', required_superuser=True, alias='cfg', base=True) + def isfloat(num): try: float(num) @@ -480,9 +479,6 @@ def isint(num): return False -_config = module('config', developers=['OasisAkari'], required_superuser=True, alias='cfg', base=True) - - @_config.command('write [-s]') async def _(msg: Bot.MessageSession): value = msg.parsed_msg[''] @@ -513,7 +509,7 @@ async def _(msg: Bot.MessageSession): if Config('openai_api_key'): - petal = module('petal', developers=['Dianliang233'], base=True, alias='petals') + petal = module('petal', base=True, alias='petals') @petal.command() async def _(msg: Bot.MessageSession): @@ -550,7 +546,7 @@ if Bot.client_name == 'QQ': target_data.edit_option(k, v) await msg.finish(msg.locale.t("core.message.set.help.option.success", k=k, v=v)) - lagrange = module('lagrange', developers=['OasisAkari'], required_superuser=True, base=True) + lagrange = module('lagrange', required_superuser=True, base=True) @lagrange.command() async def _(msg: Bot.MessageSession): diff --git a/modules/core/update.py b/modules/core/update.py new file mode 100644 index 00000000..f568c3aa --- /dev/null +++ b/modules/core/update.py @@ -0,0 +1,101 @@ +import asyncio +import os +import sys +from datetime import datetime + +import ujson as json + +from core.builtins import Bot, PrivateAssets, ExecutionLockList, MessageTaskManager +from core.component import module +from core.logger import Logger +from core.utils.info import Info + +upd = module('update', required_superuser=True, base=True) + + +def pull_repo(): + return os.popen('git pull', 'r').read()[:-1] + + +def update_dependencies(): + poetry_install = os.popen('poetry install').read()[:-1] + if poetry_install != '': + return poetry_install + pip_install = os.popen('pip install -r requirements.txt').read()[:-1] + if len(pip_install) > 500: + return '...' + pip_install[-500:] + return + + +@upd.command() +async def update_bot(msg: Bot.MessageSession): + confirm = await msg.wait_confirm(msg.locale.t("core.message.confirm"), append_instruction=False) + if confirm: + pull_repo_result = pull_repo() + if pull_repo_result != '': + await msg.send_message(pull_repo_result) + else: + await msg.send_message(msg.locale.t("core.message.update.failed")) + await msg.send_message(update_dependencies()) + +if Info.subprocess: + rst = module('restart', required_superuser=True, base=True) + + def restart(): + sys.exit(233) + + def write_version_cache(msg: Bot.MessageSession): + update = os.path.abspath(PrivateAssets.path + '/cache_restart_author') + write_version = open(update, 'w') + write_version.write(json.dumps({'From': msg.target.target_from, 'ID': msg.target.target_id})) + write_version.close() + + restart_time = [] + + async def wait_for_restart(msg: Bot.MessageSession): + get = ExecutionLockList.get() + if datetime.now().timestamp() - restart_time[0] < 60: + if len(get) != 0: + await msg.send_message(msg.locale.t("core.message.restart.wait", count=len(get))) + await asyncio.sleep(10) + return await wait_for_restart(msg) + else: + await msg.send_message(msg.locale.t("core.message.restart.restarting")) + get_wait_list = MessageTaskManager.get() + for x in get_wait_list: + for y in get_wait_list[x]: + for z in get_wait_list[x][y]: + if get_wait_list[x][y][z]['active']: + await z.send_message(z.locale.t("core.message.restart.prompt")) + + else: + await msg.send_message(msg.locale.t("core.message.restart.timeout")) + + @rst.command() + async def restart_bot(msg: Bot.MessageSession): + confirm = await msg.wait_confirm(msg.locale.t("core.message.confirm"), append_instruction=False) + if confirm: + restart_time.append(datetime.now().timestamp()) + await wait_for_restart(msg) + write_version_cache(msg) + restart() + + +if Info.subprocess: + upds = module('update&restart', required_superuser=True, alias='u&r', base=True) + + @upds.command() + async def update_and_restart_bot(msg: Bot.MessageSession): + confirm = await msg.wait_confirm(msg.locale.t("core.message.confirm"), append_instruction=False) + if confirm: + restart_time.append(datetime.now().timestamp()) + await wait_for_restart(msg) + write_version_cache(msg) + pull_repo_result = pull_repo() + if pull_repo_result != '': + await msg.send_message(pull_repo_result) + await msg.send_message(update_dependencies()) + else: + Logger.warn(f'Failed to get Git repository result.') + await msg.send_message(msg.locale.t("core.message.update.failed")) + restart() diff --git a/modules/core/utils.py b/modules/core/utils.py index 01763bb7..28d336da 100644 --- a/modules/core/utils.py +++ b/modules/core/utils.py @@ -15,7 +15,7 @@ from database import BotDBUtil jwt_secret = Config('jwt_secret') -ver = module('version', base=True, desc='{core.help.version}', developers=['OasisAkari', 'Dianliang233']) +ver = module('version', base=True, desc='{core.help.version}') @ver.command() @@ -26,7 +26,7 @@ async def bot_version(msg: Bot.MessageSession): await msg.finish(msg.locale.t('core.message.version.unknown')) -ping = module('ping', base=True, desc='{core.help.ping}', developers=['OasisAkari']) +ping = module('ping', base=True, desc='{core.help.ping}') started_time = datetime.now() @@ -70,12 +70,7 @@ async def _(msg: Bot.MessageSession): await msg.finish(result) -admin = module('admin', - base=True, - required_admin=True, - developers=['OasisAkari'], - desc='{core.help.admin}' - ) +admin = module('admin', base=True, required_admin=True, desc='{core.help.admin}') @admin.command([ @@ -107,7 +102,8 @@ async def config_gu(msg: Bot.MessageSession): await msg.finish(msg.locale.t("core.message.admin.remove.success", user=user)) -@admin.command('ban {{core.help.admin.ban}}', 'unban {{core.help.admin.unban}}') +@admin.command('ban {{core.help.admin.ban}}', + 'unban {{core.help.admin.unban}}') async def config_ban(msg: Bot.MessageSession): user = msg.parsed_msg[''] if not user.startswith(f'{msg.target.sender_from}|'): @@ -129,7 +125,7 @@ async def config_ban(msg: Bot.MessageSession): await msg.finish(msg.locale.t("core.message.admin.ban.not_yet")) -locale = module('locale', base=True, developers=['Dianliang233', 'Light-Beacon']) +locale = module('locale', base=True) @locale.command('{{core.help.locale}}') @@ -158,7 +154,7 @@ async def reload_locale(msg: Bot.MessageSession): await msg.send_message(msg.locale.t("core.message.locale.reload.failed", detail='\n'.join(err))) -whoami = module('whoami', developers=['Dianliang233'], base=True) +whoami = module('whoami', base=True) @whoami.command('{{core.help.whoami}}') @@ -175,7 +171,7 @@ async def _(msg: Bot.MessageSession): disable_secret_check=True) -tog = module('toggle', developers=['OasisAkari'], base=True, required_admin=True) +tog = module('toggle', base=True, required_admin=True) @tog.command('typing {{core.help.toggle.typing}}') @@ -223,8 +219,7 @@ async def _(msg: Bot.MessageSession): await msg.finish(msg.locale.t('core.message.toggle.timeoffset.success', offset=offset)) -mute = module('mute', developers=['Dianliang233'], base=True, required_admin=True, - desc='{core.help.mute}') +mute = module('mute', base=True, required_admin=True, desc='{core.help.mute}') @mute.command() @@ -236,14 +231,7 @@ async def _(msg: Bot.MessageSession): await msg.finish(msg.locale.t('core.message.mute.disable')) -leave = module( - 'leave', - developers=['OasisAkari'], - base=True, - required_admin=True, - available_for='QQ|Group', - alias='dismiss', - desc='{core.help.leave}') +leave = module('leave', base=True, required_admin=True, available_for='QQ|Group', alias='dismiss', desc='{core.help.leave}') @leave.command() @@ -254,7 +242,7 @@ async def _(msg: Bot.MessageSession): await msg.call_api('set_group_leave', group_id=msg.session.target) -token = module('token', base=True, desc='{core.help.token}', developers=['Dianliang233']) +token = module('token', base=True, desc='{core.help.token}') @token.command('') diff --git a/modules/maimai/__init__.py b/modules/maimai/__init__.py index fdca6e77..8d207d1c 100644 --- a/modules/maimai/__init__.py +++ b/modules/maimai/__init__.py @@ -1,4 +1,10 @@ -from core.builtins import command_prefix +from core.builtins import command_prefix +import traceback + +from config import Config +from core.builtins import Bot, command_prefix, Plain, Image as BImage +from core.scheduler import CronTrigger +from core.utils.image import msgchain2image from modules.maimai.libraries.maimai_best_50 import generate from modules.maimai.libraries.maimaidx_api_data import get_alias, search_by_alias, update_alias, update_covers from modules.maimai.libraries.maimaidx_music import get_cover_len5_id, Music, TotalList @@ -405,8 +411,8 @@ async def _(msg: Bot.MessageSession, dx_type: str = None): else: rand_result = song_txt(music_data.random()) await msg.finish(rand_result) - except Exception as e: - Logger.error(e) + except Exception: + Logger.error(traceback.format_exc()) await msg.finish(msg.locale.t("maimai.message.random.error")) @@ -464,3 +470,12 @@ async def _(msg: Bot.MessageSession): await msg.finish(msg.locale.t("success")) else: await msg.finish(msg.locale.t("failed")) + +@mai.schedule(CronTrigger.from_crontab('0 0 * * *')) +async def _(): + Logger.info('Updating maimai alias...') + try: + await update_alias() + except Exception: + if Config('debug'): + Logger.error(traceback.format_exc()) \ No newline at end of file diff --git a/modules/maimai/libraries/maimai_best_50.py b/modules/maimai/libraries/maimai_best_50.py index 35466943..111bfe96 100644 --- a/modules/maimai/libraries/maimai_best_50.py +++ b/modules/maimai/libraries/maimai_best_50.py @@ -204,7 +204,7 @@ class DrawBest(object): rankPic = 'D C B BB BBB A AA AAA S Sp SS SSp SSS SSSp'.split(' ') comboPic = ' FC FCp AP APp'.split(' ') imgDraw = ImageDraw.Draw(img) - titleFontName = 'assets/maimai/static/adobe_simhei.otf' + titleFontName = 'assets/SourceHanSansCN-Normal.ttf' for num in range(0, len(sdBest)): i = num // 7 j = num % 7 @@ -236,10 +236,10 @@ class DrawBest(object): 'RGBA') comboImg = self._resizePic(comboImg, 0.45) temp.paste(comboImg, (103, 27), comboImg.split()[3]) - font = ImageFont.truetype('assets/maimai/static/adobe_simhei.otf', 12, encoding='utf-8') + font = ImageFont.truetype('assets/SourceHanSansCN-Normal.ttf', 12, encoding='utf-8') tempDraw.text((8, 44), f'Base: {chartInfo.ds} -> {computeRa(chartInfo.ds, chartInfo.achievement)}', 'white', font) - font = ImageFont.truetype('assets/maimai/static/adobe_simhei.otf', 18, encoding='utf-8') + font = ImageFont.truetype('assets/SourceHanSansCN-Normal.ttf', 18, encoding='utf-8') tempDraw.text((8, 60), f'#{num + 1}', 'white', font) recBase = Image.new('RGBA', (itemW, itemH), 'black') @@ -285,9 +285,9 @@ class DrawBest(object): 'RGBA') comboImg = self._resizePic(comboImg, 0.45) temp.paste(comboImg, (103, 27), comboImg.split()[3]) - font = ImageFont.truetype('assets/maimai/static/adobe_simhei.otf', 12, encoding='utf-8') + font = ImageFont.truetype('assets/SourceHanSansCN-Normal.ttf', 12, encoding='utf-8') tempDraw.text((8, 44), f'Base: {chartInfo.ds} -> {chartInfo.ra}', 'white', font) - font = ImageFont.truetype('assets/maimai/static/adobe_simhei.otf', 18, encoding='utf-8') + font = ImageFont.truetype('assets/SourceHanSansCN-Normal.ttf', 18, encoding='utf-8') tempDraw.text((8, 60), f'#{num + 1}', 'white', font) recBase = Image.new('RGBA', (itemW, itemH), 'black') @@ -316,7 +316,7 @@ class DrawBest(object): namePlateImg = Image.open(self.pic_dir + 'UI_TST_PlateMask.png').convert('RGBA') namePlateImg = namePlateImg.resize((285, 40)) namePlateDraw = ImageDraw.Draw(namePlateImg) - font1 = ImageFont.truetype('assets/maimai/static/msyh.ttc', 28, encoding='unic') + font1 = ImageFont.truetype('assets/Nunito-Regular.ttf', 28, encoding='unic') namePlateDraw.text((12, 4), ' '.join(list(self.userName)), 'black', font1) nameDxImg = Image.open(self.pic_dir + 'UI_CMN_Name_DX.png').convert('RGBA') nameDxImg = self._resizePic(nameDxImg, 0.9) @@ -325,7 +325,7 @@ class DrawBest(object): shougouImg = Image.open(self.pic_dir + 'UI_CMN_Shougou_Rainbow.png').convert('RGBA') shougouDraw = ImageDraw.Draw(shougouImg) - font2 = ImageFont.truetype('assets/maimai/static/adobe_simhei.otf', 14, encoding='utf-8') + font2 = ImageFont.truetype('assets/SourceHanSansCN-Normal.ttf', 14, encoding='utf-8') playCountInfo = f'SD: {self.sdRating} + DX: {self.dxRating} = {self.playerRating}' shougouImgW, shougouImgH = shougouImg.size playCountInfoW, playCountInfoH = shougouDraw.textsize(playCountInfo, font2) @@ -347,7 +347,7 @@ class DrawBest(object): authorBoardImg = Image.open(self.pic_dir + 'UI_CMN_MiniDialog_01.png').convert('RGBA') authorBoardImg = self._resizePic(authorBoardImg, 0.35) authorBoardDraw = ImageDraw.Draw(authorBoardImg) - authorBoardDraw.text((31, 28), ' Ported by\n Akaribot', 'black', font2) + authorBoardDraw.text((31, 28), ' Generated by\n Akaribot', 'black', font2) self.img.paste(authorBoardImg, (1224, 19), mask=authorBoardImg.split()[3]) dxImg = Image.open(self.pic_dir + 'UI_RSL_MBase_Parts_01.png').convert('RGBA') diff --git a/modules/maimai/regex.py b/modules/maimai/regex.py index b9e304de..05fc7188 100644 --- a/modules/maimai/regex.py +++ b/modules/maimai/regex.py @@ -1,4 +1,5 @@ import re +import traceback from core.builtins import Bot, Plain, Image as BImage from core.component import module @@ -164,7 +165,7 @@ async def _(msg: Bot.MessageSession): rand_result = song_txt(music_data.random()) await msg.finish(rand_result) except Exception as e: - Logger.error(e) + Logger.error(traceback.format_exc()) await msg.finish(msg.locale.t("maimai.message.random.error")) diff --git a/modules/natural/README.md b/modules/natural/README.md deleted file mode 100644 index bd49f9c1..00000000 --- a/modules/natural/README.md +++ /dev/null @@ -1,8 +0,0 @@ -## Files - -- `datasets/`: for dataset archive. -- Run `create_jsonl.py` to create jsonl files for dataset.txt -- dataset.txt is the training-pending dataset -- I regularly run a new fine-tuning job on the dataset.txt. After the job is done, I will move the dataset to `datasets/` and remove it from `dataset.txt`. - -The latest model is `curie:ft-teahouse-studios:nl2c-2023-03-09-11-31-56`. diff --git a/modules/natural/__init__.py b/modules/natural/__init__.py deleted file mode 100644 index b1b1b241..00000000 --- a/modules/natural/__init__.py +++ /dev/null @@ -1,18 +0,0 @@ -import openai - -from config import Config -from core.builtins import Bot -from core.component import module - -n = module('natural', alias='nl2c', developers=['Dianliang233'], desc='{natural.help}', required_superuser=True) - -# Load your API key from an environment variable or secret management service -openai.api_key = Config('openai_api_key') -model = Config('nl2c_model') - - -@n.command(' {{natural.help}}') -async def _(msg: Bot.MessageSession, text: str): - response = openai.Completion.create( - model=model, prompt=f'{text}\n\n###\n\n', temperature=0, max_tokens=256, stop=['\n']) - await msg.finish(response['choices'][0]['text']) diff --git a/modules/natural/create_jsonl.py b/modules/natural/create_jsonl.py deleted file mode 100644 index 08077f5c..00000000 --- a/modules/natural/create_jsonl.py +++ /dev/null @@ -1,14 +0,0 @@ -import os - -import ujson as json - -with open(os.path.dirname(os.path.abspath(__file__)) + '/dataset.txt', 'r', encoding='utf-8') as f: - txt = f.read() - -txt = txt.splitlines() -txt = [x for x in txt if x != ''] - -with open(os.path.dirname(os.path.abspath(__file__)) + '/dataset.jsonl', 'w', encoding='utf-8') as f: - for i in range(0, len(txt), 2): - f.write(json.dumps({'prompt': f'{txt[i]}\n\n###\n\n', 'completion': f' {txt[i + 1]}\n'}, ensure_ascii=False)) - f.write('\n') diff --git a/modules/natural/dataset.txt b/modules/natural/dataset.txt deleted file mode 100644 index 9ef1030d..00000000 --- a/modules/natural/dataset.txt +++ /dev/null @@ -1,59 +0,0 @@ -投掷一个6面骰子 -~dice d6 - -投掷三个10面骰子 -~dice 3d10 - -投掷五个20面骰子,输出点数之和 -~dice 5d20 - -投掷一个100面骰子,重复投掷3次 -~dice 3#d100 - -投掷两个8面骰子,输出最大的一个点数 -~dice 2d8k1 - -投掷四个6面骰子,输出最小的两个点数之和 -~dice 4d6kl2 - -投掷一个20面骰子,加上调整值+3 -~dice d20+3 - -投掷三个6面骰子,重复投掷2次 -~dice 2#3d6 - -投掷一个8面骰子,判定值为5 -~dice d8 5 - -投掷两个6面骰子,判定值为10 -~dice 2d6 10 - -投掷一个20面骰子和一个6面骰子,输出两者点数之和 -~dice d20+d6 - -投掷两个20面骰子和一个10面骰子,输出所有点数之和 -~dice 2d20+d10 - -投掷四个10面骰子,输出最大的三个点数之和 -~dice 4d10k3 - -投掷一个4面骰子,重复投掷5次,输出所有结果 -~dice 5#d4 - -投掷一个12面骰子,判定值为8,重复投掷3次 -~dice 3#d12 8 - -投掷五个6面骰子,输出最小的一个点数 -~dice 5d6kl1 - -投掷两个8面骰子,判定值为6,重复投掷2次 -~dice 2#2d8 6 - -投掷三个6面骰子,输出最大的两个点数之和 -~dice 3d6k2 - -投掷一个20面骰子和一个10面骰子,判定值为15 -~dice d20+d10 15 - -投掷两个12面骰子和一个4面骰子,输出所有点数之和 -~dice 2d12+d4 diff --git a/modules/natural/datasets/dataset-2023-02-09-03-06-30.txt b/modules/natural/datasets/dataset-2023-02-09-03-06-30.txt deleted file mode 100644 index fc77f532..00000000 --- a/modules/natural/datasets/dataset-2023-02-09-03-06-30.txt +++ /dev/null @@ -1,465 +0,0 @@ -获得机器人版本 -~version - -切换语言到中文 -~lang zh_cn - -切换语言到英文 -~lang en_us - -禁言 -~mute - -解除禁言 -~mute - -退群 -~leave - -开启wiki模块 -~module enable wiki - -关闭wiki模块 -~module disable wiki - -全部频道启用wiki模块 -~module enable wiki -g - -全部频道关闭wiki模块 -~module disable wiki -g - -开启所有模块 -~module enable all - -列出所有模块 -~module list - -在吗 -~ping - -活着吗 -~ping - -我是谁 -~whoami - -获取我的id -~whoami - -获取群聊id -~whoami - -开启戳一戳 -~toggle typing - -开启正在输入 -~toggle typing - -关闭戳一戳 -~toggle typing - -关闭正在输入 -~toggle typing - -开启错字纠正 -~toggle check - -给QQ|123456设置机器人管理员 -~admin add QQ|123456 - -给QQ|123456取消机器人管理员 -~admin del QQ|123456 - -列出机器人管理员 -~admin list - -忽略QQ|123456消息 -~admin ban QQ|123456 - -限制QQ|123456使用 -~admin ban QQ|123456 - -解除QQ|123456限制 -~admin unban QQ|123456 - -添加-前缀 -~prefix add - - -删除-前缀 -~prefix remove - - -重置前缀 -~prefix reset - -设置快捷命令wikigrass为wiki 草方块 -~alias add wikigrass "wiki 草方块" - -设置别名wikigrass为wiki 草方块 -~alias add wikigrass "wiki 草方块" - -删除快捷命令wikigrass -~alias remove wikigrass - -删除所有别名 -~alias reset - -帮助 -~help - -获取github帮助 -~help github - -查询wiki草方块 -~wiki 草方块 - -查询英文wiki grass block -~wiki en:Grass block - -查询维基百科计算机 -~wiki wikipedia:zh:计算机 - -查询维基百科computer -~wiki wikipedia:computer - -查询中维计算机 -~wiki wikipedia:zh:计算机 - -查询随机页面 -~wiki random - -设置wiki为https://minecraft.fandom.com/zh/ -~wiki set https://minecraft.fandom.com/zh/ - -设置wiki为mcwiki -~wiki set https://minecraft.fandom.com/zh/ - -设置wiki为萌娘百科 -~wiki set https://zh.moegirl.org.cn/ - -设置wiki为维基百科 -~wiki set https://zh.wikipedia.org/ - -添加mcwiki为interwiki -~wiki iw add mcwiki https://minecraft.fandom.com/zh/ - -添加萌娘百科为interwiki -~wiki iw add moegirl https://zh.moegirl.org.cn/ - -删除mcwiki的iw -~wiki iw remove mcwiki - -查询所有iw -~wiki iw list - -查询mcwiki草方块 -~wiki mcwiki:草方块 - -查询萌娘百科草方块 -~wiki moegirl:草方块 - -获取mcwiki api地址 -~wiki get mcwiki - -设置wiki ua为chrome 110 -~wiki header set {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0000.000 Safari/537.36"} - -设置wiki 用户代理为狗头人app -~wiki headers set {"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X x.y; rv:42.0) Gecko/20100101 Firefox/42.0 Huijiapp/5"} - -设置wiki cookie为a=1;b=2 -~wiki headers set {"cookie": "a=1;b=2"} - -删除wiki ua标头 -~wiki headers remove user-agent - -重置wiki headers -~wiki headers reset - -查询wiki标头 -~wiki headers show - -设置mcwiki为默认前缀 -~wiki prefix set mcwiki - -删除wiki默认前缀 -~wiki prefix reset - -启用wiki fandom iw -~wiki fandom enable - -启用Fandom全局Interwiki查询 -~wiki fandom enable - -禁用wiki fandom iw -~wiki fandom disable - -查询wiki页面id 3972 -~wiki -p 3972 - -查询mcwiki页面id 3972 -~wiki -p 3972 -i mcwiki - -查询wiki用户Dianliang233 -~user Dianliang233 - -查询mcwiki用户Dianliang233,并生成图片 -~user mcwiki:Dianliang233 -p - -查询rc -~rc - -查询最近更改 -~rc - -查询ab -~ab - -查询abusefilter -~ab - -查询滥用过滤器 -~ab - -查询新用户 -~newbie - -查询github koishi/koishi -~github repo koishi/koishi - -查询github用户koishi -~github user koishi - -查询github koishi -~github user koishi - -搜索github koishi -~github search koishi - -查询bug MC-123456 -~bug MC-123456 - -查询MC-123456 -~bug MC-123456 - -查询mojira MC-123456 -~bug MC-123456 - -查询玩家dianliang -~mcplayer dianliang - -查询mc玩家9a673ce6-d1b8-4734-9f08-3ad00fc592e6 -~mcplayer 9a673ce6-d1b8-4734-9f08-3ad00fc592e6 - -下载mod OptifineCapes 1.18 -~mod_dl OptifineCapes 1.18 - -mcmod查询OptifineCapes -~mcmod OptifineCapes - -mcmod查询物品appliedenergistics2:quartz_ore -~mcmod detail appliedenergistics2:quartz_ore - -查询mcbbs新闻 -~mcbbs_news - -查询mcbbs新闻版 -~mcbbs_news - -查询基岩版id bamboo_sapling -~idlist bamboo_sapling - -查询block id bamboo_sapling -~idlist bamboo_sapling block - -查询block和item id bamboo_sapling -~idlist bamboo_sapling block item - -查询id竹笋 -~idlist 竹笋 - -查询mc版本 -~mcv - -查询Minecraft基岩版版本 -~mcbv - -查询be版本 -~mcbv - -查询dungeons版本 -~mcdv - -查询mcd版本 -~mcdv - -查询地下城版本 -~mcdv - -查询教育版版本 -~mcev - -查询mc服务器mc.hypixel.net -~server mc.hypixel.net - -查询hypixel -~server mc.hypixel.net - -查询mc服务器mc.hypixel.net原始消息 -~server mc.hypixel.net -r - -查询mc服务器玩家列表 -~server mc.hypixel.net -p - -查询mcwiki每周页面 -~weekly - -查询茶馆周报 -~weekly teahouse - -生成11.11 ptt图片 -~ptt 11.1 - -生成潜力值11.11 -~ptt 11.11 - -生成potential 11.11图 -~ppt 11.11 - -查询arc b30结果 -~arcaea b30 - -查询29983210的arc best30 -~arcaea b30 29983210 - -用官方api查询29983210的arc 30最佳 -~arcaea b30 official 29983210 - -用非官方api查询29983210的arcaea 30最佳 -~arcaea b30 unofficial 29983210 - -查询arc最近游玩 -~arcaea info - -用非官方api查询22493的arcaea最近游玩 -~arcaea info unofficial 22493 - -绑定arc用户22493 -~arcaea bind 22493 - -解绑arc用户 -~arcaea unbind - -随机arc曲子 -~arcaea random - -arc免费包游玩排行 -~arcaea rank free - -arc付费包游玩排行 -~arcaea rank paid - -arc下载apk -~arcaea download - -arcaea初始化 -~arcaea initialize - -arc切换api -~arcaea switch - -查询cytoid用户wdljt -~cytoid profile wdljt - -查询cytoid自己信息 -~cytoid profile - -查询cytoid b30 -~cytoid b30 - -查询wdljt的cytoid b30 -~cytoid b30 wdljt - -查询cytoid r30 -~cytoid r30 - -查询cytoid Recent30 -~cytoid r30 - -查询wdljt的cytoid最近30首 -~cytoid r30 wdljt - - -绑定cytoid用户wdljt -~cytoid bind wdljt - -解绑cytoid用户 -~cytoid unbind - -舞萌运势 -~maimai today - -maimai运势 -~maimai today - -maimai定数12 -~maimai inner 12 - -maimai定数12到24 -~maimai inner 12 24 - -maimai查分DoroWolf -~maimai b40 DoroWolf - -化学分子式游戏 -~chemical_code - -化学分子式 -~chemical_code - -化学分子式游戏,csid 1222 -~chemical_code 1222 - -化学验证码 -~chemical_code captcha - -停止化学游戏 -~chemical_code stop - -查询任天堂错误码2002-0002 -~err 2002-0002 - -查梗1144514 -~meme 1144514 - -查词典message -~dict message - -随机选择1 2 3 4 5 6 -~random 1 2 3 4 5 6 - -随机数1-30 -~random number 1 30 - -扔硬币 -~random coin - -查询ip信息1.1.1.1 -~whois 1.1.1.1 - -计算20**2 -~calc 20**2 - -计算20*2/21精确到小数点后2位 -~calc round(20*2/21, 2) - -计算sin20 -~calc sin(20) - -计算20,1,1平均数 -~calc mean(20, 1, 1) - -转换1m到cm -~convert 1m cm - -聊天记录摘要 -~summary diff --git a/modules/natural/datasets/dataset-2023-03-09-08-22-49.txt b/modules/natural/datasets/dataset-2023-03-09-08-22-49.txt deleted file mode 100644 index 84627ea7..00000000 --- a/modules/natural/datasets/dataset-2023-03-09-08-22-49.txt +++ /dev/null @@ -1,98 +0,0 @@ -颜色 -~color - -随机颜色 -~color - -色图 -~color - -#3947a3 -~color #3947a3 - -颜色3947a3 -~color #3947a3 - -rgb(57,71,163) -~color rgb(57,71,163) - -hsl(240,50%,40%) -~color hsl(240,50%,40%) - -查询颜色rgb(57,71,163) -~color rgb(57,71,163) - -色子 -~dice d6 - -骰子 -~dice d6 - -掷6面骰子 -~dice d6 - -看看英文维基里的草 -~wiki wikipedia:en:Grass - -看看英文维基 -~wiki wikipedia:en: - -看看维基的方块 -~wiki wikipedia:方块 - -看看方块维基 -~wiki wikipedia:方块 - -give me 草方块wiki -~wiki 草方块 - -查wiki数据包 -~wiki 数据包 - -计算1,12,34,29的中位数 -~calc statistics.median(1,12,34,29) - -mcbbs新闻 -~mcbbs_news - -获取arcaea apk -~arcaea download - -查询存档计划的命令会是什么? -~wiki lakeus: - -掷2个6面骰子 -~dice 2d6 - -掷6面骰子3次 -~dice 3#d6 - -掷2个6面骰子3次 -~dice 3#2d6 - -掷2个6面和1个4面骰子 -~dice 2d6+1d4 - -掷3个6面骰子选2个最大 -~dice 3d6k2 - -掷3个6面骰子选2个最小 -~dice 3d6kl2 - -掷6面骰子加2点 -~dice d6+2 - -掷6面骰子减2点 -~dice d6-2 - -掷20面骰子,检定10点 -~dice d20 10 - -掷3个6面骰子选2个最大和1个4面骰子加10点5次,检定13点 -~dice 5#3d6k2+1d4+10 13 - -抛硬币 -~coin 1 - -抛2个硬币 -~coin 2 diff --git a/modules/natural/datasets/dataset-2023-03-09-11-31-56.txt b/modules/natural/datasets/dataset-2023-03-09-11-31-56.txt deleted file mode 100644 index 71e6f576..00000000 --- a/modules/natural/datasets/dataset-2023-03-09-11-31-56.txt +++ /dev/null @@ -1,233 +0,0 @@ -查询wiki附魔 -~wiki 附魔 - -wiki附魔 -~wiki 附魔 - -wiki查询石头 -~wiki 石头 - -wiki砍树 -~wiki 砍树 - -wiki查询砍树 -~wiki 砍树 - -搜索github Teahouse-studios -~github searchTeahouse-studios - -计算1加2乘以3 -~calc 1 + 2 * 3 - -计算10除以5的2次方 -~calc (10 / 5) ** 2 - -计算5除以3的余数加2 -~calc 5 % 3 + 2 - -计算2的3的2次方次幂 -~calc 2 ** 3 ** 2 - -判断1是否等于True -~calc 1 == True - -判断2是否大于等于2.0 -~calc 2 >= 2.0 - -计算16右移2位 -~calc 16 >> 2 - -计算1左移5位 -~calc 1 << 5 - -判断False的非是否为True -~calc not False - -判断2和2.0是否是同一个对象 -~calc 2 is 2.0 - -提供 CSS 中的“海蓝色”颜色信息 -~color aqua - -提供 #FF4500 颜色的信息 -~color #FF4500 - -提供 RGB(255, 255, 0) 颜色的信息 -~color rgb(255, 255, 0) - -提供 HSL(0, 100%, 50%) 颜色的信息 -~color hsl(0, 100%, 50%) - -提供随机颜色的信息 -~color - -提供 CSS 中的“银色”颜色信息 -~color silver - -提供 Material Design 中的“靛蓝色”颜色信息 -~color indigo - -提供 #8B008B 颜色的信息 -~color #8B008B - -提供 RGB(255, 165, 0) 颜色的信息 -~color rgb(255, 165, 0) - -查询维基页面“猫” -~wiki 猫 - -查询维基页面“随机页面”,随机返回一个页面 -~wiki 随机页面 - -根据页面ID查询一个Wiki页面 -~wiki -p 123456789 - -根据页面ID查询一个Wiki页面,并使用自定义的Interwiki -~wiki -p 123456789 -i mywiki - -搜索维基页面“机器学习” -~wiki search 机器学习 - -设置起始查询的维基网址 -~wiki set https://en.wikipedia.org/w/api.php - -添加自定义Interwiki -~wiki iw set mywiki https://mywiki.com/api.php - -删除自定义Interwiki -~wiki iw rm mywiki - -展示当前设置的Interwiki -~wiki iw list - -获取设置的Interwiki对应的api地址 -~wiki iw get mywiki - -展示当前设置的headers -~wiki headers show - -查询中wiki的“猫”页面 -~wiki 猫 - -查询英文版wiki中的“Cat”页面 -~wiki Cat -l en - -查询日语版wiki中的“ねこ”页面 -~wiki ねこ -l ja - -查询Wikidata中的“Albert Einstein”页面 -~wiki d:Q937 - -查询维基教科书中的“微积分”页面 -~wiki s:zh-cn:微积分 - -查询维基共享资源中的“猫”页面 -~wiki c:Cat - -查询维基语录中的“爱因斯坦”页面 -~wiki q:爱因斯坦 - -查询维基导游中的“北京”页面 -~wiki voy:北京 - -查询Meta-Wiki中的“管理员”页面 -~wiki m:管理员 - -查询wiki中的随机页面 -~wiki 随机页面 - -查询法语版wiki中的“猫”页面 -~wiki fr:Chat - -查询简体中文版wiki中的“猫”页面 -~wiki zh:猫 - -查询维基数据中心中的“贝多芬”页面 -~wiki datacenter:Q255 - -查询维基媒体基金会中的“Wikimedia Foundation”页面 -~wiki foundation:Wikimedia Foundation - -查询本地语言版wiki中的“猫”页面 -~wiki 猫 -l auto - -查询wiki中的“Python”页面: -~wiki wikipedia:Python - -查询wiki中的“Python”页面,并指定语言为中文: -~wiki wikipedia:Python -l zh - -查询wiki中的“随机页面”: -~wiki wikipedia:随机页面 - -查询mywiki中的“Python”页面: -~wiki mywiki:Python - -查询mywiki中的“Python”页面,并指定语言为法语: -~wiki mywiki:Python -l fr - -查询mywiki中的“随机页面”: -~wiki mywiki:随机页面 - -查询默认设置中的“Python”页面: -~wiki Python - -查询默认设置中的“Python”页面,并指定语言为德语: -~wiki Python -l de - -查询默认设置中的“随机页面”: -~wiki 随机页面 - -添加自定义Interwiki“mywiki”: -~wiki iw set mywiki http://mywiki.com/api.php - -删除自定义Interwiki“mywiki”: -~wiki iw rm mywiki - -展示当前设置的Interwiki: -~wiki iw list - -获取设置的Interwiki“mywiki”对应的API地址: -~wiki iw get mywiki - -获取 GitHub 用户 ChatGPT 的信息。 -~github ChatGPT - -获取 TensorFlow 仓库的信息。 -~github repo tensorflow/tensorflow - -获取 Microsoft 组织的信息。 -~github user Microsoft - -搜索 GitHub 上所有包含 "python" 关键词的仓库。 -~github search python - -搜索 GitHub 上所有使用 Python 语言的仓库。 -~github search language:python - -获取 Pandas 仓库的信息。 -~github repo pandas-dev/pandas - -获取 Google 组织的信息。 -~github user google - -获取 React 仓库的信息。 -~github repo facebook/react - -获取 Apple 组织的信息。 -~github user apple - -获取 Kubernetes 仓库的信息。 -~github repo kubernetes/kubernetes - -获取 OpenAI 组织的信息。 -~github user openai - -搜索 GitHub 上所有包含 "machine learning" 短语的仓库。 -~github search "machine learning" - -搜索 GitHub 上所有拥有 1000 个以上 stars 的仓库。 -~github search stars:>1000 - -获取 Linux 仓库的信息。 -~github repo torvalds/linux diff --git a/modules/natural/debug.py b/modules/natural/debug.py deleted file mode 100644 index 20110fb3..00000000 --- a/modules/natural/debug.py +++ /dev/null @@ -1,20 +0,0 @@ -import sys -from pathlib import Path - -import openai - -from config import Config - -file = Path(__file__).resolve() -parent, root = file.parent, file.parents[2] -sys.path.append(str(root)) - -# Load your API key from an environment variable or secret management service -openai.api_key = Config('openai_api_key') -model = Config('nl2c_model') - -while True: - i = input('>> ') - response = openai.Completion.create( - model=model, prompt=f'{i}\n\n###\n\n', temperature=0, max_tokens=256, stop=['\n']) - print(response['choices'][0]['text']) diff --git a/modules/natural/locales/en_us.json b/modules/natural/locales/en_us.json deleted file mode 100644 index f0d86071..00000000 --- a/modules/natural/locales/en_us.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "natural.help": "Convert natural language into Akaribot command by InstructGPT." -} \ No newline at end of file diff --git a/modules/natural/locales/zh_cn.json b/modules/natural/locales/zh_cn.json deleted file mode 100644 index 2742c066..00000000 --- a/modules/natural/locales/zh_cn.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "natural.help": "使用 InstructGPT 将自然语言转换成小可机器人命令。" -} \ No newline at end of file diff --git a/modules/natural/locales/zh_tw.json b/modules/natural/locales/zh_tw.json deleted file mode 100644 index 49a35f74..00000000 --- a/modules/natural/locales/zh_tw.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "natural.help": "使用 InstructGPT 將自然語言轉換成小可機器人指令。" -} \ No newline at end of file diff --git a/modules/ncmusic/__init__.py b/modules/ncmusic/__init__.py index 480e686d..16c8c9b4 100644 --- a/modules/ncmusic/__init__.py +++ b/modules/ncmusic/__init__.py @@ -41,35 +41,34 @@ async def search(msg: Bot.MessageSession, keyword: str): 'ID' ]) - if tables: - img = await image_table_render(tables) - if img: - legacy = False + img = await image_table_render(tables) + if img: + legacy = False - send_msg.append(Image(img)) - if len(result['result']['songs']) > 10: - send_msg.append(Plain(msg.locale.t('ncmusic.message.search.collapse'))) - send_msg.append(Plain(msg.locale.t('ncmusic.message.search.prompt'))) - query = await msg.wait_next_message(send_msg) - query = query.as_display(text_only=True) - try: - query = int(query) - if query > 10: - await msg.finish(msg.locale.t('ncmusic.message.search.invalid.out_of_range')) - sid = result['result']['songs'][query - 1]['id'] - url = f"https://ncmusic.akari-bot.top/song/detail?ids={sid}" - info = await get_url(url, 200, fmt='json') - info = info['songs'][0] - artist = ' / '.join([ar['name'] for ar in info['ar']]) - song_page = f"https://music.163.com/#/song?id={info['id']}" + send_msg.append(Image(img)) + if len(result['result']['songs']) > 10: + send_msg.append(Plain(msg.locale.t('ncmusic.message.search.collapse'))) + send_msg.append(Plain(msg.locale.t('ncmusic.message.search.prompt'))) + query = await msg.wait_next_message(send_msg) + query = query.as_display(text_only=True) + try: + query = int(query) + if query > 10: + await msg.finish(msg.locale.t('ncmusic.message.search.invalid.out_of_range')) + sid = result['result']['songs'][query - 1]['id'] + url = f"https://ncmusic.akari-bot.top/song/detail?ids={sid}" + info = await get_url(url, 200, fmt='json') + info = info['songs'][0] + artist = ' / '.join([ar['name'] for ar in info['ar']]) + song_page = f"https://music.163.com/#/song?id={info['id']}" - send_msg = msg.locale.t('ncmusic.message.info', - name=info['name'], id=info['id'], - album=info['al']['name'], album_id=info['al']['id'], - artists=artist, detail=song_page) - await msg.finish([Image(info['al']['picUrl']), Plain(send_msg)]) - except Exception: - await msg.finish(msg.locale.t('ncmusic.message.search.invalid.non_digital')) + send_msg = msg.locale.t('ncmusic.message.info', + name=info['name'], id=info['id'], + album=info['al']['name'], album_id=info['al']['id'], + artists=artist, detail=song_page) + await msg.finish([Image(info['al']['picUrl']), Plain(send_msg)]) + except Exception: + await msg.finish(msg.locale.t('ncmusic.message.search.invalid.non_digital')) if legacy: send_msg = msg.locale.t('ncmusic.message.search.result') + '\n' diff --git a/modules/phigros/update.py b/modules/phigros/update.py index bca2af58..c1668f3b 100644 --- a/modules/phigros/update.py +++ b/modules/phigros/update.py @@ -6,13 +6,14 @@ import string import ujson as json +from config import Config from core.utils.cache import random_cache_path from core.utils.http import get_url, download_to_cache from core.logger import Logger assets_path = os.path.abspath('./assets/phigros') -cache_path = os.path.abspath('./cache') -rating_path = os.path.abspath('./assets/phigros/rating.json') +cache_path = os.path.abspath(Config('cache_path')) +rating_path = os.path.abspath(f'{assets_path}/rating.json') json_url = 'https://raw.githubusercontent.com/ssmzhn/Phigros/main/Phigros.json' json_url_mirror = 'https://gh.api.99988866.xyz/https://raw.githubusercontent.com/ssmzhn/Phigros/main/Phigros.json' diff --git a/modules/wiki/audit.py b/modules/wiki/audit.py index 49ae4994..b45f2787 100644 --- a/modules/wiki/audit.py +++ b/modules/wiki/audit.py @@ -9,7 +9,7 @@ from modules.wiki.utils.wikilib import WikiLib if Config('enable_urlmanager'): - aud = module('wiki_audit', developers=['Dianliang233', 'OasisAkari'], required_superuser=True, + aud = module('wiki_audit', required_superuser=True, alias='wau') @aud.command(['trust ', 'block ']) diff --git a/schedulers/maimai_alias.py b/schedulers/maimai_alias.py deleted file mode 100644 index df7c46ca..00000000 --- a/schedulers/maimai_alias.py +++ /dev/null @@ -1,15 +0,0 @@ -from config import Config -from core.builtins import Bot -from core.logger import Logger -from core.scheduler import CronTrigger, Scheduler -from modules.maimai.libraries.maimaidx_api_data import update_alias - - -@Scheduler.scheduled_job(CronTrigger.from_crontab('0 0 * * *')) -async def maimai_alias(): - Logger.info('Updating maimai alias...') - try: - await update_alias() - except Exception: - if Config('debug'): - Logger.error(traceback.format_exc()) \ No newline at end of file