From 135d93722cebbaddde2a082a1f7963a9ae3b4c28 Mon Sep 17 00:00:00 2001 From: BadHappy <1196554262@qq.com> Date: Sat, 30 Dec 2023 16:51:39 +0800 Subject: [PATCH 1/5] =?UTF-8?q?hitokoto=E4=BF=AE=E4=B8=80=E4=B8=8B?= =?UTF-8?q?=EF=BC=8C=E8=B0=A2=E8=B0=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 4 + .idea/.gitignore | 3 + .idea/icalingua-python-bot.iml | 8 + .../inspectionProfiles/profiles_settings.xml | 6 + .idea/misc.xml | 4 + .idea/modules.xml | 8 + .idea/vcs.xml | 6 + LICENSE | 373 ++++ bot/types.py | 64 + config-temp.toml | 5 + connect.py | 343 ++++ ica-rs/.gitignore | 1 + ica-rs/Cargo.lock | 1630 +++++++++++++++++ ica-rs/Cargo.toml | 16 + ica-rs/src/client.rs | 25 + ica-rs/src/main.rs | 79 + main.py | 1 + module/hitokoto/__init__.py | 43 + module/hitokoto/test.py | 0 module/minecraft_server/__init__.py | 0 readme.md | 48 + requirement.txt | 6 + 22 files changed, 2673 insertions(+) create mode 100644 .gitignore create mode 100644 .idea/.gitignore create mode 100644 .idea/icalingua-python-bot.iml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 LICENSE create mode 100644 bot/types.py create mode 100644 config-temp.toml create mode 100644 connect.py create mode 100644 ica-rs/.gitignore create mode 100644 ica-rs/Cargo.lock create mode 100644 ica-rs/Cargo.toml create mode 100644 ica-rs/src/client.rs create mode 100644 ica-rs/src/main.rs create mode 100644 main.py create mode 100644 module/hitokoto/__init__.py create mode 100644 module/hitokoto/test.py create mode 100644 module/minecraft_server/__init__.py create mode 100644 readme.md create mode 100644 requirement.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bd09c59 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +/venv +config.toml +.vs +.vscode \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..359bb53 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml diff --git a/.idea/icalingua-python-bot.iml b/.idea/icalingua-python-bot.iml new file mode 100644 index 0000000..7c91e7f --- /dev/null +++ b/.idea/icalingua-python-bot.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..1260ee9 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..ecc691b --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..a612ad9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,373 @@ +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/bot/types.py b/bot/types.py new file mode 100644 index 0000000..2a7433c --- /dev/null +++ b/bot/types.py @@ -0,0 +1,64 @@ +from typing import Optional +from lib_not_dr.types import Options + + +class SocketData(Options): + name = 'SocketData' + + def init(self, **kwargs) -> bool: + self.from_json(kwargs) + return False + + def from_json(self, data: dict): + ... + + def to_json(self) -> dict: + return self.option() + + +class Message(SocketData): + name = 'icalingua socket message' + + # 消息 id + message_id: str + # 发送者 id + sender_id: int + # 发送者昵称 + sender_name: str + # 消息内容 + content: str + + # 消息时间戳 + # 13:32:46 + time_stamp: str + # 消息日期 + # 2023/10/05 + date: str + # unix 时间戳 + # 1633395166 + unix_time_stamp: int + + # 发送者身份 + role: str + # 发送者群昵称/备注 + title: str + # 匿名 id + anonymous_id: Optional[int] = None + # 是否匿名 + is_anonymous: bool = False + # 啊 ? + bubble_id: int + # 啊 ? + sub_id: int + + file: Optional[dict] = None + files: Optional[list] = None + + +class AddMessage(SocketData): + name = 'icalingua socket add message event' + + room_id: int + + + diff --git a/config-temp.toml b/config-temp.toml new file mode 100644 index 0000000..911b78b --- /dev/null +++ b/config-temp.toml @@ -0,0 +1,5 @@ + +private_key = "d76a25fea1d5c3c8ccfdb31179798f31f87a2afc7e8feda3f67d515790ee9ee5" # 与 icalingua 客户端使用的 private_key 一致 +host = "http://192.168.1.6:6789" # docker 版 icalingua 服务的地址 +self_id = 2163534756 # 机器人的 qq 号 + diff --git a/connect.py b/connect.py new file mode 100644 index 0000000..82e04a4 --- /dev/null +++ b/connect.py @@ -0,0 +1,343 @@ +import time +import random +import asyncio +import traceback + +from typing import Dict, List, Tuple, Any, Optional, Union, Literal + +import qtoml +import socketio +from colorama import Fore, Style +from nacl.signing import SigningKey +from lib_not_dr.types import Options +from mcstatus import JavaServer + +# 功能包引用处 +from module import hitokoto + +# 功能包结束引用 + +def get_config() -> Tuple[str, str, int]: + with open('config-temp.toml', 'r', encoding='utf-8') as f: + config = qtoml.load(f) + return config['host'], config['private_key'], config['self_id'] + + +HOST, KEY, SELF_ID = get_config() + + +class AtElement(Options): + text: str + id: Union[int, Literal['all']] = 'all' + + +class ReplyMessage(Options): + id: str + username: str = '' + content: str = '' + files: list = [] + + def to_json(self) -> dict: + return { + '_id': self.id, + 'username': self.username, + 'content': self.content, + 'files': self.files + } + + +class Message(Options): + content: str + room_id: Optional[int] = None + room: Optional[int] = None # room id 和 room 二选一 ( 实际上直接填 room id 就行了 ) + file: None = None # TODO: 上传文件 + reply_to: Optional[ReplyMessage] = None # 源码 给了一个 any TODO: 回复消息 + b64_img: Optional[str] = None # TODO: 发送图片 + at: Optional[List[AtElement]] = [] # TODO: @某人 + sticker: Optional[None] = None # TODO: 发送表情 + message_type: Optional[str] = None # TODO: 消息类型 + + def to_json(self) -> dict: + return { + 'content': self.content, + 'roomId': self.room_id, + 'room': self.room, + 'file': self.file, + 'replyMessage': self.reply_to.to_json() if self.reply_to else None, + 'b64img': self.b64_img, + 'at': self.at, + 'sticker': self.sticker, + 'messageType': self.message_type + } + + +sio: socketio.AsyncClient = socketio.AsyncClient() + + +@sio.on('connect') +def connect(): + print(f'{Fore.GREEN}icalingua 已连接{Style.RESET_ALL}') + + +@sio.on('requireAuth') +async def require_auth(salt: str, versions: Dict[str, str]): + print(f"{Fore.BLUE}versions: {versions}{Style.RESET_ALL}\n{type(salt)}|{salt=}") + # 准备数据 + sign = SigningKey(bytes.fromhex(KEY)) + signature = sign.sign(bytes.fromhex(salt)) + + # 发送数据 + print(f"{len(signature.signature)=} {type(signature.signature)=}") + await sio.emit('auth', signature.signature) + print(f"{Fore.BLUE}send auth emit{Style.RESET_ALL}") + +# @sio.on('requireAuth') +# def require_auth(*data: Dict[str, Any]): +# print(f"{Fore.BLUE}requireAuth: {data}{Style.RESET_ALL}") + + +@sio.on('auth') +def auth(data: Dict[str, Any]): + print(f"auth: {data}") + + +@sio.on('authFailed') +async def auth_failed(): + print(f"{Fore.RED}authFailed{Style.RESET_ALL}") + await sio.disconnect() + + +@sio.on('authSucceed') +def auth_succeed(): + print(f"{Fore.GREEN}authSucceed{Style.RESET_ALL}") + + +@sio.on('connect_error') +def connect_error(*args, **kwargs): + print(f"连接错误 {args}, {kwargs}") + + +@sio.on('updateRoom') +def update_room(data: Dict[str, Any]): + print(f"{Fore.CYAN}update_room: {data}{Style.RESET_ALL}") + + +def safe_eval(code: str) -> str: + try: + # code = code.replace('help', '坏东西!\n') + # code = code.replace('bytes', '坏东西!\n') + # code = code.replace('encode', '坏东西!\n') + # code = code.replace('decode', '坏东西!\n') + # code = code.replace('compile', '屑的!\n') + # code = code.replace('globals', '拿不到!\n') + code = code.replace('os', '坏东西!\n') + code = code.replace('sys', '坏东西!\n') + # code = code.replace('input', '坏东西!\n') + # code = code.replace('__', '啊哈!\n') + # code = code.replace('import', '很坏!\n') + code = code.replace(' kill', '别跑!\n') + code = code.replace(' rm ', '别跑!\n') + code = code.replace('exit', '好坏!\n') + code = code.replace('eval', '啊哈!\n') + code = code.replace('exec', '抓住!\n') + start_time = time.time() + try: + import os + import math + import decimal + global_val = {'time': time, + 'math': math, + 'decimal': decimal, + 'random': random, + '__import__': '', + 'globals': '也别惦记你那个 globals 了', + 'compile': '想得美', + 'help': '虽然但是 help 也不行', + 'exit': '不许 exit', + 'input': '你想干嘛', + 'return': '别惦记你那个 return 了', + 'getattr': '', + 'setattr': ''} + os.system = '不许' + result = str(eval(code, global_val, {})) + limit = 500 + if len(result) > limit: + result = result[:limit] + except: + result = traceback.format_exc() + end_time = time.time() + result = result.replace(KEY, '***') + result = result.replace(HOST, '***') + + print(f"{Fore.MAGENTA}safe_eval: {result}{Style.RESET_ALL}") + + if result == '6' or result == 6: + result = '他确实等于 6' + + result = f'{code}\neval result:\n{result}\n耗时: {end_time - start_time} s' + return result + except: + error = traceback.format_exc() + result = f'error:\n{error}' + return result + + +@sio.on('addMessage') +async def add_message(data: Dict[str, Any]): + print(f"{Fore.MAGENTA}add_message: {data}{Style.RESET_ALL}") + + is_self = data['message']['senderId'] == SELF_ID + sender_name = data['message']['username'] + sender_id = data['message']['senderId'] + content = data['message']['content'] + room_id = data['roomId'] + + if not is_self: + if data.get('message').get('content') == '/bot': + message = Message(content='icalingua bot test', + room_id=data['roomId']) + await sio.emit('sendMessage', message.to_json()) + + elif content == '!!status': + server = JavaServer.lookup("192.168.1.6:25565") + status=server.status() + # query = server.query() + + # if status.players.online != 0: + # message = Message(content=f"此服务器有 {status.players.online} 个玩家在线\n当前在线玩家有 {.join(query.players.names)}",room_id=data['roomId']) + # else: + # message = Message(content=f"此服务器空无一人",room_id=data['roomId']) + + message = Message(content=f"此服务器有 {status.players.online} 个玩家在线",room_id=data['roomId']) + + await sio.emit('sendMessage', message.to_json()) + + elif content == '!!players': + server = JavaServer.lookup("192.168.1.6:25565") + query = server.query() + players = query.players.names + message = Message(content=f"此服务器当前在线玩家有 {players}",room_id=data['roomId']) + + await sio.emit('sendMessage', message.to_json()) + + elif content.startswith("!!hitokoto "): + + ctypet = content[len("!!hitokoto "):] + + result_code, result_data = hitokoto.hitokoto(ctypet) + + if result_code == 3: + message = Message(content=f"参数不对哦!",room_id=data['roomId']) + elif result_code == 0: + message = Message(f"Hitokoto: {result_data['hitokoto']}") + else: + message = Message(content=f"但你看到这条消息就代表有bug出炉", room_id=data['roomId']) + + await sio.emit('sendMessage', message.to_json()) + + elif data.get('message').get('content').startswith('=='): + + evals: str = data.get('message').get('content')[2:] + + # quene = multiprocessing.Queue() + # def run(quene, evals): + # go = safe_eval(evals) + # quene.put(go) + # process = multiprocessing.Process(target=run, args=(quene, evals)) + # process.start() + # process.join(1) + # if quene.empty(): + # result = '超时' + # else: + # result = quene.get() + whitelist = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ' ', '.', '+', '-', '*', '/', '(', ')', '<', + '>', '='] + evals = evals.replace('**', '') + express = '' + for text in evals: + if text in whitelist: + express += text + if express == '': + result = '你在干嘛' + else: + result = str(eval(express)) + + reply = ReplyMessage(id=data['message']['_id']) + message = Message(content=result, + reply_to=reply, + room_id=room_id) + + await asyncio.sleep(random.random() * 2) + await sio.emit('sendMessage', message.to_json()) + elif data['message']['content'] == '!!jrrp': + randomer = random.Random(f'{sender_id}-{data["message"]["date"]}-jrrp-v2') + result = randomer.randint(0, 50) + randomer.randint(0, 50) + print(f'{sender_name} 今日人品值为 {result}') + reply = ReplyMessage(id=data['message']['_id']) + message = Message(content=f'{sender_name} 今日人品值为 {result}', + reply_to=reply, + room_id=room_id) + await asyncio.sleep(0.5) + await sio.emit('sendMessage', message.to_json()) + # 如果只包括一个或多个 6 + # elif data['message']['content'].replace(' ', '') in ('6', '666', '六', '3+3', '5+1', '4+2', '2+4', '1+5'): + # reply = ReplyMessage(id=data['message']['_id']) + # message = Message(content='你 6 nm 呢', + # reply_to=reply, + # room_id=room_id) + # await asyncio.sleep(0.5) + # await sio.emit('sendMessage', message.to_json()) + + +@sio.on('deleteMessage') +def delete_message(message_id: str): + print(f"{Fore.MAGENTA}delete_message: {message_id}{Style.RESET_ALL}") + + +@sio.on('setMessages') +def set_messages(data: Dict[str, Any]): + print(f"{Fore.YELLOW}set_messages: {data}\nmessage_len: {len(data['messages'])}{Style.RESET_ALL}") + + +@sio.on('setAllRooms') +def set_all_rooms(rooms: List[Dict[str, Any]]): + print(f"{Fore.YELLOW}set_all_rooms: {rooms}\nlen: {len(rooms)}\n{Style.RESET_ALL}") + + +@sio.on('setAllChatGroups') +def set_all_chat_groups(groups: List[Dict[str, Any]]): + print(f"{Fore.YELLOW}set_all_chat_groups: {groups}\nlen: {len(groups)}\n{Style.RESET_ALL}") + + +@sio.on('notify') +def notify(data: List[Tuple[str, Any]]): + print(f"notify: {data}") + + +@sio.on('closeLoading') +def close_loading(_): + print(f"{Fore.GREEN}close_loading{Style.RESET_ALL}") + + +@sio.on('onlineData') +def online_data(data: Dict[str, Any]): + print(f"{Fore.GREEN}online_data: {data}{Style.RESET_ALL}") + + +@sio.on('*') +def catch_all(event, data): + print(f"{Fore.RED}catch_all: {event}|{data}{Style.RESET_ALL}") + + +async def main(): + await sio.connect(HOST) + await sio.wait() + + # await sio.emit('requireAuth', ('', {'version': '', 'protocolVersion': ''})) + # await asyncio.sleep(2) + + # await asyncio.gather(sio.wait(), sio.wait(), sio.wait()) + + +if __name__ == '__main__': + asyncio.run(main()) diff --git a/ica-rs/.gitignore b/ica-rs/.gitignore new file mode 100644 index 0000000..1de5659 --- /dev/null +++ b/ica-rs/.gitignore @@ -0,0 +1 @@ +target \ No newline at end of file diff --git a/ica-rs/Cargo.lock b/ica-rs/Cargo.lock new file mode 100644 index 0000000..bdb9111 --- /dev/null +++ b/ica-rs/Cargo.lock @@ -0,0 +1,1630 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "adler32" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" + +[[package]] +name = "async-stream" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" +dependencies = [ + "async-stream-impl", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "async-trait" +version = "0.1.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "backoff" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b62ddb9cb1ec0a098ad4bbf9344d0713fa193ae1a80af55febcff2627b6a00c1" +dependencies = [ + "getrandom", + "instant", + "rand", +] + +[[package]] +name = "backtrace" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base64" +version = "0.21.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" + +[[package]] +name = "cc" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "const-oid" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" + +[[package]] +name = "cpufeatures" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" +dependencies = [ + "libc", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "curve25519-dalek" +version = "4.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "platforms", + "rustc_version", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "data-encoding" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" + +[[package]] +name = "der" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f628eaec48bfd21b865dc2950cfa014450c01d2fa2b69a86c2fd5844ec523c0" +dependencies = [ + "curve25519-dalek", + "ed25519", + "serde", + "sha2", + "subtle", + "zeroize", +] + +[[package]] +name = "encoding_rs" +version = "0.8.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "fastrand" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" + +[[package]] +name = "fiat-crypto" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27573eac26f4dd11e2b1916c3fe1baa56407c83c71a773a8ba17ec0bca03b6b7" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" + +[[package]] +name = "futures-io" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" + +[[package]] +name = "futures-macro" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" + +[[package]] +name = "futures-task" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" + +[[package]] +name = "futures-util" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" +dependencies = [ + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "gimli" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" + +[[package]] +name = "h2" +version = "0.3.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" + +[[package]] +name = "hermit-abi" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "http" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "0.14.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2 0.4.10", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", +] + +[[package]] +name = "ica-rs" +version = "0.1.0" +dependencies = [ + "ed25519", + "ed25519-dalek", + "hex", + "rust_socketio", + "serde_json", +] + +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "indexmap" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "ipnet" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" + +[[package]] +name = "itoa" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" + +[[package]] +name = "js-sys" +version = "0.3.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.150" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" + +[[package]] +name = "linux-raw-sys" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "memchr" +version = "2.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.48.0", +] + +[[package]] +name = "native-tls" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "object" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "openssl" +version = "0.10.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b8419dc8cc6d866deb801274bba2e6f8f6108c1bb7fcc10ee5ab864931dbb45" +dependencies = [ + "bitflags 2.4.1", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.97" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3eaad34cdd97d81de97964fc7f29e2d104f483840d906ef56daa1912338460b" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "pkg-config" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" + +[[package]] +name = "platforms" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14e6ab3f592e6fb464fc9712d8d6e6912de6473954635fd76a589d832cffcbb0" + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "proc-macro2" +version = "1.0.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "reqwest" +version = "0.11.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" +dependencies = [ + "base64", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-tls", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "serde", + "serde_json", + "serde_urlencoded", + "system-configuration", + "tokio", + "tokio-native-tls", + "tokio-util", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams", + "web-sys", + "winreg", +] + +[[package]] +name = "rust_engineio" +version = "0.4.4" +dependencies = [ + "adler32", + "async-stream", + "async-trait", + "base64", + "bytes", + "futures-util", + "http", + "native-tls", + "reqwest", + "serde", + "serde_json", + "thiserror", + "tokio", + "tokio-tungstenite", + "tungstenite", + "url", +] + +[[package]] +name = "rust_socketio" +version = "0.4.4" +dependencies = [ + "adler32", + "backoff", + "base64", + "bytes", + "log", + "native-tls", + "rand", + "rust_engineio", + "serde", + "serde_json", + "thiserror", + "url", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" +dependencies = [ + "bitflags 2.4.1", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + +[[package]] +name = "ryu" +version = "1.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" + +[[package]] +name = "schannel" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +dependencies = [ + "windows-sys 0.48.0", +] + +[[package]] +name = "security-framework" +version = "2.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "semver" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" + +[[package]] +name = "serde" +version = "1.0.193" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.193" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "rand_core", +] + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "socket2" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "socket2" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + +[[package]] +name = "syn" +version = "2.0.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "tempfile" +version = "3.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" +dependencies = [ + "cfg-if", + "fastrand", + "redox_syscall", + "rustix", + "windows-sys 0.48.0", +] + +[[package]] +name = "thiserror" +version = "1.0.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.35.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d45b238a16291a4e1584e61820b8ae57d696cc5015c459c229ccc6990cc1c" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "num_cpus", + "pin-project-lite", + "socket2 0.5.5", + "windows-sys 0.48.0", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c" +dependencies = [ + "futures-util", + "log", + "native-tls", + "tokio", + "tokio-native-tls", + "tungstenite", +] + +[[package]] +name = "tokio-util" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "tungstenite" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e3dac10fd62eaf6617d3a904ae222845979aec67c615d1c842b4002c7666fb9" +dependencies = [ + "byteorder", + "bytes", + "data-encoding", + "http", + "httparse", + "log", + "native-tls", + "rand", + "sha1", + "thiserror", + "url", + "utf-8", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicode-bidi" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "url" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" + +[[package]] +name = "wasm-streams" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4609d447824375f43e1ffbc051b50ad8f4b3ae8219680c94452ea05eb240ac7" +dependencies = [ + "futures-util", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "web-sys" +version = "0.3.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.0", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +dependencies = [ + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" + +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + +[[package]] +name = "zeroize" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" diff --git a/ica-rs/Cargo.toml b/ica-rs/Cargo.toml new file mode 100644 index 0000000..3cf45bc --- /dev/null +++ b/ica-rs/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "ica-rs" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +ed25519 = "2.2.3" +ed25519-dalek = "2.1.0" +hex = "0.4.3" +rust_socketio = "0.4.4" +serde_json = "1.0.108" + +[patch.crates-io] +rust_socketio = { path = "V:/githubs/rust-socketio/socketio" } \ No newline at end of file diff --git a/ica-rs/src/client.rs b/ica-rs/src/client.rs new file mode 100644 index 0000000..c3d1e0e --- /dev/null +++ b/ica-rs/src/client.rs @@ -0,0 +1,25 @@ +use ed25519_dalek::{Signature, Signer, SigningKey}; + +pub struct IcalinguaSinger { + pub host: String, + pub pub_key: SigningKey, +} + +impl IcalinguaSinger { + pub fn new(host: String, pub_key: &str) -> Self { + let array_key: [u8; 32] = hex::decode(pub_key).unwrap().try_into().unwrap(); + + let signing_key: SigningKey = SigningKey::from_bytes(&array_key); + Self { + host, + pub_key: signing_key, + } + } + + pub fn sign_for_salt(&self, salt: String) -> Vec { + let salt: Vec = hex::decode(salt).unwrap(); + let signature: Signature = self.pub_key.sign(salt.as_slice()); + + signature.to_bytes().to_vec() + } +} diff --git a/ica-rs/src/main.rs b/ica-rs/src/main.rs new file mode 100644 index 0000000..820a035 --- /dev/null +++ b/ica-rs/src/main.rs @@ -0,0 +1,79 @@ +mod client; + +use ed25519_dalek::{Signature, Signer, SigningKey}; +use rust_socketio::{ClientBuilder, Event, Payload, RawClient}; +use serde_json::Value; +use std::time::Duration; + +#[allow(unused)] +fn require_auth_callback(payload: Payload, client: RawClient, _id: Option) { + let key = std::env::args().nth(2).expect("No key given"); + let require_data = match payload { + Payload::String(_) => None, + Payload::Binary(_) => None, + Payload::Text(json_value) => Some(json_value), + } + .expect("Payload should be Json data"); + + println!("require_data: {:?}", require_data); + + // let (auth_key, version) = (&require_data[0], &require_data[1]); + // println!("auth_key: {:?}, version: {:?}", auth_key, version); + let auth_key = match &require_data.get(0) { + Some(Value::String(auth_key)) => Some(auth_key), + _ => None, + } + .expect("auth_key should be string"); + + let array_key: [u8; 32] = hex::decode(key) + .expect("Key should be hex") + .try_into() + .expect("Key should be 32 bytes"); + + let signing_key: SigningKey = SigningKey::from_bytes(&array_key); + + let salt = hex::decode(auth_key).expect("Got an invalid salt from the server"); + let signature: Signature = signing_key.sign(salt.as_slice()); + // let sign = hex::encode(signature.to_bytes()); + let sign = signature.to_bytes().to_vec(); + client.emit("auth", sign).unwrap(); +} + +#[allow(unused)] +fn any_event(event: Event, payload: Payload, _client: RawClient, id: Option) { + // println!("event: {} | {:#?}", event, payload); + match payload { + Payload::Binary(bin) => println!("event: {}|id:{:?}|bin: {:?}", event, id, bin), + Payload::String(str) => println!("event: {}|id:{:?}|str: {:?}", event, id, str), + Payload::Text(txt) => println!("event: {}|id:{:?}|txt: {:?}", event, id, txt), + } +} + +fn ws_main() { + // define a callback which is called when a payload is received + // this callback gets the payload as well as an instance of the + // socket to communicate with the server + let connect_call_back = |payload: Payload, _client: RawClient, _id| { + println!("Connect callback: {:#?}", payload); + }; + // 从命令行获取 host 和 key + let host = std::env::args().nth(1).expect("No host given"); + + // get a socket that is connected to the admin namespace + + let socket = ClientBuilder::new(host) + // .namespace("/admin") + .on_any(any_event) + .on("connect", connect_call_back) + .on("requireAuth", require_auth_callback) + .connect() + .expect("Connection failed"); + + std::thread::sleep(Duration::from_secs(10)); + + socket.disconnect().expect("Disconnect failed") +} + +fn main() { + ws_main(); +} diff --git a/main.py b/main.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/main.py @@ -0,0 +1 @@ + diff --git a/module/hitokoto/__init__.py b/module/hitokoto/__init__.py new file mode 100644 index 0000000..d27294a --- /dev/null +++ b/module/hitokoto/__init__.py @@ -0,0 +1,43 @@ +import requests +import random + + +def hitokoto(ctypet): + if ctypet == '动画' or ctypet == 'a': + ctype = 'a' + elif ctypet == '漫画' or ctypet == 'b': + ctype = 'b' + elif ctypet == '游戏' or ctypet == 'c': + ctype = 'c' + elif ctypet == '文学' or ctypet == 'd': + ctype = 'd' + elif ctypet == '原创' or ctypet == 'e': + ctype = 'e' + elif ctypet == '网络' or ctypet == 'f': + ctype = 'f' + elif ctypet == '其他' or ctypet == 'g': + ctype = 'g' + elif ctypet == '影视' or ctypet == 'h': + ctype = 'h' + elif ctypet == '诗词' or ctypet == 'i': + ctype = 'i' + elif ctypet == '网易云' or ctypet == 'j': + ctype = 'j' + elif ctypet == '哲学' or ctypet == 'k': + ctype = 'k' + elif ctypet == '抖机灵' or ctypet == 'l': + ctype = 'l' + else: + ctype = random.choice('abcdefghijkl') + return 3, None + + params_value = {'c': ctype} + hitokoto = requests.get('https://v1.hitokoto.cn', params=params_value) + + return 0, hitokoto.json() + + # except Exception as e: + # return 2, None + + + diff --git a/module/hitokoto/test.py b/module/hitokoto/test.py new file mode 100644 index 0000000..e69de29 diff --git a/module/minecraft_server/__init__.py b/module/minecraft_server/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..f1d2d46 --- /dev/null +++ b/readme.md @@ -0,0 +1,48 @@ +# icalingua bot + +## 源项目 +本项目fork自[icalingua-python-bot](http://shenjack.top:5100/shenjack/icalingua-python-bot) \ +fork时版本[69f202e83a7477490a58b5a1548d7d9240e82c72](http://shenjack.top:5100/shenjack/icalingua-python-bot/commit/69f202e83a7477490a58b5a1548d7d9240e82c72) + +## 简介 + +这是一个基于 icalingua docker 版的 bot + +> 出于某个企鹅, 和保护 作者 和 原项目 ( ica ) 的原因 \ +> 功能请自行理解 + +## 使用方法 + +- 安装依赖 + +```powershell +python -m pip install -r requirement.txt +``` + +> 如果你想使用虚拟环境 \ +> 可以使用 `python -m venv venv` 创建虚拟环境 \ +> 然后使用 `venv\Scripts\activate` 激活虚拟环境 \ +> 最后使用 `python -m pip install -r requirement.txt` 安装依赖 + +- 修改配置文件 + +```powershell +Copy-Item config-temp.toml config.toml +# 欸我就用 powershell +``` + +- icalingua 启动! + +```bash +# 用你自己的方法启动你的 icalingua 后端 +# 例如 +docker start icalingua +# 或者 +docker up -d +``` + +- bot 启动! + +```powershell +python connect.py +``` \ No newline at end of file diff --git a/requirement.txt b/requirement.txt new file mode 100644 index 0000000..b861617 --- /dev/null +++ b/requirement.txt @@ -0,0 +1,6 @@ +lib-not-dr +colorama +qtoml +pynacl +python-socketio[asyncio_client] +mcstatus \ No newline at end of file From e4daefab519f42c2489f2ca523a4e55096c73c09 Mon Sep 17 00:00:00 2001 From: BadHappy <1196554262@qq.com> Date: Sat, 30 Dec 2023 16:53:58 +0800 Subject: [PATCH 2/5] =?UTF-8?q?hitokoto=E4=BF=AE=E4=B8=80=E4=B8=8B?= =?UTF-8?q?=EF=BC=8C=E8=B0=A2=E8=B0=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config-temp.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/config-temp.toml b/config-temp.toml index 911b78b..8b13789 100644 --- a/config-temp.toml +++ b/config-temp.toml @@ -1,5 +1 @@ -private_key = "d76a25fea1d5c3c8ccfdb31179798f31f87a2afc7e8feda3f67d515790ee9ee5" # 与 icalingua 客户端使用的 private_key 一致 -host = "http://192.168.1.6:6789" # docker 版 icalingua 服务的地址 -self_id = 2163534756 # 机器人的 qq 号 - From 1652fe4775ae7b0dbabfe3666dbbd057c1dfa353 Mon Sep 17 00:00:00 2001 From: BadHappy <1196554262@qq.com> Date: Sat, 30 Dec 2023 16:55:25 +0800 Subject: [PATCH 3/5] =?UTF-8?q?hitokoto=E4=BF=AE=E4=B8=80=E4=B8=8B?= =?UTF-8?q?=EF=BC=8C=E8=B0=A2=E8=B0=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config-temp.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config-temp.toml b/config-temp.toml index 8b13789..911b78b 100644 --- a/config-temp.toml +++ b/config-temp.toml @@ -1 +1,5 @@ +private_key = "d76a25fea1d5c3c8ccfdb31179798f31f87a2afc7e8feda3f67d515790ee9ee5" # 与 icalingua 客户端使用的 private_key 一致 +host = "http://192.168.1.6:6789" # docker 版 icalingua 服务的地址 +self_id = 2163534756 # 机器人的 qq 号 + From 6b7a6481a29dc633b29137bad21f66a933dab392 Mon Sep 17 00:00:00 2001 From: BadHappy <1196554262@qq.com> Date: Sat, 30 Dec 2023 17:27:02 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=EF=BC=8C=E4=BF=AE=E6=94=B9=E9=83=A8=E5=88=86?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config-temp.toml | 7 +- connect.py | 14 ++-- module/hitokoto/__init__.py | 73 ++++++++++-------- .../__pycache__/__init__.cpython-311.pyc | Bin 0 -> 470 bytes .../__pycache__/__init__.cpython-39.pyc | Bin 0 -> 1025 bytes 5 files changed, 53 insertions(+), 41 deletions(-) create mode 100644 module/hitokoto/__pycache__/__init__.cpython-311.pyc create mode 100644 module/hitokoto/__pycache__/__init__.cpython-39.pyc diff --git a/config-temp.toml b/config-temp.toml index 911b78b..5ff2239 100644 --- a/config-temp.toml +++ b/config-temp.toml @@ -1,5 +1,4 @@ -private_key = "d76a25fea1d5c3c8ccfdb31179798f31f87a2afc7e8feda3f67d515790ee9ee5" # 与 icalingua 客户端使用的 private_key 一致 -host = "http://192.168.1.6:6789" # docker 版 icalingua 服务的地址 -self_id = 2163534756 # 机器人的 qq 号 - +private_key = "" # 与 icalingua 客户端使用的 private_key 一致 +host = "" # docker 版 icalingua 服务的地址 +self_id = 0 # 机器人的 qq 号 diff --git a/connect.py b/connect.py index 82e04a4..1455675 100644 --- a/connect.py +++ b/connect.py @@ -18,7 +18,7 @@ from module import hitokoto # 功能包结束引用 def get_config() -> Tuple[str, str, int]: - with open('config-temp.toml', 'r', encoding='utf-8') as f: + with open('config.toml', 'r', encoding='utf-8') as f: config = qtoml.load(f) return config['host'], config['private_key'], config['self_id'] @@ -220,16 +220,20 @@ async def add_message(data: Dict[str, Any]): await sio.emit('sendMessage', message.to_json()) - elif content.startswith("!!hitokoto "): + elif content.startswith("!!hitokoto"): ctypet = content[len("!!hitokoto "):] - - result_code, result_data = hitokoto.hitokoto(ctypet) + if content == "!!hitokoto": + result_code, result_data = hitokoto.hitokoto("没有") + else: + result_code, result_data = hitokoto.hitokoto(ctypet) if result_code == 3: message = Message(content=f"参数不对哦!",room_id=data['roomId']) + elif result_code == 2: + message = Message(content=f"发生了不可描述的错误X_X", room_id=data['roomId']) elif result_code == 0: - message = Message(f"Hitokoto: {result_data['hitokoto']}") + message = Message(content=f"Hitokoto: {result_data['hitokoto']}", room_id=data['roomId']) else: message = Message(content=f"但你看到这条消息就代表有bug出炉", room_id=data['roomId']) diff --git a/module/hitokoto/__init__.py b/module/hitokoto/__init__.py index d27294a..69316d5 100644 --- a/module/hitokoto/__init__.py +++ b/module/hitokoto/__init__.py @@ -3,41 +3,50 @@ import random def hitokoto(ctypet): - if ctypet == '动画' or ctypet == 'a': - ctype = 'a' - elif ctypet == '漫画' or ctypet == 'b': - ctype = 'b' - elif ctypet == '游戏' or ctypet == 'c': - ctype = 'c' - elif ctypet == '文学' or ctypet == 'd': - ctype = 'd' - elif ctypet == '原创' or ctypet == 'e': - ctype = 'e' - elif ctypet == '网络' or ctypet == 'f': - ctype = 'f' - elif ctypet == '其他' or ctypet == 'g': - ctype = 'g' - elif ctypet == '影视' or ctypet == 'h': - ctype = 'h' - elif ctypet == '诗词' or ctypet == 'i': - ctype = 'i' - elif ctypet == '网易云' or ctypet == 'j': - ctype = 'j' - elif ctypet == '哲学' or ctypet == 'k': - ctype = 'k' - elif ctypet == '抖机灵' or ctypet == 'l': - ctype = 'l' - else: - ctype = random.choice('abcdefghijkl') - return 3, None + try: - params_value = {'c': ctype} - hitokoto = requests.get('https://v1.hitokoto.cn', params=params_value) + if ctypet == '动画' or ctypet == 'a': + ctype = 'a' + elif ctypet == '漫画' or ctypet == 'b': + ctype = 'b' + elif ctypet == '游戏' or ctypet == 'c': + ctype = 'c' + elif ctypet == '文学' or ctypet == 'd': + ctype = 'd' + elif ctypet == '原创' or ctypet == 'e': + ctype = 'e' + elif ctypet == '网络' or ctypet == 'f': + ctype = 'f' + elif ctypet == '其他' or ctypet == 'g': + ctype = 'g' + elif ctypet == '影视' or ctypet == 'h': + ctype = 'h' + elif ctypet == '诗词' or ctypet == 'i': + ctype = 'i' + elif ctypet == '网易云' or ctypet == 'j': + ctype = 'j' + elif ctypet == '哲学' or ctypet == 'k': + ctype = 'k' + elif ctypet == '抖机灵' or ctypet == 'l': + ctype = 'l' - return 0, hitokoto.json() + elif ctypet == '没有': + ctype = random.choice('abcdefghijkl') + params_value = {'c': ctype} + hitokoto = requests.get('https://v1.hitokoto.cn', params=params_value) + + return 0, hitokoto.json() + else: + return 3, None + + params_value = {'c': ctype} + hitokoto = requests.get('https://v1.hitokoto.cn', params=params_value) + + return 0, hitokoto.json() + + except IOError: + return 2, None - # except Exception as e: - # return 2, None diff --git a/module/hitokoto/__pycache__/__init__.cpython-311.pyc b/module/hitokoto/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2ae9f3e3ea77a5aa6ffe2fd3ce7ab2e76d740840 GIT binary patch literal 470 zcmZ3^%ge<81fMterxpY0#~=<2FhLogMSzUy3@HpLj5!QZ3@J=43{i|JjKK_=%r8Mo z{F0#x!4xx)1mVwNKw>&W2_sk(Ok}~?DU8d2?A367Ekg+_LR}3*7RUrJKvl;GbOq2} zCci4NjFOUqVk>?9GDE$L%#!@<{E~dVB(RziETVT^7y`jUL^L zED~2(Brd?vXP{c3ABtFj6xf873`L+=DB=VXzc_3lw%Qf(0J$JX7OMk^56p~=j5iqg S8^G`b3lpQ{2L?<6Y!Co)17*Sh literal 0 HcmV?d00001 diff --git a/module/hitokoto/__pycache__/__init__.cpython-39.pyc b/module/hitokoto/__pycache__/__init__.cpython-39.pyc new file mode 100644 index 0000000000000000000000000000000000000000..68862f7ae56d61b9c00a7062d715a63e559111ae GIT binary patch literal 1025 zcma)*%TE(g6vpqlGmHfbRz&2bu4@F;r7?#1h`PZAiI1kS4!wmAEi-jyN&=w^4Jttq z2nLB_1Q$MHd`Due#*K01UvQ%?R9e^>6BCzyGb0I0@8sNXzTdg$-07XEUR_PY@LK$H(E~tw|)fKE@ok{ZK-#|weLL5XmXOWqt zp##I{lHpDrlxMizB6xu&$<*K#@SRWhT&@kwj2!qbTRfFDy)_~578qf=H8$h2yBcO{S0-A-}2>KCP z3;Idaf}Vie1o|0T2l`Fafp)-c2K@!C2mK@JL3hAy$?!>X!nkYj?(AC8fK0??^CTJ< zs6Z!~XzIeR943Pb+~s|WXddRGWtteg` zR`3?Kcjh%5_R`pc^7W!5-FKz8k9^l1xYw^sqZ5*nft$I!^!T165!79~vov~3Qp$Jb zcT?r!oTQ#0cX9DYaYj;a;NCr7zJEzl+IP!OZ!A9@mt^ECu{-KYv(rD`OiAhs7EizM zH_7X%wFZ5hdw4B4r3`IO^2Qt3^(QtfjrQ?5I9 z{IG3Xc2vbWcQA)Ug|D%2&^0ljXY(jt-SQ!`o3O#}BbW~Djh9~*%f&lOSKi}zVVH)SNVMe!?MC#fKsX(k7^yr$ zA&QXpUr|RIuR?^VhT|f?TU4<(p_RSSo4oe^L$8^d!DMJ(@KpP~lXLukCWVy0citpJ literal 0 HcmV?d00001 From 1f8c154a127c3703e5e23457566e1e6c08cd2db5 Mon Sep 17 00:00:00 2001 From: BadHappy <1196554262@qq.com> Date: Sat, 30 Dec 2023 17:28:06 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9.gitignore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index bd09c59..e634f1d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /venv config.toml .vs -.vscode \ No newline at end of file +.vscode +.idea \ No newline at end of file