From a562ae4cef74996cd60efce2cd600584cce9b950 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Mon, 2 Oct 2023 18:54:24 +0800 Subject: [PATCH 01/46] demo add requirement re formated --- .gitignore | 2 + connect.py | 272 ++++++++++++++++++++++++++++++++++++++++++++++++ requirement.txt | 5 + 3 files changed, 279 insertions(+) create mode 100644 .gitignore create mode 100644 connect.py create mode 100644 requirement.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..239a485 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/venv +config.toml \ No newline at end of file diff --git a/connect.py b/connect.py new file mode 100644 index 0000000..a42f135 --- /dev/null +++ b/connect.py @@ -0,0 +1,272 @@ +import random +import asyncio +import traceback + +from typing import Dict, List, Tuple, Any, Optional, Union, Literal + +import rtoml +import socketio +from colorama import Fore, Style +from nacl.signing import SigningKey +from lib_not_dr.types import Options + + +def get_config() -> Tuple[str, str, int]: + with open('config.toml', 'r', encoding='utf-8') as f: + config = rtoml.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() + + +@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}") + # 准备数据 + sign = SigningKey(bytes.fromhex(KEY)) + signature = sign.sign(bytes.fromhex(salt)) + await sio.emit('auth', signature.signature) + print(f"{Fore.BLUE}send auth emit{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}") + + +async 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') + try: + import os + import math + import random + import decimal + global_val = {'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() + 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}' + 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 data.get('message').get('content').startswith('=='): + + evals: str = data.get('message').get('content')[2:] + result = await safe_eval(evals) + reply = ReplyMessage(id=data['message']['_id'], + username=sender_name, + content=content) + message = Message(content=result, + reply_to=reply, + room_id=room_id) + + await asyncio.sleep(0.5) + await sio.emit('sendMessage', message.to_json()) + elif data['message']['content'] == 'jrrp': + randomer = random.Random(f'{sender_id}-{data["message"]["date"]}-jrrp') + result = randomer.randint(0, 50) + randomer.randint(0, 50) + print(f'{sender_name} 今日人品值为 {result}') + reply = ReplyMessage(id=data['message']['_id'], + username=sender_name, + content='jrrp') + 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'], + # username=sender_name, + # content=content) + # 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.emit('requireAuth', ('', {'version': '', 'protocolVersion': ''})) + await asyncio.sleep(2) + + await sio.wait() + + +if __name__ == '__main__': + asyncio.run(main()) diff --git a/requirement.txt b/requirement.txt new file mode 100644 index 0000000..4c7f521 --- /dev/null +++ b/requirement.txt @@ -0,0 +1,5 @@ +lib-not-dr +colorama +rtoml +pynacl +python-socketio[asyncio_client] From 0a8350e934b6db74c05516691b411fbee3579e13 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Tue, 3 Oct 2023 12:37:11 +0800 Subject: [PATCH 02/46] add license --- LICENSE | 373 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 373 insertions(+) create mode 100644 LICENSE 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. From e55c85a5ade07eb8b82150ba7550e6cd85fac946 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Tue, 3 Oct 2023 12:54:28 +0800 Subject: [PATCH 03/46] Add | readme and temp --- config-temp.toml | 4 ++++ readme.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 config-temp.toml create mode 100644 readme.md diff --git a/config-temp.toml b/config-temp.toml new file mode 100644 index 0000000..5ff2239 --- /dev/null +++ b/config-temp.toml @@ -0,0 +1,4 @@ + +private_key = "" # 与 icalingua 客户端使用的 private_key 一致 +host = "" # docker 版 icalingua 服务的地址 +self_id = 0 # 机器人的 qq 号 diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..439213e --- /dev/null +++ b/readme.md @@ -0,0 +1,42 @@ +# icalingua bot + +这是一个基于 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 From b6d58cf9fce591ca8fea9637936ddb2d69eb11e9 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Tue, 3 Oct 2023 21:30:36 +0800 Subject: [PATCH 04/46] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AE=A1=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 6 +++++- connect.py | 9 ++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 239a485..d85c83b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,6 @@ /venv -config.toml \ No newline at end of file +config.toml + +# Added by cargo + +/target diff --git a/connect.py b/connect.py index a42f135..35582b2 100644 --- a/connect.py +++ b/connect.py @@ -1,3 +1,4 @@ +import time import random import asyncio import traceback @@ -127,12 +128,13 @@ async def safe_eval(code: str) -> str: 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 random import decimal - global_val = {'math': math, + global_val = {'time': time, + 'math': math, 'decimal': decimal, 'random': random, '__import__': '', @@ -151,6 +153,7 @@ async def safe_eval(code: str) -> str: result = result[:limit] except: result = traceback.format_exc() + end_time = time.time() result = result.replace(KEY, '***') result = result.replace(HOST, '***') @@ -159,7 +162,7 @@ async def safe_eval(code: str) -> str: if result == '6' or result == 6: result = '他确实等于 6' - result = f'{code}\neval result:\n{result}' + result = f'{code}\neval result:\n{result}\n耗时: {end_time - start_time} s' return result except: error = traceback.format_exc() From 8584c6c6fdad872227b18c006ff82716d2ae5394 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Wed, 4 Oct 2023 12:36:52 +0800 Subject: [PATCH 05/46] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 4 ---- connect.py | 12 +++--------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index d85c83b..b4a3b79 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,2 @@ /venv config.toml - -# Added by cargo - -/target diff --git a/connect.py b/connect.py index 35582b2..9f46361 100644 --- a/connect.py +++ b/connect.py @@ -189,9 +189,7 @@ async def add_message(data: Dict[str, Any]): evals: str = data.get('message').get('content')[2:] result = await safe_eval(evals) - reply = ReplyMessage(id=data['message']['_id'], - username=sender_name, - content=content) + reply = ReplyMessage(id=data['message']['_id']) message = Message(content=result, reply_to=reply, room_id=room_id) @@ -202,9 +200,7 @@ async def add_message(data: Dict[str, Any]): randomer = random.Random(f'{sender_id}-{data["message"]["date"]}-jrrp') result = randomer.randint(0, 50) + randomer.randint(0, 50) print(f'{sender_name} 今日人品值为 {result}') - reply = ReplyMessage(id=data['message']['_id'], - username=sender_name, - content='jrrp') + reply = ReplyMessage(id=data['message']['_id']) message = Message(content=f'{sender_name} 今日人品值为 {result}', reply_to=reply, room_id=room_id) @@ -212,9 +208,7 @@ async def add_message(data: Dict[str, Any]): 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'], - # username=sender_name, - # content=content) + # reply = ReplyMessage(id=data['message']['_id']) # message = Message(content='你 6 nm 呢', # reply_to=reply, # room_id=room_id) From 43a79b3f1c04178c7034a6abbd2ef4b2f7b2283d Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Wed, 4 Oct 2023 16:24:45 +0800 Subject: [PATCH 06/46] =?UTF-8?q?F=20|=20=E9=98=B2=E6=AD=A2=E8=B6=85?= =?UTF-8?q?=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bot/types.py | 17 +++++++++++++++++ connect.py | 5 ++++- main.py | 1 + 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 bot/types.py create mode 100644 main.py diff --git a/bot/types.py b/bot/types.py new file mode 100644 index 0000000..33cd801 --- /dev/null +++ b/bot/types.py @@ -0,0 +1,17 @@ + +from lib_not_dr.types import Options + + +class SocketData(Options): + name = 'SocketData' + + def to_json(self) -> dict: + return self.option() + + +class AddMessage(SocketData): + name = 'icalingua socket add message event' + + roomId: int + + diff --git a/connect.py b/connect.py index 9f46361..c631182 100644 --- a/connect.py +++ b/connect.py @@ -188,7 +188,10 @@ async def add_message(data: Dict[str, Any]): elif data.get('message').get('content').startswith('=='): evals: str = data.get('message').get('content')[2:] - result = await safe_eval(evals) + try: + result = await asyncio.wait_for(safe_eval(evals), 5) + except asyncio.TimeoutError: + result = f'{evals}\n超时' reply = ReplyMessage(id=data['message']['_id']) message = Message(content=result, reply_to=reply, diff --git a/main.py b/main.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/main.py @@ -0,0 +1 @@ + From bc42df247274acd0f52f37cf6dbc5b58f71dedfa Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Wed, 4 Oct 2023 16:35:35 +0800 Subject: [PATCH 07/46] =?UTF-8?q?F=20|=20=E5=B0=9D=E8=AF=95=E5=9C=A8?= =?UTF-8?q?=E6=96=B0=E7=BA=BF=E7=A8=8B=E9=87=8C=E8=B7=91=EF=BC=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- connect.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connect.py b/connect.py index c631182..304d070 100644 --- a/connect.py +++ b/connect.py @@ -189,7 +189,7 @@ async def add_message(data: Dict[str, Any]): evals: str = data.get('message').get('content')[2:] try: - result = await asyncio.wait_for(safe_eval(evals), 5) + result = await asyncio.gather(asyncio.to_thread(safe_eval, evals)) except asyncio.TimeoutError: result = f'{evals}\n超时' reply = ReplyMessage(id=data['message']['_id']) From 78b24f06890e4adef1467d6bca9b149c5ef88914 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Wed, 4 Oct 2023 16:44:08 +0800 Subject: [PATCH 08/46] =?UTF-8?q?=E5=95=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ? --- connect.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connect.py b/connect.py index 304d070..5292b9d 100644 --- a/connect.py +++ b/connect.py @@ -189,7 +189,7 @@ async def add_message(data: Dict[str, Any]): evals: str = data.get('message').get('content')[2:] try: - result = await asyncio.gather(asyncio.to_thread(safe_eval, evals)) + result = await asyncio.to_thread(safe_eval, evals) except asyncio.TimeoutError: result = f'{evals}\n超时' reply = ReplyMessage(id=data['message']['_id']) From d5f289887ffd45f322bf718c3f88cda6a32329c2 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Thu, 5 Oct 2023 13:08:41 +0800 Subject: [PATCH 09/46] just fxxx it up --- connect.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/connect.py b/connect.py index 5292b9d..9f46361 100644 --- a/connect.py +++ b/connect.py @@ -188,10 +188,7 @@ async def add_message(data: Dict[str, Any]): elif data.get('message').get('content').startswith('=='): evals: str = data.get('message').get('content')[2:] - try: - result = await asyncio.to_thread(safe_eval, evals) - except asyncio.TimeoutError: - result = f'{evals}\n超时' + result = await safe_eval(evals) reply = ReplyMessage(id=data['message']['_id']) message = Message(content=result, reply_to=reply, From a2f5b30e75e5eaa917b02de6672178b83f35175d Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Sat, 7 Oct 2023 00:22:28 +0800 Subject: [PATCH 10/46] add types --- bot/types.py | 51 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/bot/types.py b/bot/types.py index 33cd801..2a7433c 100644 --- a/bot/types.py +++ b/bot/types.py @@ -1,17 +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' - roomId: int + room_id: int + From 88c46f754f34a239136e89e05913f73be3565541 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Sun, 15 Oct 2023 01:14:00 +0800 Subject: [PATCH 11/46] FXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXK --- connect.py | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/connect.py b/connect.py index 9f46361..b41482e 100644 --- a/connect.py +++ b/connect.py @@ -2,6 +2,7 @@ import time import random import asyncio import traceback +import multiprocessing from typing import Dict, List, Tuple, Any, Optional, Union, Literal @@ -110,7 +111,7 @@ def update_room(data: Dict[str, Any]): print(f"{Fore.CYAN}update_room: {data}{Style.RESET_ALL}") -async def safe_eval(code: str) -> str: +def safe_eval(code: str) -> str: try: # code = code.replace('help', '坏东西!\n') # code = code.replace('bytes', '坏东西!\n') @@ -188,7 +189,20 @@ async def add_message(data: Dict[str, Any]): elif data.get('message').get('content').startswith('=='): evals: str = data.get('message').get('content')[2:] - result = await safe_eval(evals) + + 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() + reply = ReplyMessage(id=data['message']['_id']) message = Message(content=result, reply_to=reply, @@ -257,12 +271,15 @@ def catch_all(event, data): async def main(): - await sio.connect(HOST) + async with asyncio.TaskGroup() as task_group: + await sio.connect(HOST) + # task1 = task_group.create_task(sio.wait()) + await sio.wait() - await sio.emit('requireAuth', ('', {'version': '', 'protocolVersion': ''})) - await asyncio.sleep(2) + # await sio.emit('requireAuth', ('', {'version': '', 'protocolVersion': ''})) + # await asyncio.sleep(2) - await sio.wait() + # await asyncio.gather(sio.wait(), sio.wait(), sio.wait()) if __name__ == '__main__': From c1966e6f55af3f20cbe5aae02eefe850d68c4ea3 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Sun, 15 Oct 2023 01:15:14 +0800 Subject: [PATCH 12/46] woops --- connect.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/connect.py b/connect.py index b41482e..bd9a407 100644 --- a/connect.py +++ b/connect.py @@ -271,10 +271,8 @@ def catch_all(event, data): async def main(): - async with asyncio.TaskGroup() as task_group: - await sio.connect(HOST) - # task1 = task_group.create_task(sio.wait()) - await sio.wait() + await sio.connect(HOST) + await sio.wait() # await sio.emit('requireAuth', ('', {'version': '', 'protocolVersion': ''})) # await asyncio.sleep(2) From df616d8b5365016e30df4d53db99ad42957371ea Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Sun, 15 Oct 2023 01:23:07 +0800 Subject: [PATCH 13/46] =?UTF-8?q?=E8=AE=B0=E4=BD=8F=E4=BA=86=EF=BC=8C?= =?UTF-8?q?=E8=B0=A2=E8=B0=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- connect.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connect.py b/connect.py index bd9a407..cd28bbe 100644 --- a/connect.py +++ b/connect.py @@ -175,7 +175,7 @@ def safe_eval(code: str) -> str: 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 + is_self = data['message']['senderId'] == SELF_ID or data['message']['senderId'] == 2524423915 sender_name = data['message']['username'] sender_id = data['message']['senderId'] content = data['message']['content'] From 6200a18b822aeb11f2630ff9cb6a480066620faa Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Sun, 15 Oct 2023 01:25:50 +0800 Subject: [PATCH 14/46] rua --- connect.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connect.py b/connect.py index cd28bbe..5675e30 100644 --- a/connect.py +++ b/connect.py @@ -208,7 +208,7 @@ async def add_message(data: Dict[str, Any]): reply_to=reply, room_id=room_id) - await asyncio.sleep(0.5) + 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') From 8dfbf1d7ab5b60370a2a0fb6aa3c4f6fc5aa5154 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Sun, 15 Oct 2023 12:33:01 +0800 Subject: [PATCH 15/46] byby safe eval --- connect.py | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/connect.py b/connect.py index 5675e30..658b65c 100644 --- a/connect.py +++ b/connect.py @@ -175,7 +175,7 @@ def safe_eval(code: str) -> str: 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 or data['message']['senderId'] == 2524423915 + is_self = data['message']['senderId'] == SELF_ID sender_name = data['message']['username'] sender_id = data['message']['senderId'] content = data['message']['content'] @@ -190,18 +190,28 @@ async def add_message(data: Dict[str, Any]): 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 = '超时' + # 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 = quene.get() + result = str(eval(express)) reply = ReplyMessage(id=data['message']['_id']) message = Message(content=result, From 29c43e64e60dace41b961bff2b07e415ed39a4f8 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Mon, 11 Dec 2023 00:00:01 +0800 Subject: [PATCH 16/46] Add .gitignore and Cargo.toml files, and update connect.py and main.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refactor authentication key handling in main.rs Add event handler for any event Fix authentication signature generation | 我tm直接就是一个感动中国 aaaaaa | key! --- connect.py | 5 +- ica-rs/.gitignore | 1 + ica-rs/Cargo.lock | 1634 ++++++++++++++++++++++++++++++++++++++++++++ ica-rs/Cargo.toml | 13 + ica-rs/src/main.rs | 85 +++ 5 files changed, 1737 insertions(+), 1 deletion(-) 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/main.rs diff --git a/connect.py b/connect.py index 658b65c..85925c1 100644 --- a/connect.py +++ b/connect.py @@ -77,10 +77,13 @@ def connect(): @sio.on('requireAuth') async def require_auth(salt: str, versions: Dict[str, str]): - print(f"{Fore.BLUE}versions: {versions}{Style.RESET_ALL}") + 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}") 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..13b62f0 --- /dev/null +++ b/ica-rs/Cargo.lock @@ -0,0 +1,1634 @@ +# 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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9f737d090ee4b543ba85d22a7c7035f8e456a5253a85296615e296b91a95265" +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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48b3c9531f72da89c2eb9f54dcf79169d54e26b8c03438e395d0dd8e40167767" +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..3f0d50e --- /dev/null +++ b/ica-rs/Cargo.toml @@ -0,0 +1,13 @@ +[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" diff --git a/ica-rs/src/main.rs b/ica-rs/src/main.rs new file mode 100644 index 0000000..c8d4de7 --- /dev/null +++ b/ica-rs/src/main.rs @@ -0,0 +1,85 @@ +use ed25519_dalek::{Signature, Signer, SigningKey}; +use rust_socketio::{ClientBuilder, Payload, RawClient, Event}; +use std::time::Duration; + +static KEY: &str = ""; +static HOST: &str = ""; + +#[allow(unused)] +fn require_auth_callback(payload: Payload, client: RawClient) { + let auth_key = match payload { + Payload::String(str) => Some(str), + Payload::Binary(_) => None, + } + .unwrap(); + // 去除前后的 " + let auth_key = &auth_key[1..auth_key.len() - 1]; + + println!("auth_key: {}", auth_key); + + let array_key: [u8; 32] = hex::decode(KEY).unwrap().try_into().unwrap(); + + let signing_key: SigningKey = SigningKey::from_bytes(&array_key); + + let salt = hex::decode(auth_key).unwrap(); + 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) { + // println!("event: {} | {:#?}", event, payload); + match payload { + Payload::Binary(bin) => println!("event: {} |bin: {:?}", event, bin), + Payload::String(str) => println!("event: {} |str: {:?}", event, str), + } +} + +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| { + println!("Connect callback: {:#?}", payload); + }; + + // 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 sign_main() { + // 生成 SingningKey + let array_key: [u8; 32] = hex::decode(KEY).unwrap().try_into().unwrap(); + let signing_key: SigningKey = SigningKey::from_bytes(&array_key); + + // 要签名的东西 + let data = "187d0b21becfa7a49e97afc00646e169"; + let data = hex::decode(data).unwrap(); + + // 签名 + let signature: Signature = signing_key.sign(data.as_slice()); + + // 生成签名 + let sign = hex::encode(signature.to_bytes()); + + println!("sign: {} {:?} {}", sign, signature.to_bytes(), signature.to_bytes().len()); + // println!("hex: {}", hex::encode()); +} + +fn main() { + sign_main(); + ws_main(); +} From ec399233cce8e00f20c359ae181fd1b9f9d0d209 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Mon, 11 Dec 2023 01:17:25 +0800 Subject: [PATCH 17/46] Add IcalinguaSinger struct and client module --- ica-rs/src/client.rs | 26 ++++++++++++++++++++++++++ ica-rs/src/main.rs | 2 ++ 2 files changed, 28 insertions(+) create mode 100644 ica-rs/src/client.rs diff --git a/ica-rs/src/client.rs b/ica-rs/src/client.rs new file mode 100644 index 0000000..2a85d13 --- /dev/null +++ b/ica-rs/src/client.rs @@ -0,0 +1,26 @@ +use ed25519_dalek::{Signature, Signer, SigningKey}; +use rust_socketio::{ClientBuilder, Event, Payload, RawClient}; + +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 index c8d4de7..e80964f 100644 --- a/ica-rs/src/main.rs +++ b/ica-rs/src/main.rs @@ -1,3 +1,5 @@ +mod client; + use ed25519_dalek::{Signature, Signer, SigningKey}; use rust_socketio::{ClientBuilder, Payload, RawClient, Event}; use std::time::Duration; From d1b27d3825e2b326dcfb7e1cfb182d378a49c19f Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Mon, 11 Dec 2023 18:17:41 +0800 Subject: [PATCH 18/46] Update connect.py: Fix requireAuth function and modify jrrp logic --- connect.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/connect.py b/connect.py index 85925c1..0733340 100644 --- a/connect.py +++ b/connect.py @@ -2,7 +2,6 @@ import time import random import asyncio import traceback -import multiprocessing from typing import Dict, List, Tuple, Any, Optional, Union, Literal @@ -67,7 +66,7 @@ class Message(Options): } -sio = socketio.AsyncClient() +sio: socketio.AsyncClient = socketio.AsyncClient() @sio.on('connect') @@ -87,6 +86,10 @@ async def require_auth(salt: str, versions: Dict[str, str]): 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]): @@ -223,8 +226,8 @@ async def add_message(data: Dict[str, Any]): 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') + 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']) From 27db3d5ef01044d99d5a296980749a0a4c9ad174 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Mon, 11 Dec 2023 18:17:55 +0800 Subject: [PATCH 19/46] Refactor client.rs and main.rs --- ica-rs/src/client.rs | 1 - ica-rs/src/main.rs | 40 +++++++++++----------------------------- 2 files changed, 11 insertions(+), 30 deletions(-) diff --git a/ica-rs/src/client.rs b/ica-rs/src/client.rs index 2a85d13..c3d1e0e 100644 --- a/ica-rs/src/client.rs +++ b/ica-rs/src/client.rs @@ -1,5 +1,4 @@ use ed25519_dalek::{Signature, Signer, SigningKey}; -use rust_socketio::{ClientBuilder, Event, Payload, RawClient}; pub struct IcalinguaSinger { pub host: String, diff --git a/ica-rs/src/main.rs b/ica-rs/src/main.rs index e80964f..11f29ab 100644 --- a/ica-rs/src/main.rs +++ b/ica-rs/src/main.rs @@ -1,29 +1,29 @@ mod client; use ed25519_dalek::{Signature, Signer, SigningKey}; -use rust_socketio::{ClientBuilder, Payload, RawClient, Event}; +use rust_socketio::{ClientBuilder, Event, Payload, RawClient}; use std::time::Duration; -static KEY: &str = ""; -static HOST: &str = ""; - #[allow(unused)] fn require_auth_callback(payload: Payload, client: RawClient) { + let key = std::env::args().nth(2).expect("No key given"); let auth_key = match payload { Payload::String(str) => Some(str), Payload::Binary(_) => None, } - .unwrap(); - // 去除前后的 " + .expect("Payload should be String"); let auth_key = &auth_key[1..auth_key.len() - 1]; println!("auth_key: {}", auth_key); - let array_key: [u8; 32] = hex::decode(KEY).unwrap().try_into().unwrap(); + 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).unwrap(); + 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(); @@ -46,10 +46,12 @@ fn ws_main() { let connect_call_back = |payload: Payload, _client: RawClient| { 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) + let socket = ClientBuilder::new(host) // .namespace("/admin") .on_any(any_event) .on("connect", connect_call_back) @@ -62,26 +64,6 @@ fn ws_main() { socket.disconnect().expect("Disconnect failed") } -fn sign_main() { - // 生成 SingningKey - let array_key: [u8; 32] = hex::decode(KEY).unwrap().try_into().unwrap(); - let signing_key: SigningKey = SigningKey::from_bytes(&array_key); - - // 要签名的东西 - let data = "187d0b21becfa7a49e97afc00646e169"; - let data = hex::decode(data).unwrap(); - - // 签名 - let signature: Signature = signing_key.sign(data.as_slice()); - - // 生成签名 - let sign = hex::encode(signature.to_bytes()); - - println!("sign: {} {:?} {}", sign, signature.to_bytes(), signature.to_bytes().len()); - // println!("hex: {}", hex::encode()); -} - fn main() { - sign_main(); ws_main(); } From daf53ba226c844fb5eaf64fdf7d951720050590c Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Mon, 11 Dec 2023 21:27:08 +0800 Subject: [PATCH 20/46] Update rust_socketio dependency and add patch for local development --- ica-rs/Cargo.lock | 4 ---- ica-rs/Cargo.toml | 3 +++ ica-rs/src/main.rs | 30 ++++++++++++++++++++---------- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/ica-rs/Cargo.lock b/ica-rs/Cargo.lock index 13b62f0..bdb9111 100644 --- a/ica-rs/Cargo.lock +++ b/ica-rs/Cargo.lock @@ -886,8 +886,6 @@ dependencies = [ [[package]] name = "rust_engineio" version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9f737d090ee4b543ba85d22a7c7035f8e456a5253a85296615e296b91a95265" dependencies = [ "adler32", "async-stream", @@ -910,8 +908,6 @@ dependencies = [ [[package]] name = "rust_socketio" version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48b3c9531f72da89c2eb9f54dcf79169d54e26b8c03438e395d0dd8e40167767" dependencies = [ "adler32", "backoff", diff --git a/ica-rs/Cargo.toml b/ica-rs/Cargo.toml index 3f0d50e..3cf45bc 100644 --- a/ica-rs/Cargo.toml +++ b/ica-rs/Cargo.toml @@ -11,3 +11,6 @@ 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/main.rs b/ica-rs/src/main.rs index 11f29ab..820a035 100644 --- a/ica-rs/src/main.rs +++ b/ica-rs/src/main.rs @@ -2,19 +2,28 @@ 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) { +fn require_auth_callback(payload: Payload, client: RawClient, _id: Option) { let key = std::env::args().nth(2).expect("No key given"); - let auth_key = match payload { - Payload::String(str) => Some(str), + let require_data = match payload { + Payload::String(_) => None, Payload::Binary(_) => None, + Payload::Text(json_value) => Some(json_value), } - .expect("Payload should be String"); - let auth_key = &auth_key[1..auth_key.len() - 1]; + .expect("Payload should be Json data"); - println!("auth_key: {}", auth_key); + 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") @@ -31,11 +40,12 @@ fn require_auth_callback(payload: Payload, client: RawClient) { } #[allow(unused)] -fn any_event(event: Event, payload: Payload, _client: RawClient) { +fn any_event(event: Event, payload: Payload, _client: RawClient, id: Option) { // println!("event: {} | {:#?}", event, payload); match payload { - Payload::Binary(bin) => println!("event: {} |bin: {:?}", event, bin), - Payload::String(str) => println!("event: {} |str: {:?}", event, str), + 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), } } @@ -43,7 +53,7 @@ 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| { + let connect_call_back = |payload: Payload, _client: RawClient, _id| { println!("Connect callback: {:#?}", payload); }; // 从命令行获取 host 和 key From 018a5cd9eac4956d921af3ff3fd1ce2b5068c90a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SharwOrange=E6=A9=99=E5=A4=9C?= Date: Tue, 26 Dec 2023 05:36:36 +0000 Subject: [PATCH 21/46] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20readme.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: SharwOrange橙夜 --- readme.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/readme.md b/readme.md index 439213e..e08d9dc 100644 --- a/readme.md +++ b/readme.md @@ -1,5 +1,10 @@ # icalingua bot +## 源项目 +[icalingua-python-bot](http://shenjack.top:5100/shenjack/icalingua-python-bot) + +## 简介 + 这是一个基于 icalingua docker 版的 bot > 出于某个企鹅, 和保护 作者 和 原项目 ( ica ) 的原因 \ From a38a925e72aeb12b8978870b58e593f82d96094d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SharwOrange=E6=A9=99=E5=A4=9C?= Date: Tue, 26 Dec 2023 05:37:30 +0000 Subject: [PATCH 22/46] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20readme.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: SharwOrange橙夜 --- readme.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index e08d9dc..40f9f69 100644 --- a/readme.md +++ b/readme.md @@ -1,7 +1,8 @@ # icalingua bot ## 源项目 -[icalingua-python-bot](http://shenjack.top:5100/shenjack/icalingua-python-bot) +本项目fork自[icalingua-python-bot](http://shenjack.top:5100/shenjack/icalingua-python-bot) +fork时版本[daf53ba226c844fb5eaf64fdf7d951720050590c](daf53ba226c844fb5eaf64fdf7d951720050590c) ## 简介 From dcdf91f4459c7c4b56f26cf4738313dce908be93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SharwOrange=E6=A9=99=E5=A4=9C?= Date: Tue, 26 Dec 2023 05:37:50 +0000 Subject: [PATCH 23/46] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20readme.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 40f9f69..ffcb3cf 100644 --- a/readme.md +++ b/readme.md @@ -1,7 +1,7 @@ # icalingua bot ## 源项目 -本项目fork自[icalingua-python-bot](http://shenjack.top:5100/shenjack/icalingua-python-bot) +本项目fork自[icalingua-python-bot](http://shenjack.top:5100/shenjack/icalingua-python-bot) \ fork时版本[daf53ba226c844fb5eaf64fdf7d951720050590c](daf53ba226c844fb5eaf64fdf7d951720050590c) ## 简介 From 07d297173d58a7b0384fd351c1b61ffcd0109820 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SharwOrange=E6=A9=99=E5=A4=9C?= Date: Tue, 26 Dec 2023 05:38:32 +0000 Subject: [PATCH 24/46] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20readme.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: SharwOrange橙夜 --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index ffcb3cf..bb80d45 100644 --- a/readme.md +++ b/readme.md @@ -2,7 +2,7 @@ ## 源项目 本项目fork自[icalingua-python-bot](http://shenjack.top:5100/shenjack/icalingua-python-bot) \ -fork时版本[daf53ba226c844fb5eaf64fdf7d951720050590c](daf53ba226c844fb5eaf64fdf7d951720050590c) +fork时版本[daf53ba226c844fb5eaf64fdf7d951720050590c](http://shenjack.top:5100/shenjack/icalingua-python-bot/commit/daf53ba226c844fb5eaf64fdf7d951720050590c) ## 简介 From 4d38da674eeb83ab5acea23910ded9f8a9e9d380 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SharwOrange=E6=A9=99=E5=A4=9C?= Date: Tue, 26 Dec 2023 10:42:25 +0000 Subject: [PATCH 25/46] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=87=B3=20/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: SharwOrange橙夜 --- connect.py | 8 +++++++- requirement.txt | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/connect.py b/connect.py index 0733340..5afb8de 100644 --- a/connect.py +++ b/connect.py @@ -10,7 +10,7 @@ import socketio from colorama import Fore, Style from nacl.signing import SigningKey from lib_not_dr.types import Options - +from mcstatus import JavaServer def get_config() -> Tuple[str, str, int]: with open('config.toml', 'r', encoding='utf-8') as f: @@ -192,6 +192,12 @@ async def add_message(data: Dict[str, Any]): message = Message(content='icalingua bot test', room_id=data['roomId']) await sio.emit('sendMessage', message.to_json()) + if content == '!!status': + server = JavaServer.lookup("server1.xfcloud.org") + status=server.status() + message = Message(content=f"此服务器有 {status.players.online} 个玩家在线", + 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:] diff --git a/requirement.txt b/requirement.txt index 4c7f521..4baec2e 100644 --- a/requirement.txt +++ b/requirement.txt @@ -3,3 +3,4 @@ colorama rtoml pynacl python-socketio[asyncio_client] +mcstatus \ No newline at end of file From 47e4912c9751231f40c2984a6e0c10ec44c43399 Mon Sep 17 00:00:00 2001 From: SharwOrange Date: Wed, 27 Dec 2023 22:06:57 +0800 Subject: [PATCH 26/46] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E9=83=A8=E5=88=86=E4=BB=A3=E7=A0=81=EF=BC=8C=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E4=BA=86=E6=9C=8D=E5=8A=A1=E5=99=A8=E4=BA=BA=E6=95=B0=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- connect.py | 24 ++++++++++++++++++++---- readme.md | 48 ------------------------------------------------ 2 files changed, 20 insertions(+), 52 deletions(-) delete mode 100644 readme.md diff --git a/connect.py b/connect.py index 5afb8de..b9a660a 100644 --- a/connect.py +++ b/connect.py @@ -192,12 +192,28 @@ async def add_message(data: Dict[str, Any]): message = Message(content='icalingua bot test', room_id=data['roomId']) await sio.emit('sendMessage', message.to_json()) - if content == '!!status': - server = JavaServer.lookup("server1.xfcloud.org") + elif content == '!!status': + server = JavaServer.lookup("192.168.1.6:25565") status=server.status() - message = Message(content=f"此服务器有 {status.players.online} 个玩家在线", - room_id=data['roomId']) + # 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 data.get('message').get('content').startswith('=='): evals: str = data.get('message').get('content')[2:] diff --git a/readme.md b/readme.md deleted file mode 100644 index bb80d45..0000000 --- a/readme.md +++ /dev/null @@ -1,48 +0,0 @@ -# icalingua bot - -## 源项目 -本项目fork自[icalingua-python-bot](http://shenjack.top:5100/shenjack/icalingua-python-bot) \ -fork时版本[daf53ba226c844fb5eaf64fdf7d951720050590c](http://shenjack.top:5100/shenjack/icalingua-python-bot/commit/daf53ba226c844fb5eaf64fdf7d951720050590c) - -## 简介 - -这是一个基于 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 From 4526284902d1cce45181818eedc2cd7ba94b3697 Mon Sep 17 00:00:00 2001 From: SharwOrange Date: Wed, 27 Dec 2023 22:08:06 +0800 Subject: [PATCH 27/46] =?UTF-8?q?=E9=87=8D=E6=96=B0=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=BA=86README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- readme.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 readme.md diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..439213e --- /dev/null +++ b/readme.md @@ -0,0 +1,42 @@ +# icalingua bot + +这是一个基于 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 From 1a5001312bb090380b387e5f2013f26f1501f0f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SharwOrange=E6=A9=99=E5=A4=9C?= Date: Wed, 27 Dec 2023 14:09:58 +0000 Subject: [PATCH 28/46] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20readme.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: SharwOrange橙夜 --- readme.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/readme.md b/readme.md index 439213e..bb80d45 100644 --- a/readme.md +++ b/readme.md @@ -1,5 +1,11 @@ # icalingua bot +## 源项目 +本项目fork自[icalingua-python-bot](http://shenjack.top:5100/shenjack/icalingua-python-bot) \ +fork时版本[daf53ba226c844fb5eaf64fdf7d951720050590c](http://shenjack.top:5100/shenjack/icalingua-python-bot/commit/daf53ba226c844fb5eaf64fdf7d951720050590c) + +## 简介 + 这是一个基于 icalingua docker 版的 bot > 出于某个企鹅, 和保护 作者 和 原项目 ( ica ) 的原因 \ From cebf394e2341bea2cc4b4d88081785188d851679 Mon Sep 17 00:00:00 2001 From: SharwOrange Date: Thu, 28 Dec 2023 22:05:10 +0800 Subject: [PATCH 29/46] =?UTF-8?q?=E5=B0=86rtoml=E6=94=B9=E4=B8=BAqtoml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vs/ProjectSettings.json | 3 +++ .vs/VSWorkspaceState.json | 7 +++++++ .vs/python-bot/v17/.wsuo | Bin 0 -> 14336 bytes .vs/slnx.sqlite | Bin 0 -> 90112 bytes connect.py | 4 ++-- requirement.txt | 2 +- 6 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 .vs/ProjectSettings.json create mode 100644 .vs/VSWorkspaceState.json create mode 100644 .vs/python-bot/v17/.wsuo create mode 100644 .vs/slnx.sqlite diff --git a/.vs/ProjectSettings.json b/.vs/ProjectSettings.json new file mode 100644 index 0000000..f8b4888 --- /dev/null +++ b/.vs/ProjectSettings.json @@ -0,0 +1,3 @@ +{ + "CurrentProjectSetting": null +} \ No newline at end of file diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json new file mode 100644 index 0000000..5ddea5d --- /dev/null +++ b/.vs/VSWorkspaceState.json @@ -0,0 +1,7 @@ +{ + "ExpandedNodes": [ + "" + ], + "SelectedNode": "\\.gitignore", + "PreviewInSolutionExplorer": false +} \ No newline at end of file diff --git a/.vs/python-bot/v17/.wsuo b/.vs/python-bot/v17/.wsuo new file mode 100644 index 0000000000000000000000000000000000000000..ed6f0dfcb9ba180cb8812123b77d520a4bfd49b1 GIT binary patch literal 14336 zcmeI2%Xd>n9LFa`R1_6NQ4zIbMMP5D0wthef%4P}QXZaTT{MrD*rdrxQXUI8{vR$p zE?v2C>EU=>C>zwJD_wb9xOJt}&v$Mny}fz#Cc(;;OwRA#JCnKdo8S94cjkv%8-Mxi z%Pqf}KsjXAnA?l%%>BOhnD5zaFy;yBYP-F-xTwGM%ww-ahy&+LfnUY+n`364d&yjv zC_|UcW^GO8Ygc%yIQ!ElYZE`m9#+3iUgxu5ESQhXDX`D*bj(~^VU*>6Z#I23{9^m^ ze;e1{rWy6M#o-s;qRBCXlF0y*@M0RsRQol%4Vb=|U);_5`P;{+%vBrCm<6!pOcweD zvp&q@w3PfWHh32P`)Kb2!qR_&zRs?n4EO+xIYDG9MyZ}?&H8}+W&@+f2`U64Ji%9+23l~|7q~{?BBA#<~!vN z{4A0soiFzhEiNgHu|63H_EI?M^d7?pde!<#g0gjviuQZ})-ld1M)#Jz^@GHhE=7+^Ee^C{GX#D5FE?tl< z6sx!y#$bOj@l!cQSp0g=;h#jqQ`J?-6~<0OS&0lI7#9cePz5MYTTie6pDG&0K!4lv zKgoN}|FnZ&ajJsHR#cv6)|VM)tONX~c+bgy5_;wNHJY?c7|ziqyBCe`A#-s=v9Vn9 z(hN{73GnM%fcs|P+FRZI{;!q(odxSWzYJVIZmC|gv-5v^x_)P;?{6QS|FfI-!_KqUuQ3N?2lB_AmTupd9(IFYcBJ>0 z#wd;*G^?3g)-=VyM|c6S1D_qVs$c=_cG5DyzjLR zv!WklWj|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*l5C8%|00;m9AOHkTodEp)->D;q3V{F+00KY&2mk>f00e*l s5C8%|00^8q0XY9Zb>vVX5C8%|00;m9AOHk_01yBIKmZ5;fm0{&KS&VAWB>pF literal 0 HcmV?d00001 diff --git a/connect.py b/connect.py index b9a660a..4a57be3 100644 --- a/connect.py +++ b/connect.py @@ -5,7 +5,7 @@ import traceback from typing import Dict, List, Tuple, Any, Optional, Union, Literal -import rtoml +import qtoml import socketio from colorama import Fore, Style from nacl.signing import SigningKey @@ -14,7 +14,7 @@ from mcstatus import JavaServer def get_config() -> Tuple[str, str, int]: with open('config.toml', 'r', encoding='utf-8') as f: - config = rtoml.load(f) + config = qtoml.load(f) return config['host'], config['private_key'], config['self_id'] diff --git a/requirement.txt b/requirement.txt index 4baec2e..b861617 100644 --- a/requirement.txt +++ b/requirement.txt @@ -1,6 +1,6 @@ lib-not-dr colorama -rtoml +qtoml pynacl python-socketio[asyncio_client] mcstatus \ No newline at end of file From fc0b10815fac4ce062f0b437603e404dbc81c7d1 Mon Sep 17 00:00:00 2001 From: SharwOrange Date: Thu, 28 Dec 2023 22:08:28 +0800 Subject: [PATCH 30/46] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + readme.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b4a3b79..2ed251f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /venv config.toml +/.vs \ No newline at end of file diff --git a/readme.md b/readme.md index bb80d45..f1d2d46 100644 --- a/readme.md +++ b/readme.md @@ -2,7 +2,7 @@ ## 源项目 本项目fork自[icalingua-python-bot](http://shenjack.top:5100/shenjack/icalingua-python-bot) \ -fork时版本[daf53ba226c844fb5eaf64fdf7d951720050590c](http://shenjack.top:5100/shenjack/icalingua-python-bot/commit/daf53ba226c844fb5eaf64fdf7d951720050590c) +fork时版本[69f202e83a7477490a58b5a1548d7d9240e82c72](http://shenjack.top:5100/shenjack/icalingua-python-bot/commit/69f202e83a7477490a58b5a1548d7d9240e82c72) ## 简介 From 014116c1055004481e9690f0df2697da90185081 Mon Sep 17 00:00:00 2001 From: SharwOrange Date: Thu, 28 Dec 2023 22:10:00 +0800 Subject: [PATCH 31/46] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86readme(again)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 2ed251f..7d43ebc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ /venv config.toml -/.vs \ No newline at end of file +.vs \ No newline at end of file From 43dc6deaea10ffafb6621f160d7f6a4b4025f05e Mon Sep 17 00:00:00 2001 From: SharwOrange Date: Thu, 28 Dec 2023 22:10:34 +0800 Subject: [PATCH 32/46] =?UTF-8?q?=E5=88=A0=E6=8E=89=E4=BA=86=E3=80=82vs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vs/ProjectSettings.json | 3 --- .vs/VSWorkspaceState.json | 7 ------- .vs/python-bot/v17/.wsuo | Bin 14336 -> 0 bytes .vs/slnx.sqlite | Bin 90112 -> 0 bytes 4 files changed, 10 deletions(-) delete mode 100644 .vs/ProjectSettings.json delete mode 100644 .vs/VSWorkspaceState.json delete mode 100644 .vs/python-bot/v17/.wsuo delete mode 100644 .vs/slnx.sqlite diff --git a/.vs/ProjectSettings.json b/.vs/ProjectSettings.json deleted file mode 100644 index f8b4888..0000000 --- a/.vs/ProjectSettings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "CurrentProjectSetting": null -} \ No newline at end of file diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json deleted file mode 100644 index 5ddea5d..0000000 --- a/.vs/VSWorkspaceState.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "ExpandedNodes": [ - "" - ], - "SelectedNode": "\\.gitignore", - "PreviewInSolutionExplorer": false -} \ No newline at end of file diff --git a/.vs/python-bot/v17/.wsuo b/.vs/python-bot/v17/.wsuo deleted file mode 100644 index ed6f0dfcb9ba180cb8812123b77d520a4bfd49b1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 14336 zcmeI2%Xd>n9LFa`R1_6NQ4zIbMMP5D0wthef%4P}QXZaTT{MrD*rdrxQXUI8{vR$p zE?v2C>EU=>C>zwJD_wb9xOJt}&v$Mny}fz#Cc(;;OwRA#JCnKdo8S94cjkv%8-Mxi z%Pqf}KsjXAnA?l%%>BOhnD5zaFy;yBYP-F-xTwGM%ww-ahy&+LfnUY+n`364d&yjv zC_|UcW^GO8Ygc%yIQ!ElYZE`m9#+3iUgxu5ESQhXDX`D*bj(~^VU*>6Z#I23{9^m^ ze;e1{rWy6M#o-s;qRBCXlF0y*@M0RsRQol%4Vb=|U);_5`P;{+%vBrCm<6!pOcweD zvp&q@w3PfWHh32P`)Kb2!qR_&zRs?n4EO+xIYDG9MyZ}?&H8}+W&@+f2`U64Ji%9+23l~|7q~{?BBA#<~!vN z{4A0soiFzhEiNgHu|63H_EI?M^d7?pde!<#g0gjviuQZ})-ld1M)#Jz^@GHhE=7+^Ee^C{GX#D5FE?tl< z6sx!y#$bOj@l!cQSp0g=;h#jqQ`J?-6~<0OS&0lI7#9cePz5MYTTie6pDG&0K!4lv zKgoN}|FnZ&ajJsHR#cv6)|VM)tONX~c+bgy5_;wNHJY?c7|ziqyBCe`A#-s=v9Vn9 z(hN{73GnM%fcs|P+FRZI{;!q(odxSWzYJVIZmC|gv-5v^x_)P;?{6QS|FfI-!_KqUuQ3N?2lB_AmTupd9(IFYcBJ>0 z#wd;*G^?3g)-=VyM|c6S1D_qVs$c=_cG5DyzjLR zv!WklWj|`KBjl{R?Kp}GDKH5~hBu7)I-)aAnJe%?6nqm=3i4=y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5C8%|00^8q0XY9Zb>vVX5C8%|00;m9AOHk_01yBIKmZ5;fm0{&KS&VAWB>pF From c138f0ac7ed45f0f8da0453f3cf426983795b38f Mon Sep 17 00:00:00 2001 From: SharwOrange Date: Sat, 30 Dec 2023 15:16:50 +0800 Subject: [PATCH 33/46] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8D=8A=E6=88=90?= =?UTF-8?q?=E5=93=81=E7=9A=84=E4=B8=80=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 0 connect.py | 15 ++++++- module/hitokoto/__init__.py | 5 +++ .../__pycache__/__init__.cpython-311.pyc | Bin 0 -> 470 bytes module/hitokoto/test.py | 38 ++++++++++++++++++ module/minecraft_server/__init__.py | 0 6 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 .vscode/settings.json create mode 100644 module/hitokoto/__init__.py create mode 100644 module/hitokoto/__pycache__/__init__.cpython-311.pyc create mode 100644 module/hitokoto/test.py create mode 100644 module/minecraft_server/__init__.py diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..e69de29 diff --git a/connect.py b/connect.py index 4a57be3..6d785e7 100644 --- a/connect.py +++ b/connect.py @@ -12,6 +12,10 @@ 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.toml', 'r', encoding='utf-8') as f: config = qtoml.load(f) @@ -192,6 +196,7 @@ async def add_message(data: Dict[str, Any]): 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() @@ -213,7 +218,15 @@ async def add_message(data: Dict[str, Any]): message = Message(content=f"此服务器当前在线玩家有 {players}",room_id=data['roomId']) await sio.emit('sendMessage', message.to_json()) - + + elif content == f'!!hitokoto {stypet}': + hitokoto.hitokoto(stypet) + result_code, result_data = hitokoto.hitokoto() + if result_code == 3: + message= Message(content=f"输入参数无效,将随机选取一言句子类型",room_id=data['roomId']) + if result_code == 0: + message = Message(f"Hitokoto: {result_data['hitokoto']}") + elif data.get('message').get('content').startswith('=='): evals: str = data.get('message').get('content')[2:] diff --git a/module/hitokoto/__init__.py b/module/hitokoto/__init__.py new file mode 100644 index 0000000..cd88196 --- /dev/null +++ b/module/hitokoto/__init__.py @@ -0,0 +1,5 @@ +import requests + +def hitokoto(): + hitokoto = requests.get('https://v1.hitokoto.cn') + print(hitokoto.json) \ No newline at end of file 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/test.py b/module/hitokoto/test.py new file mode 100644 index 0000000..1c419ff --- /dev/null +++ b/module/hitokoto/test.py @@ -0,0 +1,38 @@ +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 + + 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 \ No newline at end of file diff --git a/module/minecraft_server/__init__.py b/module/minecraft_server/__init__.py new file mode 100644 index 0000000..e69de29 From 196d3d85495e334724cebff1a82cb724b29d5349 Mon Sep 17 00:00:00 2001 From: SharwOrange Date: Sat, 30 Dec 2023 15:19:27 +0800 Subject: [PATCH 34/46] =?UTF-8?q?=E4=BF=AE=E6=94=B9.gittignore?= 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 7d43ebc..bd09c59 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /venv config.toml -.vs \ No newline at end of file +.vs +.vscode \ No newline at end of file From 332657936f0470a17565137693320cf9986e2c68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SharwOrange=E6=A9=99=E5=A4=9C?= Date: Sat, 30 Dec 2023 07:23:04 +0000 Subject: [PATCH 35/46] =?UTF-8?q?=E5=88=A0=E9=99=A4=20.vscode/settings.jso?= =?UTF-8?q?n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: SharwOrange橙夜 --- .vscode/settings.json | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index e69de29..0000000 From 3e68e1b509e26c021b2beb0ac195a08dbc8a09bf Mon Sep 17 00:00:00 2001 From: SharwOrange Date: Sat, 30 Dec 2023 15:30:41 +0800 Subject: [PATCH 36/46] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=98=E9=87=8F?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- connect.py | 4 ++-- module/hitokoto/test.py | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/connect.py b/connect.py index 6d785e7..a9d2428 100644 --- a/connect.py +++ b/connect.py @@ -219,8 +219,8 @@ async def add_message(data: Dict[str, Any]): await sio.emit('sendMessage', message.to_json()) - elif content == f'!!hitokoto {stypet}': - hitokoto.hitokoto(stypet) + elif content == f'!!hitokoto {ctypet}': + hitokoto.hitokoto(ctypet) result_code, result_data = hitokoto.hitokoto() if result_code == 3: message= Message(content=f"输入参数无效,将随机选取一言句子类型",room_id=data['roomId']) diff --git a/module/hitokoto/test.py b/module/hitokoto/test.py index 1c419ff..fc4aa48 100644 --- a/module/hitokoto/test.py +++ b/module/hitokoto/test.py @@ -33,6 +33,4 @@ def hitokoto(ctypet): 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 \ No newline at end of file + return 0,(hitokoto.json()) \ No newline at end of file From ec3962306e5ccc17f89f87e2640afa420b696d93 Mon Sep 17 00:00:00 2001 From: BadHappy <1196554262@qq.com> Date: Sat, 30 Dec 2023 09:38:34 +0000 Subject: [PATCH 37/46] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=87=B3=20/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- connect.py | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/connect.py b/connect.py index a9d2428..1455675 100644 --- a/connect.py +++ b/connect.py @@ -14,6 +14,7 @@ from mcstatus import JavaServer # 功能包引用处 from module import hitokoto + # 功能包结束引用 def get_config() -> Tuple[str, str, int]: @@ -218,14 +219,25 @@ async def add_message(data: Dict[str, Any]): message = Message(content=f"此服务器当前在线玩家有 {players}",room_id=data['roomId']) await sio.emit('sendMessage', message.to_json()) - - elif content == f'!!hitokoto {ctypet}': - hitokoto.hitokoto(ctypet) - result_code, result_data = hitokoto.hitokoto() + + elif content.startswith("!!hitokoto"): + + ctypet = content[len("!!hitokoto "):] + 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']) - if result_code == 0: - message = Message(f"Hitokoto: {result_data['hitokoto']}") + 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(content=f"Hitokoto: {result_data['hitokoto']}", room_id=data['roomId']) + else: + message = Message(content=f"但你看到这条消息就代表有bug出炉", room_id=data['roomId']) + + await sio.emit('sendMessage', message.to_json()) elif data.get('message').get('content').startswith('=='): From e035c8e93cc5893c25d5595eac37434e67447500 Mon Sep 17 00:00:00 2001 From: BadHappy <1196554262@qq.com> Date: Sat, 30 Dec 2023 09:39:00 +0000 Subject: [PATCH 38/46] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=87=B3=20module/hitokoto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/hitokoto/__init__.py | 53 ++++++++++++++++++++++++++++++++++-- module/hitokoto/test.py | Bin 1056 -> 1024 bytes 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/module/hitokoto/__init__.py b/module/hitokoto/__init__.py index cd88196..69316d5 100644 --- a/module/hitokoto/__init__.py +++ b/module/hitokoto/__init__.py @@ -1,5 +1,52 @@ import requests +import random + + +def hitokoto(ctypet): + try: + + 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' + + 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 + + + -def hitokoto(): - hitokoto = requests.get('https://v1.hitokoto.cn') - print(hitokoto.json) \ No newline at end of file diff --git a/module/hitokoto/test.py b/module/hitokoto/test.py index fc4aa4806e81c1e149cdba276a26e8249915c308..06d7405020018ddf3cacee90fd4af10487da3d20 100644 GIT binary patch literal 1024 ScmZQz7zLvtFd70QH3R?z00031 literal 1056 zcmZ|O!Aiq07zglspCY%kFgnHCpwA**o3?4Yrl#3I#DfQQ3{=Ks3J$!fAR-FN*xcK! z?H0Hy zEb5?YfD8lSbnuej&M{(qdurlVnf=R`VN^s-T+T@NU&wx50ig{E?H$5&n)PqwJ6Mol z?GVP7>D!Ym*pOhuLVEp}_8(+{KmvhfkFa>h2lG8_oL-(C?h_E_%M==K7k(^Ktccu*akI+F?ve@KiCpqkyVV4*uxOmHD yjZVvWUCg3Xb$@l22o-xm#7V2!?CtAyMz Date: Sat, 30 Dec 2023 17:43:26 +0800 Subject: [PATCH 39/46] =?UTF-8?q?=E5=88=A0=E9=99=A4test.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/hitokoto/test.py | Bin 1024 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 module/hitokoto/test.py diff --git a/module/hitokoto/test.py b/module/hitokoto/test.py deleted file mode 100644 index 06d7405020018ddf3cacee90fd4af10487da3d20..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1024 ScmZQz7zLvtFd70QH3R?z00031 From 7c0016c4be893fdbbc12ef7a8ed0b26363ebb17c Mon Sep 17 00:00:00 2001 From: SharwOrange Date: Sat, 30 Dec 2023 18:23:22 +0800 Subject: [PATCH 40/46] =?UTF-8?q?=E5=AE=8C=E5=96=84=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E8=A8=80=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- connect.py | 14 ++--- module/hitokoto/__init__.py | 50 +++++++++++++----- .../__pycache__/__init__.cpython-311.pyc | Bin 470 -> 2304 bytes 3 files changed, 46 insertions(+), 18 deletions(-) diff --git a/connect.py b/connect.py index 1455675..e5bbabe 100644 --- a/connect.py +++ b/connect.py @@ -224,18 +224,20 @@ async def add_message(data: Dict[str, Any]): ctypet = content[len("!!hitokoto "):] if content == "!!hitokoto": - result_code, result_data = hitokoto.hitokoto("没有") + result_code, result_data, result_type= hitokoto.hitokoto(None) else: - result_code, result_data = hitokoto.hitokoto(ctypet) + result_code, result_data, result_type= hitokoto.hitokoto(ctypet) if result_code == 3: - message = Message(content=f"参数不对哦!",room_id=data['roomId']) + message = Message(content=f"参数不对哦!你可以输入!!hitokoto help查看帮助",room_id=data['roomId']) elif result_code == 2: - message = Message(content=f"发生了不可描述的错误X_X", room_id=data['roomId']) + message = Message(content=f"发生了不可描述的错误X_X,但可以肯定的是模块炸了(", room_id=data['roomId']) + elif result_code == 1: + message = Message(content=f"(参数)句子类型如下\na 动画\nb 漫画\nc 游戏\nd 文学\ne 原创\nf 来自网络\ng 其他\nh 影视\ni 诗词\nj 网易云\nk 哲学\nl 抖机灵", room_id=data['roomId']) elif result_code == 0: - message = Message(content=f"Hitokoto: {result_data['hitokoto']}", room_id=data['roomId']) + message = Message(content=f"“{result_data['hitokoto']}”\n类型:{result_type}", room_id=data['roomId']) else: - message = Message(content=f"但你看到这条消息就代表有bug出炉", room_id=data['roomId']) + message = Message(content=f"你看到这条消息就代表有bug出炉,但肯定不是模块炸了(", room_id=data['roomId']) await sio.emit('sendMessage', message.to_json()) diff --git a/module/hitokoto/__init__.py b/module/hitokoto/__init__.py index 69316d5..a37f290 100644 --- a/module/hitokoto/__init__.py +++ b/module/hitokoto/__init__.py @@ -1,8 +1,10 @@ import requests import random - def hitokoto(ctypet): + + result_type = None + try: if ctypet == '动画' or ctypet == 'a': @@ -15,7 +17,7 @@ def hitokoto(ctypet): ctype = 'd' elif ctypet == '原创' or ctypet == 'e': ctype = 'e' - elif ctypet == '网络' or ctypet == 'f': + elif ctypet == '来自网络' or ctypet == 'f': ctype = 'f' elif ctypet == '其他' or ctypet == 'g': ctype = 'g' @@ -29,24 +31,48 @@ def hitokoto(ctypet): ctype = 'k' elif ctypet == '抖机灵' or ctypet == 'l': ctype = 'l' - - elif ctypet == '没有': + elif ctypet == None: ctype = random.choice('abcdefghijkl') - params_value = {'c': ctype} - hitokoto = requests.get('https://v1.hitokoto.cn', params=params_value) - - return 0, hitokoto.json() + elif ctypet == 'help': + return 1, None, result_type else: - return 3, None + return 3, None, result_type params_value = {'c': ctype} hitokoto = requests.get('https://v1.hitokoto.cn', params=params_value) - return 0, hitokoto.json() + htype=hitokoto.json()['type'] + if htype=='a': + result_type = '动画' + elif htype=='b': + result_type = '动漫' + elif htype=='c': + result_type = '游戏' + elif htype=='d': + result_type = '文学' + elif htype=='e': + result_type = '原创' + elif htype=='f': + result_type = '来自网络' + elif htype=='g': + result_type = '其他' + elif htype=='h': + result_type = '影视' + elif htype=='i': + result_type = '诗词' + elif htype=='j': + result_type = '网易云' + elif htype=='k': + result_type = '哲学' + elif htype=='l': + result_type = '抖机灵' + else: + result_type = '无法获取' + return 0, hitokoto.json(), result_type + except IOError: - return 2, None - + return 2, None, result_type diff --git a/module/hitokoto/__pycache__/__init__.cpython-311.pyc b/module/hitokoto/__pycache__/__init__.cpython-311.pyc index 2ae9f3e3ea77a5aa6ffe2fd3ce7ab2e76d740840..551b3d868fa6fe90ac3df9f7341a951c82617be1 100644 GIT binary patch literal 2304 zcmcJQe@q)?7{}kY*Oo$iw9rz1b}$Oth@k|hli+5ejG0NqKZs@{&6?6XXrb-Z>y-^{ z4JMnbjgHPCkT_$5k=3EuoKcstB^s0ceIxwQT(YEzqrhL1@DJHvK6gj2XVkc4+1uW8 z&-4Af&wKCP^IUt4Br6b%cmABAE#(OPAqK^v*>iT9z?nxBqHqum%V#`{Db0B_tfBA_ z>L9knse?Yemm!|Ca1e0pjDQuh6Sy43VT}oC-KZXXjqI}orAcVQJSc>UY89#l`WsN4 zis}`r2YL%=nTi?|Y5@8*&~g>6P-q3vS)fK0H7V2t^a4;)MJp9r33L*uSw$@hwE!Ih zTBV}Z3atiu3aC{@Z3?vkJqff%MePc;1MLM`tDl^njZ>(Gu@TffF!q1OZ z<^((@NB4f%y!MfR{Zh1fV}A3-rveVd;70^OUSZ+NqdS)cJT6bZa!b0@goF#Jxx&>u z8z258;Gkggj`%2gbj%+Zp9l(CKOKy0iA}jB_SJiKKgUI)y zSkOnjtTz-DwA@sLmM@aZ!tKi2pU)J2{CxA$FY7aNtk{fOqUq2Jde$4Jn2@0N`I&%^ z77Q%?Zj6p{QGpnvIYB!fWx_()$+!AhmSM&DK5=`Z%R*eqc=*ZZ!hZh|gN6uE8 z>`(URNNf7sD%s4F&6y+Fp~YjFW6z9yuu8V`WP8?r^YC>?_Sx;={Z+D+CtEY4H;Khi zCiF!2^WQmK>P+&?LtDe_n;F*wTlbo+yZGEDS4js?I&xN9npzm(tp|D2!TjHXy2gdK z)A6L~p|x@LDBsfaYZGrBd|(}1vkoQ=`AYjtC>8pc`Gi>*U8`(Q>T*U)+L`K2_U0N| zlLN_t99f<2OARN7pFTeHl&EJB z1f5tiIhfbBVC2nC-mv%GCSb@`#!B`ov-!4>3);>gp0V}iNSUd ztoTpB))qVeTeJf%Vx3?f8;;6v%PZ^w2*sa?=!;&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 From 1ea0744062cced85883e0af109f350aadace25ce Mon Sep 17 00:00:00 2001 From: SharwOrange Date: Sat, 30 Dec 2023 18:26:04 +0800 Subject: [PATCH 41/46] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86.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..65d5e2c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /venv config.toml .vs -.vscode \ No newline at end of file +.vscode +__pycache__ \ No newline at end of file From 92e86ae7cce87c15e51425d6e184f1ad09f14252 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SharwOrange=E6=A9=99=E5=A4=9C?= Date: Sat, 30 Dec 2023 10:26:28 +0000 Subject: [PATCH 42/46] =?UTF-8?q?=E5=88=A0=E9=99=A4=20module/hitokoto/=5F?= =?UTF-8?q?=5Fpycache=5F=5F/=5F=5Finit=5F=5F.cpython-311.pyc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../__pycache__/__init__.cpython-311.pyc | Bin 2304 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 module/hitokoto/__pycache__/__init__.cpython-311.pyc diff --git a/module/hitokoto/__pycache__/__init__.cpython-311.pyc b/module/hitokoto/__pycache__/__init__.cpython-311.pyc deleted file mode 100644 index 551b3d868fa6fe90ac3df9f7341a951c82617be1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2304 zcmcJQe@q)?7{}kY*Oo$iw9rz1b}$Oth@k|hli+5ejG0NqKZs@{&6?6XXrb-Z>y-^{ z4JMnbjgHPCkT_$5k=3EuoKcstB^s0ceIxwQT(YEzqrhL1@DJHvK6gj2XVkc4+1uW8 z&-4Af&wKCP^IUt4Br6b%cmABAE#(OPAqK^v*>iT9z?nxBqHqum%V#`{Db0B_tfBA_ z>L9knse?Yemm!|Ca1e0pjDQuh6Sy43VT}oC-KZXXjqI}orAcVQJSc>UY89#l`WsN4 zis}`r2YL%=nTi?|Y5@8*&~g>6P-q3vS)fK0H7V2t^a4;)MJp9r33L*uSw$@hwE!Ih zTBV}Z3atiu3aC{@Z3?vkJqff%MePc;1MLM`tDl^njZ>(Gu@TffF!q1OZ z<^((@NB4f%y!MfR{Zh1fV}A3-rveVd;70^OUSZ+NqdS)cJT6bZa!b0@goF#Jxx&>u z8z258;Gkggj`%2gbj%+Zp9l(CKOKy0iA}jB_SJiKKgUI)y zSkOnjtTz-DwA@sLmM@aZ!tKi2pU)J2{CxA$FY7aNtk{fOqUq2Jde$4Jn2@0N`I&%^ z77Q%?Zj6p{QGpnvIYB!fWx_()$+!AhmSM&DK5=`Z%R*eqc=*ZZ!hZh|gN6uE8 z>`(URNNf7sD%s4F&6y+Fp~YjFW6z9yuu8V`WP8?r^YC>?_Sx;={Z+D+CtEY4H;Khi zCiF!2^WQmK>P+&?LtDe_n;F*wTlbo+yZGEDS4js?I&xN9npzm(tp|D2!TjHXy2gdK z)A6L~p|x@LDBsfaYZGrBd|(}1vkoQ=`AYjtC>8pc`Gi>*U8`(Q>T*U)+L`K2_U0N| zlLN_t99f<2OARN7pFTeHl&EJB z1f5tiIhfbBVC2nC-mv%GCSb@`#!B`ov-!4>3);>gp0V}iNSUd ztoTpB))qVeTeJf%Vx3?f8;;6v%PZ^w2*sa?=!; Date: Sat, 30 Dec 2023 18:28:09 +0800 Subject: [PATCH 43/46] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86requirement.tx?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../__pycache__/__init__.cpython-311.pyc | Bin 2304 -> 0 bytes requirement.txt | 3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) delete mode 100644 module/hitokoto/__pycache__/__init__.cpython-311.pyc diff --git a/module/hitokoto/__pycache__/__init__.cpython-311.pyc b/module/hitokoto/__pycache__/__init__.cpython-311.pyc deleted file mode 100644 index 551b3d868fa6fe90ac3df9f7341a951c82617be1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2304 zcmcJQe@q)?7{}kY*Oo$iw9rz1b}$Oth@k|hli+5ejG0NqKZs@{&6?6XXrb-Z>y-^{ z4JMnbjgHPCkT_$5k=3EuoKcstB^s0ceIxwQT(YEzqrhL1@DJHvK6gj2XVkc4+1uW8 z&-4Af&wKCP^IUt4Br6b%cmABAE#(OPAqK^v*>iT9z?nxBqHqum%V#`{Db0B_tfBA_ z>L9knse?Yemm!|Ca1e0pjDQuh6Sy43VT}oC-KZXXjqI}orAcVQJSc>UY89#l`WsN4 zis}`r2YL%=nTi?|Y5@8*&~g>6P-q3vS)fK0H7V2t^a4;)MJp9r33L*uSw$@hwE!Ih zTBV}Z3atiu3aC{@Z3?vkJqff%MePc;1MLM`tDl^njZ>(Gu@TffF!q1OZ z<^((@NB4f%y!MfR{Zh1fV}A3-rveVd;70^OUSZ+NqdS)cJT6bZa!b0@goF#Jxx&>u z8z258;Gkggj`%2gbj%+Zp9l(CKOKy0iA}jB_SJiKKgUI)y zSkOnjtTz-DwA@sLmM@aZ!tKi2pU)J2{CxA$FY7aNtk{fOqUq2Jde$4Jn2@0N`I&%^ z77Q%?Zj6p{QGpnvIYB!fWx_()$+!AhmSM&DK5=`Z%R*eqc=*ZZ!hZh|gN6uE8 z>`(URNNf7sD%s4F&6y+Fp~YjFW6z9yuu8V`WP8?r^YC>?_Sx;={Z+D+CtEY4H;Khi zCiF!2^WQmK>P+&?LtDe_n;F*wTlbo+yZGEDS4js?I&xN9npzm(tp|D2!TjHXy2gdK z)A6L~p|x@LDBsfaYZGrBd|(}1vkoQ=`AYjtC>8pc`Gi>*U8`(Q>T*U)+L`K2_U0N| zlLN_t99f<2OARN7pFTeHl&EJB z1f5tiIhfbBVC2nC-mv%GCSb@`#!B`ov-!4>3);>gp0V}iNSUd ztoTpB))qVeTeJf%Vx3?f8;;6v%PZ^w2*sa?=!; Date: Sat, 30 Dec 2023 18:30:59 +0800 Subject: [PATCH 44/46] =?UTF-8?q?=E5=AE=8C=E5=96=84=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E8=A8=80=E5=8A=9F=E8=83=BD=EF=BC=9A=E6=B7=BB=E5=8A=A0=E4=B8=80?= =?UTF-8?q?=E8=A8=80=E6=9D=A5=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- connect.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connect.py b/connect.py index e5bbabe..13eb0bf 100644 --- a/connect.py +++ b/connect.py @@ -235,7 +235,7 @@ async def add_message(data: Dict[str, Any]): elif result_code == 1: message = Message(content=f"(参数)句子类型如下\na 动画\nb 漫画\nc 游戏\nd 文学\ne 原创\nf 来自网络\ng 其他\nh 影视\ni 诗词\nj 网易云\nk 哲学\nl 抖机灵", room_id=data['roomId']) elif result_code == 0: - message = Message(content=f"“{result_data['hitokoto']}”\n类型:{result_type}", room_id=data['roomId']) + message = Message(content=f"“{result_data['hitokoto']}”\n来源:{result_data['from']}\n类型:{result_type}", room_id=data['roomId']) else: message = Message(content=f"你看到这条消息就代表有bug出炉,但肯定不是模块炸了(", room_id=data['roomId']) From 6a3a31ab18e847ce18a9f3450f61712e95a1b9b5 Mon Sep 17 00:00:00 2001 From: SharwOrange Date: Sat, 30 Dec 2023 19:55:25 +0800 Subject: [PATCH 45/46] =?UTF-8?q?=E5=B0=86=E9=83=A8=E5=88=86=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E6=B7=BB=E5=8A=A0=E5=9B=9E=E5=A4=8D=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- connect.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/connect.py b/connect.py index 13eb0bf..b84fa30 100644 --- a/connect.py +++ b/connect.py @@ -191,6 +191,7 @@ async def add_message(data: Dict[str, Any]): sender_id = data['message']['senderId'] content = data['message']['content'] room_id = data['roomId'] + reply = ReplyMessage(id=data['message']['_id']) if not is_self: if data.get('message').get('content') == '/bot': @@ -208,7 +209,7 @@ async def add_message(data: Dict[str, Any]): # else: # message = Message(content=f"此服务器空无一人",room_id=data['roomId']) - message = Message(content=f"此服务器有 {status.players.online} 个玩家在线",room_id=data['roomId']) + message = Message(content=f"此服务器有 {status.players.online} 个玩家在线",reply_to=reply,room_id=data['roomId']) await sio.emit('sendMessage', message.to_json()) @@ -216,7 +217,7 @@ async def add_message(data: Dict[str, Any]): server = JavaServer.lookup("192.168.1.6:25565") query = server.query() players = query.players.names - message = Message(content=f"此服务器当前在线玩家有 {players}",room_id=data['roomId']) + message = Message(content=f"此服务器当前在线玩家有 {players}",reply_to=reply,room_id=data['roomId']) await sio.emit('sendMessage', message.to_json()) @@ -229,15 +230,15 @@ async def add_message(data: Dict[str, Any]): result_code, result_data, result_type= hitokoto.hitokoto(ctypet) if result_code == 3: - message = Message(content=f"参数不对哦!你可以输入!!hitokoto help查看帮助",room_id=data['roomId']) + message = Message(content=f"参数不对哦!你可以输入!!hitokoto help查看帮助",reply_to=reply,room_id=data['roomId']) elif result_code == 2: - message = Message(content=f"发生了不可描述的错误X_X,但可以肯定的是模块炸了(", room_id=data['roomId']) + message = Message(content=f"发生了不可描述的错误X_X,但可以肯定的是模块炸了(",reply_to=reply,room_id=data['roomId']) elif result_code == 1: - message = Message(content=f"(参数)句子类型如下\na 动画\nb 漫画\nc 游戏\nd 文学\ne 原创\nf 来自网络\ng 其他\nh 影视\ni 诗词\nj 网易云\nk 哲学\nl 抖机灵", room_id=data['roomId']) + message = Message(content=f"(参数)句子类型如下\na 动画\nb 漫画\nc 游戏\nd 文学\ne 原创\nf 来自网络\ng 其他\nh 影视\ni 诗词\nj 网易云\nk 哲学\nl 抖机灵",reply_to=reply,room_id=data['roomId']) elif result_code == 0: - message = Message(content=f"“{result_data['hitokoto']}”\n来源:{result_data['from']}\n类型:{result_type}", room_id=data['roomId']) + message = Message(content=f"“{result_data['hitokoto']}”\n来源:{result_data['from']}\n类型:{result_type}",reply_to=reply,room_id=data['roomId']) else: - message = Message(content=f"你看到这条消息就代表有bug出炉,但肯定不是模块炸了(", room_id=data['roomId']) + message = Message(content=f"你看到这条消息就代表有bug出炉,但肯定不是模块炸了(",reply_to=reply,room_id=data['roomId']) await sio.emit('sendMessage', message.to_json()) From 51011ec401ee07fe7446b24fad680a629e12ff56 Mon Sep 17 00:00:00 2001 From: SharwOrange Date: Sat, 30 Dec 2023 19:55:48 +0800 Subject: [PATCH 46/46] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- connect.py | 1 - 1 file changed, 1 deletion(-) diff --git a/connect.py b/connect.py index b84fa30..d4bf782 100644 --- a/connect.py +++ b/connect.py @@ -280,7 +280,6 @@ async def add_message(data: Dict[str, Any]): 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)