From 6ba305dd8121db2c5c87f1f3c86762b32cc8aaf5 Mon Sep 17 00:00:00 2001 From: Amelie Date: Mon, 20 Jun 2022 21:26:03 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E4=B8=BAkm=E6=8F=92=E4=BB=B6=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=AD=BE=E5=90=8D=E4=BA=BA=E6=95=B0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EVEBot/src/plugins/km/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/EVEBot/src/plugins/km/__init__.py b/EVEBot/src/plugins/km/__init__.py index 59f0b2e..81739f2 100644 --- a/EVEBot/src/plugins/km/__init__.py +++ b/EVEBot/src/plugins/km/__init__.py @@ -238,6 +238,8 @@ async def km(): if zkb_json[0]['zkb']['solo'] == True : msg = msg + 'SOLO\n' + else: + msg = msg + f'签名人数: {len(esi_json["attackers"])}\n' msg = msg + '\n' From 46e0e2410592945d37aec5da001140a01b17e870 Mon Sep 17 00:00:00 2001 From: Amelie Date: Wed, 22 Jun 2022 19:25:40 +0800 Subject: [PATCH 02/13] =?UTF-8?q?=E5=A2=9E=E5=8A=A0map=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EVEBot/bot.py | 1 + EVEBot/src/plugins/map/__init__.py | 90 ++++++++++++++++++++++++++++++ README.md | 2 + 3 files changed, 93 insertions(+) create mode 100644 EVEBot/src/plugins/map/__init__.py diff --git a/EVEBot/bot.py b/EVEBot/bot.py index a945a51..99fccf2 100644 --- a/EVEBot/bot.py +++ b/EVEBot/bot.py @@ -31,6 +31,7 @@ nonebot.load_plugin('src.plugins.km') nonebot.load_plugin('src.plugins.kb') nonebot.load_plugin('src.plugins.checkServer') +nonebot.load_plugin('src.plugins.map') # 依赖 bind nonebot.load_plugin('src.plugins.test') # Please DO NOT modify this file unless you know what you are doing! diff --git a/EVEBot/src/plugins/map/__init__.py b/EVEBot/src/plugins/map/__init__.py new file mode 100644 index 0000000..a60d0db --- /dev/null +++ b/EVEBot/src/plugins/map/__init__.py @@ -0,0 +1,90 @@ +from nonebot import on_regex +from nonebot.adapters.cqhttp import Event, Bot, Message +from nonebot.plugin import require as pluginR +import httpx +import urllib.parse + +tool = pluginR('tool') + +util = pluginR('util') + +bind = pluginR('bind') + +headers = {"accept": "application/json", "Cache-Control": "no-cache"} + +client = httpx.AsyncClient() + +search_map = on_regex(r'^[\.。](map|地图)\s*\S+') +@search_map.handle() +async def _(bot: Bot, event: Event): + global bind + + if not (event.message_type == 'group' and event.group_id in tool.group_ids) : + return + + if await util.isPass() or await util.isBan(event.user_id) : + return + + name = str(event.get_message()).split(' ', 1)[1].strip() + + if name in bind.bind : + name = bind.bind[name] + + if len(name) <= 2 : + name = f' {name} ' + + url_name = urllib.parse.quote(name) + + try: + esi_re = await client.get(url=f'https://esi.evetech.net/latest/search/?categories=constellation,region,solar_system&datasource=tranquility&language=zh&search={url_name}&strict=true', headers=headers) + except: + await search_map.finish(message=Message('当前网络连接错误,请稍后进行查询!')) + return + if esi_re.status_code != 200 : + await search_map.finish(message=Message('当前网络连接错误,请稍后进行查询!')) + return + esi_json = esi_re.json() + + if 'region' in esi_json : + region_id = esi_json['region'][0] + try: + region_re = await client.get(url=f'https://esi.evetech.net/latest/universe/regions/{region_id}/?datasource=tranquility&language=en', headers=headers) + except: + await search_map.finish(message=Message('当前网络连接错误,请稍后进行查询!')) + return + if region_re.status_code != 200 : + await search_map.finish(message=Message('当前网络连接错误,请稍后进行查询!')) + return + region_json = region_re.json() + region_name = region_json['name'] + msg = f'星域: {name} / {region_name}' + elif 'constellation' in esi_json : + constellation_id = esi_json['constellation'][0] + try: + constellation_re = await client.get(url=f'https://esi.evetech.net/latest/universe/constellations/{constellation_id}/?datasource=tranquility&language=en', headers=headers) + except: + await search_map.finish(message=Message('当前网络连接错误,请稍后进行查询!')) + return + if constellation_re.status_code != 200 : + await search_map.finish(message=Message('当前网络连接错误,请稍后进行查询!')) + return + constellation_json = constellation_re.json() + constellation_name = constellation_json['name'] + msg = f'星座: {name} / {constellation_name}' + elif 'solar_system' in esi_json : + system_id = esi_json['solar_system'][0] + try: + system_re = await client.get(url=f'https://esi.evetech.net/latest/universe/systems/{system_id}/?datasource=tranquility&language=en', headers=headers) + except: + await search_map.finish(message=Message('当前网络连接错误,请稍后进行查询!')) + return + if system_re.status_code != 200 : + await search_map.finish(message=Message('当前网络连接错误,请稍后进行查询!')) + return + system_json = system_re.json() + system_name = system_json['name'] + msg = f'星系: {name} / {system_name}' + else: + msg = '没有此*中文*名称对应的星域/星座/星系,请检查输入是否正确!' + + await search_map.finish(message=Message(msg)) diff --git a/README.md b/README.md index fa66ad6..5db3584 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,8 @@ .tr / .tran / .翻译 <关键字> # 从zkillboard网获得人物信息 .kb / .zkb +# 翻译中文星域/星座/星系名到英文 +.map / .地图 <星域/星座/星系名> ### 管理员命令 # 绑定物品的别名,比如绑定MTU到移动式牵引装置,方便查价 From 6938a3af3945c4f04f9c0a26f63d91052526a8d3 Mon Sep 17 00:00:00 2001 From: Amelie Date: Wed, 22 Jun 2022 19:52:23 +0800 Subject: [PATCH 03/13] =?UTF-8?q?=E4=BF=AE=E6=94=B9map=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EVEBot/src/plugins/map/__init__.py | 36 +++++++++++++++++++----------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/EVEBot/src/plugins/map/__init__.py b/EVEBot/src/plugins/map/__init__.py index a60d0db..ef21ad5 100644 --- a/EVEBot/src/plugins/map/__init__.py +++ b/EVEBot/src/plugins/map/__init__.py @@ -34,21 +34,31 @@ async def _(bot: Bot, event: Event): name = f' {name} ' url_name = urllib.parse.quote(name) + + input_lang = 'zh' + output_lang = 'en' - try: - esi_re = await client.get(url=f'https://esi.evetech.net/latest/search/?categories=constellation,region,solar_system&datasource=tranquility&language=zh&search={url_name}&strict=true', headers=headers) - except: - await search_map.finish(message=Message('当前网络连接错误,请稍后进行查询!')) - return - if esi_re.status_code != 200 : - await search_map.finish(message=Message('当前网络连接错误,请稍后进行查询!')) - return - esi_json = esi_re.json() + for i in range(2) : + try: + esi_re = await client.get(url=f'https://esi.evetech.net/latest/search/?categories=constellation,region,solar_system&datasource=tranquility&language={input_lang}&search={url_name}&strict=true', headers=headers) + except: + await search_map.finish(message=Message('当前网络连接错误,请稍后进行查询!')) + return + if esi_re.status_code != 200 : + await search_map.finish(message=Message('当前网络连接错误,请稍后进行查询!')) + return + esi_json = esi_re.json() + if ('region' not in esi_json) and ('constellation' not in esi_json) and ('solar_system' not in esi_json) : + input_lang = 'en' + output_lang = 'zh' + else: + break + if 'region' in esi_json : region_id = esi_json['region'][0] try: - region_re = await client.get(url=f'https://esi.evetech.net/latest/universe/regions/{region_id}/?datasource=tranquility&language=en', headers=headers) + region_re = await client.get(url=f'https://esi.evetech.net/latest/universe/regions/{region_id}/?datasource=tranquility&language={output_lang}', headers=headers) except: await search_map.finish(message=Message('当前网络连接错误,请稍后进行查询!')) return @@ -61,7 +71,7 @@ async def _(bot: Bot, event: Event): elif 'constellation' in esi_json : constellation_id = esi_json['constellation'][0] try: - constellation_re = await client.get(url=f'https://esi.evetech.net/latest/universe/constellations/{constellation_id}/?datasource=tranquility&language=en', headers=headers) + constellation_re = await client.get(url=f'https://esi.evetech.net/latest/universe/constellations/{constellation_id}/?datasource=tranquility&language={output_lang}', headers=headers) except: await search_map.finish(message=Message('当前网络连接错误,请稍后进行查询!')) return @@ -74,7 +84,7 @@ async def _(bot: Bot, event: Event): elif 'solar_system' in esi_json : system_id = esi_json['solar_system'][0] try: - system_re = await client.get(url=f'https://esi.evetech.net/latest/universe/systems/{system_id}/?datasource=tranquility&language=en', headers=headers) + system_re = await client.get(url=f'https://esi.evetech.net/latest/universe/systems/{system_id}/?datasource=tranquility&language={output_lang}', headers=headers) except: await search_map.finish(message=Message('当前网络连接错误,请稍后进行查询!')) return @@ -85,6 +95,6 @@ async def _(bot: Bot, event: Event): system_name = system_json['name'] msg = f'星系: {name} / {system_name}' else: - msg = '没有此*中文*名称对应的星域/星座/星系,请检查输入是否正确!' + msg = '没有该名称对应的星域/星座/星系,请检查输入是否正确!' await search_map.finish(message=Message(msg)) From 3bef1bcec3dea510fe173df81380483b7737d2f1 Mon Sep 17 00:00:00 2001 From: Amelie Date: Thu, 23 Jun 2022 02:46:31 +0800 Subject: [PATCH 04/13] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EVEBot/src/plugins/checkServer/__init__.py | 2 -- EVEBot/src/plugins/jita/get_data.py | 2 -- EVEBot/src/plugins/kb/__init__.py | 16 ++++------------ EVEBot/src/plugins/km/__init__.py | 18 ------------------ EVEBot/src/plugins/map/__init__.py | 12 ------------ EVEBot/src/plugins/suit/__init__.py | 4 ---- README.md | 7 +++++++ 7 files changed, 11 insertions(+), 50 deletions(-) diff --git a/EVEBot/src/plugins/checkServer/__init__.py b/EVEBot/src/plugins/checkServer/__init__.py index c7010a0..47e8c98 100644 --- a/EVEBot/src/plugins/checkServer/__init__.py +++ b/EVEBot/src/plugins/checkServer/__init__.py @@ -34,8 +34,6 @@ async def check_server_every_1_time(): re = await client.get(url=f'https://esi.evetech.net/latest/status/?datasource=tranquility', headers=headers) except: return - if re.status_code != 200 : - return re_json = re.json() if 'start_time' in re_json : if flag : diff --git a/EVEBot/src/plugins/jita/get_data.py b/EVEBot/src/plugins/jita/get_data.py index 7467ad1..f131208 100644 --- a/EVEBot/src/plugins/jita/get_data.py +++ b/EVEBot/src/plugins/jita/get_data.py @@ -36,8 +36,6 @@ async def get_price(name: str, num: int = 1): re = await client.get(url=f'https://esi.evetech.net/latest/markets/10000002/orders/?datasource=tranquility&order_type=all&type_id={itemID}', headers=headers) except: return '连接服务器失败,请稍后尝试!' - if re.status_code != 200 : - return '连接服务器失败,请稍后尝试!' re_json = re.json() buy = 0 sell = 0 diff --git a/EVEBot/src/plugins/kb/__init__.py b/EVEBot/src/plugins/kb/__init__.py index fca0e9b..7bf4fa7 100644 --- a/EVEBot/src/plugins/kb/__init__.py +++ b/EVEBot/src/plugins/kb/__init__.py @@ -32,9 +32,6 @@ async def _(bot: Bot, event: Event): except: await kb.finish(message=Message('当前网络连接错误,请稍后进行查询!')) return - if name_re.status_code != 200 : - await kb.finish(message=Message('当前网络连接错误,请稍后进行查询!')) - return name_json = name_re.json() if 'character' in name_json : @@ -48,9 +45,6 @@ async def _(bot: Bot, event: Event): except: await kb.finish(message=Message('zkb网连接失败,请稍后进行查询!')) return - if zkb_re.status_code != 200 : - await kb.finish(message=Message('zkb网连接失败,请稍后进行查询!')) - return zkb_json = zkb_re.json() if zkb_json['info'] is None : @@ -82,17 +76,15 @@ async def _(bot: Bot, event: Event): if corporation_str is None and 'corporationID' in zkb_json['info'] : try: corporation_re = await client.get(url=f"https://esi.evetech.net/latest/corporations/{zkb_json['info']['corporationID']}/?datasource=tranquility", headers=headers) - if corporation_re.status_code == 200 : - corporation_json = corporation_re.json() - corporation_str = corporation_json['name'] + ' [' + corporation_json['ticker'] + ']' + corporation_json = corporation_re.json() + corporation_str = corporation_json['name'] + ' [' + corporation_json['ticker'] + ']' except: pass if alliance_str is None and 'allianceID' in zkb_json['info'] : try: alliance_re = await client.get(url=f"https://esi.evetech.net/latest/alliances/{zkb_json['info']['allianceID']}/?datasource=tranquility", headers=headers) - if alliance_re.status_code == 200 : - alliance_json = alliance_re.json() - alliance_str = alliance_json['name'] + ' <' + alliance_json['ticker'] + '>' + alliance_json = alliance_re.json() + alliance_str = alliance_json['name'] + ' <' + alliance_json['ticker'] + '>' except: pass if corporation_str is not None : diff --git a/EVEBot/src/plugins/km/__init__.py b/EVEBot/src/plugins/km/__init__.py index 81739f2..18aa651 100644 --- a/EVEBot/src/plugins/km/__init__.py +++ b/EVEBot/src/plugins/km/__init__.py @@ -98,8 +98,6 @@ async def km(): zkb_re = await client.get(url=f'https://zkillboard.com/api/killID/{killID}/') except: continue - if zkb_re.status_code != 200 : - continue zkb_json = zkb_re.json() loss = zkb_json[0]['zkb']['totalValue'] @@ -113,8 +111,6 @@ async def km(): esi_re = await client.get(url=f'https://esi.evetech.net/latest/killmails/{killID}/{killHash}/?datasource=tranquility') except: continue - if esi_re.status_code != 200 : - continue esi_json = esi_re.json() # 过滤本联盟被击杀的km @@ -133,8 +129,6 @@ async def km(): ship_re = await client.get(url=f'https://esi.evetech.net/latest/universe/types/{ship_type_id}/?datasource=tranquility&language=zh', headers=headers) except: continue - if ship_re.status_code != 200 : - continue ship_json = ship_re.json() ship_name = ship_json['name'] msg = msg + f'{ship_name}\n' @@ -148,8 +142,6 @@ async def km(): dead_re = await client.get(url=f'https://esi.evetech.net/latest/characters/{dead_id}/?datasource=tranquility', headers=headers) except: continue - if dead_re.status_code != 200 : - continue dead_json = dead_re.json() dead_name = dead_json['name'] if 'corporation_id' in dead_json : @@ -157,8 +149,6 @@ async def km(): dead_corporation_re = await client.get(url=f'https://esi.evetech.net/latest/corporations/{dead_json["corporation_id"]}/?datasource=tranquility', headers=headers) except: continue - if dead_corporation_re.status_code != 200 : - continue dead_corporation_json = dead_corporation_re.json() dead_corporation_ticker = '[' + dead_corporation_json['ticker'] + ']' if 'alliance_id' in dead_json : @@ -166,8 +156,6 @@ async def km(): dead_alliance_re = await client.get(url=f'https://esi.evetech.net/latest/alliances/{dead_json["alliance_id"]}/?datasource=tranquility', headers=headers) except: continue - if dead_alliance_re.status_code != 200 : - continue dead_alliance_json = dead_alliance_re.json() dead_alliance_ticker = '<' + dead_alliance_json['ticker'] + '>' else: @@ -189,8 +177,6 @@ async def km(): killer_re = await client.get(url=f'https://esi.evetech.net/latest/characters/{killer_id}/?datasource=tranquility', headers=headers) except: continue - if killer_re.status_code != 200 : - continue killer_json = killer_re.json() killer_name = killer_json['name'] if 'corporation_id' in killer_json : @@ -198,8 +184,6 @@ async def km(): killer_corporation_re = await client.get(url=f'https://esi.evetech.net/latest/corporations/{killer_json["corporation_id"]}/?datasource=tranquility', headers=headers) except: continue - if killer_corporation_re.status_code != 200 : - continue killer_corporation_json = killer_corporation_re.json() killer_corporation_ticker = '[' + killer_corporation_json['ticker'] + ']' if 'alliance_id' in killer_json : @@ -209,8 +193,6 @@ async def km(): killer_alliance_re = await client.get(url=f'https://esi.evetech.net/latest/alliances/{killer_json["alliance_id"]}/?datasource=tranquility', headers=headers) except: continue - if killer_alliance_re.status_code != 200 : - continue killer_alliance_json = killer_alliance_re.json() killer_alliance_ticker = '<' + killer_alliance_json['ticker'] + '>' else: diff --git a/EVEBot/src/plugins/map/__init__.py b/EVEBot/src/plugins/map/__init__.py index ef21ad5..79f4c03 100644 --- a/EVEBot/src/plugins/map/__init__.py +++ b/EVEBot/src/plugins/map/__init__.py @@ -44,9 +44,6 @@ async def _(bot: Bot, event: Event): except: await search_map.finish(message=Message('当前网络连接错误,请稍后进行查询!')) return - if esi_re.status_code != 200 : - await search_map.finish(message=Message('当前网络连接错误,请稍后进行查询!')) - return esi_json = esi_re.json() if ('region' not in esi_json) and ('constellation' not in esi_json) and ('solar_system' not in esi_json) : input_lang = 'en' @@ -62,9 +59,6 @@ async def _(bot: Bot, event: Event): except: await search_map.finish(message=Message('当前网络连接错误,请稍后进行查询!')) return - if region_re.status_code != 200 : - await search_map.finish(message=Message('当前网络连接错误,请稍后进行查询!')) - return region_json = region_re.json() region_name = region_json['name'] msg = f'星域: {name} / {region_name}' @@ -75,9 +69,6 @@ async def _(bot: Bot, event: Event): except: await search_map.finish(message=Message('当前网络连接错误,请稍后进行查询!')) return - if constellation_re.status_code != 200 : - await search_map.finish(message=Message('当前网络连接错误,请稍后进行查询!')) - return constellation_json = constellation_re.json() constellation_name = constellation_json['name'] msg = f'星座: {name} / {constellation_name}' @@ -88,9 +79,6 @@ async def _(bot: Bot, event: Event): except: await search_map.finish(message=Message('当前网络连接错误,请稍后进行查询!')) return - if system_re.status_code != 200 : - await search_map.finish(message=Message('当前网络连接错误,请稍后进行查询!')) - return system_json = system_re.json() system_name = system_json['name'] msg = f'星系: {name} / {system_name}' diff --git a/EVEBot/src/plugins/suit/__init__.py b/EVEBot/src/plugins/suit/__init__.py index 2d9af3e..a7c8460 100644 --- a/EVEBot/src/plugins/suit/__init__.py +++ b/EVEBot/src/plugins/suit/__init__.py @@ -72,8 +72,6 @@ async def get_price_all(name: str): marketGroup_re = await client.get(url=f'https://esi.evetech.net/latest/markets/groups/{marketGroupID}/?datasource=tranquility&language=zh', headers=headers) except: return [ '连接服务器失败,请稍后尝试!' ] - if marketGroup_re.status_code != 200 : - return [ '连接服务器失败,请稍后尝试!' ] marketGroup_json = marketGroup_re.json() items = marketGroup_json['types'] @@ -90,8 +88,6 @@ async def get_price_all(name: str): re = await client.get(url=f'https://esi.evetech.net/latest/markets/10000002/orders/?datasource=tranquility&order_type=all&type_id={itemID}', headers=headers) except: return [ '连接服务器失败,请稍后尝试!' ] - if re.status_code != 200 : - return [ '连接服务器失败,请稍后尝试!' ] re_json = re.json() buy = 0 sell = 0 diff --git a/README.md b/README.md index 5db3584..e2669d2 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ * [go-cqhttp](#go-cqhttp-1) * [NoneBot2](#nonebot2-1) - [BUG](#bug) + * [更新版本后提示插件已存在错误](#更新版本后提示插件已存在错误) - [性能](#性能) ## 功能 @@ -288,7 +289,13 @@ python3 bot.py ## BUG +### 更新版本后提示插件已存在错误 +关闭机器人,在 `EVEBot` 目录中执行该命令后启动机器人: + +```shell +find ./ -name __pycache__ | xargs rm -rf +``` ## 性能 From f5d07f221a7950435fea1f8492081603e4782910 Mon Sep 17 00:00:00 2001 From: Amelie Date: Thu, 23 Jun 2022 07:51:07 +0800 Subject: [PATCH 05/13] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E5=91=BD=E4=BB=A4=E7=9A=84=E8=A7=A6=E5=8F=91=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EVEBot/src/plugins/bind/__init__.py | 4 ++-- EVEBot/src/plugins/cmd/__init__.py | 8 ++++---- EVEBot/src/plugins/help/__init__.py | 1 + EVEBot/src/plugins/jita/__init__.py | 2 +- EVEBot/src/plugins/map/__init__.py | 2 +- EVEBot/src/plugins/search/__init__.py | 2 +- EVEBot/src/plugins/settings/__init__.py | 2 +- EVEBot/src/plugins/suit/__init__.py | 2 +- EVEBot/src/plugins/test/__init__.py | 5 +++++ EVEBot/src/plugins/translate/__init__.py | 2 +- 10 files changed, 18 insertions(+), 12 deletions(-) diff --git a/EVEBot/src/plugins/bind/__init__.py b/EVEBot/src/plugins/bind/__init__.py index e8348e8..dc9feac 100644 --- a/EVEBot/src/plugins/bind/__init__.py +++ b/EVEBot/src/plugins/bind/__init__.py @@ -24,7 +24,7 @@ if not bind.bind : bind.bind = {} -bind_function = on_regex(r'^[\.。](bind|绑定)\s*\S+') +bind_function = on_regex(r'^[\.。](bind|绑定) \s*\S+') @bind_function.handle() async def _(bot: Bot, event: Event): global bind @@ -49,7 +49,7 @@ async def _(bot: Bot, event: Event): await bind_function.finish(message=Message('绑定成功')) -unbind_function = on_regex(r'^[\.。](unbind|解绑)\s*\S+') +unbind_function = on_regex(r'^[\.。](unbind|解绑) \s*\S+') @unbind_function.handle() async def _(bot: Bot, event: Event): global bind diff --git a/EVEBot/src/plugins/cmd/__init__.py b/EVEBot/src/plugins/cmd/__init__.py index db4ed7a..5583898 100644 --- a/EVEBot/src/plugins/cmd/__init__.py +++ b/EVEBot/src/plugins/cmd/__init__.py @@ -26,7 +26,7 @@ content = {} file.close() -load = on_regex(r'^[\.。](load|加载)\s*') +load = on_regex(r'^[\.。](load|加载)\s*$') @load.handle() async def _(bot: Bot, event: Event): global content @@ -61,7 +61,7 @@ async def _(bot: Bot, event: Event): else: await load.finish(message=Message(msg)) -cmd = on_regex(r'^[\.。](cmd|a|gl|攻略)\s*\S+') +cmd = on_regex(r'^[\.。](cmd|a|gl|攻略) \s*\S+') @cmd.handle() async def _(bot: Bot, event: Event): global content @@ -87,7 +87,7 @@ async def _(bot: Bot, event: Event): return await cmd.finish(message=Message('标题不正确,请检查标题!')) -list_cmd = on_regex(r'^[\.。](list)\s*') +list_cmd = on_regex(r'^[\.。](list)\s*$') @list_cmd.handle() async def _(bot: Bot, event: Event): global content @@ -97,7 +97,7 @@ async def _(bot: Bot, event: Event): if await util.isPass() or await util.isBan(event.user_id) : return - msg = '关键字列表:\n' + msg = '命令列表:\n' for k, _ in content.items() : msg = msg + k + ' ' diff --git a/EVEBot/src/plugins/help/__init__.py b/EVEBot/src/plugins/help/__init__.py index 339ace9..a3f10e8 100644 --- a/EVEBot/src/plugins/help/__init__.py +++ b/EVEBot/src/plugins/help/__init__.py @@ -32,6 +32,7 @@ async def _(bot: Bot, event: Event): '.tr / .tran / .翻译 <字符串> # 翻译\n' '.kb / .zkb # 查询人物基础信息\n' '.tool / .工具 / .常用 # 常用工具网址\n' + '.map / .地图 # 翻译地图名称\n' '管理员命令:\n' '.bind / .绑定 <别名>,<物品名> \n' '.unbind / .解绑 <别名>\n' diff --git a/EVEBot/src/plugins/jita/__init__.py b/EVEBot/src/plugins/jita/__init__.py index a72ff55..581d7f1 100644 --- a/EVEBot/src/plugins/jita/__init__.py +++ b/EVEBot/src/plugins/jita/__init__.py @@ -11,7 +11,7 @@ bind = pluginR('bind') -jita = on_regex(r'^[\.。](jita|吉他|jt)\s*\S+') +jita = on_regex(r'^[\.。](jita|吉他|jt) \s*\S+') @jita.handle() async def _(bot: Bot, event: Event): global bind diff --git a/EVEBot/src/plugins/map/__init__.py b/EVEBot/src/plugins/map/__init__.py index 79f4c03..438e126 100644 --- a/EVEBot/src/plugins/map/__init__.py +++ b/EVEBot/src/plugins/map/__init__.py @@ -14,7 +14,7 @@ client = httpx.AsyncClient() -search_map = on_regex(r'^[\.。](map|地图)\s*\S+') +search_map = on_regex(r'^[\.。](map|地图) \s*\S+') @search_map.handle() async def _(bot: Bot, event: Event): global bind diff --git a/EVEBot/src/plugins/search/__init__.py b/EVEBot/src/plugins/search/__init__.py index 0219293..61cef3a 100644 --- a/EVEBot/src/plugins/search/__init__.py +++ b/EVEBot/src/plugins/search/__init__.py @@ -10,7 +10,7 @@ util = pluginR('util') -search = on_regex(r'^[\.。](search|搜索)\s*\S+') +search = on_regex(r'^[\.。](search|搜索) \s*\S+') @search.handle() async def _(bot: Bot, event: Event): if not (event.message_type == 'group' and event.group_id in group_ids) : diff --git a/EVEBot/src/plugins/settings/__init__.py b/EVEBot/src/plugins/settings/__init__.py index 443cb2b..0ba2987 100644 --- a/EVEBot/src/plugins/settings/__init__.py +++ b/EVEBot/src/plugins/settings/__init__.py @@ -29,7 +29,7 @@ if 'ban' not in settings.data : settings.data['ban'] = [] -limit = on_regex(r'^[\.。](limit|限制)\s+\S+') +limit = on_regex(r'^[\.。](limit|限制) \s+\S+') @limit.handle() async def _(bot: Bot, event: Event): global util diff --git a/EVEBot/src/plugins/suit/__init__.py b/EVEBot/src/plugins/suit/__init__.py index a7c8460..32c90f0 100644 --- a/EVEBot/src/plugins/suit/__init__.py +++ b/EVEBot/src/plugins/suit/__init__.py @@ -17,7 +17,7 @@ client = httpx.AsyncClient() -suit = on_regex(r'^[\.。](suit)\s*\S+') +suit = on_regex(r'^[\.。](suit) \s*\S+') @suit.handle() async def _(bot: Bot, event: Event): global bind diff --git a/EVEBot/src/plugins/test/__init__.py b/EVEBot/src/plugins/test/__init__.py index 99f2d3e..22f8eed 100644 --- a/EVEBot/src/plugins/test/__init__.py +++ b/EVEBot/src/plugins/test/__init__.py @@ -2,3 +2,8 @@ import nonebot config = nonebot.get_driver().config.dict() ''' + +'''状态码 +if re.status_code != 200 : + return +''' diff --git a/EVEBot/src/plugins/translate/__init__.py b/EVEBot/src/plugins/translate/__init__.py index a3af54f..7f79950 100644 --- a/EVEBot/src/plugins/translate/__init__.py +++ b/EVEBot/src/plugins/translate/__init__.py @@ -11,7 +11,7 @@ bind = pluginR('bind') -tr = on_regex(r'^[\.。](tr|tran|翻译)\s*\S+') +tr = on_regex(r'^[\.。](tr|tran|翻译) \s*\S+') @tr.handle() async def _(bot: Bot, event: Event): if not (event.message_type == 'group' and event.group_id in group_ids) : From ba80c2b06dd58274edbf52f3cde102e2b07f5f34 Mon Sep 17 00:00:00 2001 From: Amelie Date: Thu, 23 Jun 2022 11:01:09 +0800 Subject: [PATCH 06/13] =?UTF-8?q?=E4=B8=BAkm=E6=8F=92=E4=BB=B6=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=8A=A5=E4=BD=8D=E7=BD=AE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EVEBot/src/plugins/km/__init__.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/EVEBot/src/plugins/km/__init__.py b/EVEBot/src/plugins/km/__init__.py index 18aa651..df91355 100644 --- a/EVEBot/src/plugins/km/__init__.py +++ b/EVEBot/src/plugins/km/__init__.py @@ -9,6 +9,7 @@ import httpx import websockets import ssl +import math from pathlib import Path driver=get_driver() @@ -214,7 +215,24 @@ async def km(): region_re = await client.get(url=f'https://esi.evetech.net/latest/universe/regions/{region_id}/?datasource=tranquility&language=zh', headers=headers) region_json = region_re.json() region_name = region_json['name'] - msg = msg + f'位置: {system_name} / {constellation_name} / {region_name}\n' + msg = msg + f'星系: {system_name} / {constellation_name} / {region_name}\n' + moon_id = zkb_json[0]['zkb']['locationID'] + moon_re = await client.get(url=f'https://esi.evetech.net/latest/universe/moons/{moon_id}/?datasource=tranquility', headers=headers) + moon_json = moon_re.json() + moon_name = moon_json['name'] + dx = math.fabs(esi_json['victim']['position']['x'] - moon_json['position']['x']) + dy = math.fabs(esi_json['victim']['position']['y'] - moon_json['position']['y']) + dz = math.fabs(esi_json['victim']['position']['z'] - moon_json['position']['z']) + distance = math.sqrt(dx**2 + dy**2 + dz**2) + if distance >= 149597870700 * 0.1 : + distance = distance / 149597870700 + unit = 'AU' + elif distance >= 1000 : + distance = distance / 1000 + unit = 'km' + else: + unit = 'm' + msg = msg + f'位置: {moon_name} | 距离: {distance:,.2f} {unit}\n' except: pass From d0d46be62e65abcaa9b074875095ed81c62bdbd4 Mon Sep 17 00:00:00 2001 From: Amelie Date: Thu, 23 Jun 2022 15:27:19 +0800 Subject: [PATCH 07/13] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dkm=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EVEBot/src/plugins/km/__init__.py | 37 +++++++++++++++++-------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/EVEBot/src/plugins/km/__init__.py b/EVEBot/src/plugins/km/__init__.py index df91355..3bedf8f 100644 --- a/EVEBot/src/plugins/km/__init__.py +++ b/EVEBot/src/plugins/km/__init__.py @@ -216,23 +216,26 @@ async def km(): region_json = region_re.json() region_name = region_json['name'] msg = msg + f'星系: {system_name} / {constellation_name} / {region_name}\n' - moon_id = zkb_json[0]['zkb']['locationID'] - moon_re = await client.get(url=f'https://esi.evetech.net/latest/universe/moons/{moon_id}/?datasource=tranquility', headers=headers) - moon_json = moon_re.json() - moon_name = moon_json['name'] - dx = math.fabs(esi_json['victim']['position']['x'] - moon_json['position']['x']) - dy = math.fabs(esi_json['victim']['position']['y'] - moon_json['position']['y']) - dz = math.fabs(esi_json['victim']['position']['z'] - moon_json['position']['z']) - distance = math.sqrt(dx**2 + dy**2 + dz**2) - if distance >= 149597870700 * 0.1 : - distance = distance / 149597870700 - unit = 'AU' - elif distance >= 1000 : - distance = distance / 1000 - unit = 'km' - else: - unit = 'm' - msg = msg + f'位置: {moon_name} | 距离: {distance:,.2f} {unit}\n' + try: + moon_id = zkb_json[0]['zkb']['locationID'] + moon_re = await client.get(url=f'https://esi.evetech.net/latest/universe/moons/{moon_id}/?datasource=tranquility', headers=headers) + moon_json = moon_re.json() + moon_name = moon_json['name'] + dx = math.fabs(esi_json['victim']['position']['x'] - moon_json['position']['x']) + dy = math.fabs(esi_json['victim']['position']['y'] - moon_json['position']['y']) + dz = math.fabs(esi_json['victim']['position']['z'] - moon_json['position']['z']) + distance = math.sqrt(dx**2 + dy**2 + dz**2) + if distance >= 149597870700 * 0.1 : + distance = distance / 149597870700 + unit = 'AU' + elif distance >= 1000 : + distance = distance / 1000 + unit = 'km' + else: + unit = 'm' + msg = msg + f'位置: {moon_name} | 距离: {distance:,.2f} {unit}\n' + except: + pass except: pass From 6d2a5eb2428f075fca1ef7bcf1a0e7eb9b294031 Mon Sep 17 00:00:00 2001 From: Amelie Date: Sat, 25 Jun 2022 16:09:18 +0800 Subject: [PATCH 08/13] =?UTF-8?q?=E5=A2=9E=E5=8A=A0km=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E4=BA=A7=E7=94=9F=E7=9A=84=E9=94=99=E8=AF=AF=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E5=88=B0=E6=97=A5=E5=BF=97=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EVEBot/src/plugins/km/__init__.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/EVEBot/src/plugins/km/__init__.py b/EVEBot/src/plugins/km/__init__.py index 3bedf8f..709dafc 100644 --- a/EVEBot/src/plugins/km/__init__.py +++ b/EVEBot/src/plugins/km/__init__.py @@ -3,6 +3,8 @@ from nonebot.adapters.cqhttp import Event, Bot, Message import nonebot from nonebot.plugin import require as pluginR +from nonebot.log import logger +import sys import time import json import asyncio @@ -72,6 +74,7 @@ async def km(): try: re = await websocket.recv() except: + logger.error(f'websocket.recv() 错误 文件:{__file__} 行号:{sys._getframe().f_lineno}') break new_time = time.time() @@ -98,6 +101,7 @@ async def km(): try: zkb_re = await client.get(url=f'https://zkillboard.com/api/killID/{killID}/') except: + logger.error(f'文件:{__file__} 行号:{sys._getframe().f_lineno}') continue zkb_json = zkb_re.json() @@ -111,6 +115,7 @@ async def km(): try: esi_re = await client.get(url=f'https://esi.evetech.net/latest/killmails/{killID}/{killHash}/?datasource=tranquility') except: + logger.error(f'文件:{__file__} 行号:{sys._getframe().f_lineno}') continue esi_json = esi_re.json() @@ -129,6 +134,7 @@ async def km(): try: ship_re = await client.get(url=f'https://esi.evetech.net/latest/universe/types/{ship_type_id}/?datasource=tranquility&language=zh', headers=headers) except: + logger.error(f'文件:{__file__} 行号:{sys._getframe().f_lineno}') continue ship_json = ship_re.json() ship_name = ship_json['name'] @@ -142,6 +148,7 @@ async def km(): try: dead_re = await client.get(url=f'https://esi.evetech.net/latest/characters/{dead_id}/?datasource=tranquility', headers=headers) except: + logger.error(f'文件:{__file__} 行号:{sys._getframe().f_lineno}') continue dead_json = dead_re.json() dead_name = dead_json['name'] @@ -149,6 +156,7 @@ async def km(): try: dead_corporation_re = await client.get(url=f'https://esi.evetech.net/latest/corporations/{dead_json["corporation_id"]}/?datasource=tranquility', headers=headers) except: + logger.error(f'文件:{__file__} 行号:{sys._getframe().f_lineno}') continue dead_corporation_json = dead_corporation_re.json() dead_corporation_ticker = '[' + dead_corporation_json['ticker'] + ']' @@ -156,6 +164,7 @@ async def km(): try: dead_alliance_re = await client.get(url=f'https://esi.evetech.net/latest/alliances/{dead_json["alliance_id"]}/?datasource=tranquility', headers=headers) except: + logger.error(f'文件:{__file__} 行号:{sys._getframe().f_lineno}') continue dead_alliance_json = dead_alliance_re.json() dead_alliance_ticker = '<' + dead_alliance_json['ticker'] + '>' @@ -177,6 +186,7 @@ async def km(): try: killer_re = await client.get(url=f'https://esi.evetech.net/latest/characters/{killer_id}/?datasource=tranquility', headers=headers) except: + logger.error(f'文件:{__file__} 行号:{sys._getframe().f_lineno}') continue killer_json = killer_re.json() killer_name = killer_json['name'] @@ -184,6 +194,7 @@ async def km(): try: killer_corporation_re = await client.get(url=f'https://esi.evetech.net/latest/corporations/{killer_json["corporation_id"]}/?datasource=tranquility', headers=headers) except: + logger.error(f'文件:{__file__} 行号:{sys._getframe().f_lineno}') continue killer_corporation_json = killer_corporation_re.json() killer_corporation_ticker = '[' + killer_corporation_json['ticker'] + ']' @@ -193,6 +204,7 @@ async def km(): try: killer_alliance_re = await client.get(url=f'https://esi.evetech.net/latest/alliances/{killer_json["alliance_id"]}/?datasource=tranquility', headers=headers) except: + logger.error(f'文件:{__file__} 行号:{sys._getframe().f_lineno}') continue killer_alliance_json = killer_alliance_re.json() killer_alliance_ticker = '<' + killer_alliance_json['ticker'] + '>' From 88bd926b844f6f82f79ee5fd81c77a629c098d99 Mon Sep 17 00:00:00 2001 From: Amelie Date: Sat, 25 Jun 2022 16:26:44 +0800 Subject: [PATCH 09/13] =?UTF-8?q?=E8=B0=83=E6=95=B4km=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E7=9A=84=E8=BE=93=E5=87=BA=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EVEBot/src/plugins/km/__init__.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/EVEBot/src/plugins/km/__init__.py b/EVEBot/src/plugins/km/__init__.py index 709dafc..9321cfa 100644 --- a/EVEBot/src/plugins/km/__init__.py +++ b/EVEBot/src/plugins/km/__init__.py @@ -101,7 +101,7 @@ async def km(): try: zkb_re = await client.get(url=f'https://zkillboard.com/api/killID/{killID}/') except: - logger.error(f'文件:{__file__} 行号:{sys._getframe().f_lineno}') + logger.error(f'文件:{__file__} 行号:{sys._getframe().f_lineno} killID:{killID}') continue zkb_json = zkb_re.json() @@ -115,7 +115,7 @@ async def km(): try: esi_re = await client.get(url=f'https://esi.evetech.net/latest/killmails/{killID}/{killHash}/?datasource=tranquility') except: - logger.error(f'文件:{__file__} 行号:{sys._getframe().f_lineno}') + logger.error(f'文件:{__file__} 行号:{sys._getframe().f_lineno} killID:{killID}') continue esi_json = esi_re.json() @@ -134,7 +134,7 @@ async def km(): try: ship_re = await client.get(url=f'https://esi.evetech.net/latest/universe/types/{ship_type_id}/?datasource=tranquility&language=zh', headers=headers) except: - logger.error(f'文件:{__file__} 行号:{sys._getframe().f_lineno}') + logger.error(f'文件:{__file__} 行号:{sys._getframe().f_lineno} killID:{killID}') continue ship_json = ship_re.json() ship_name = ship_json['name'] @@ -148,7 +148,7 @@ async def km(): try: dead_re = await client.get(url=f'https://esi.evetech.net/latest/characters/{dead_id}/?datasource=tranquility', headers=headers) except: - logger.error(f'文件:{__file__} 行号:{sys._getframe().f_lineno}') + logger.error(f'文件:{__file__} 行号:{sys._getframe().f_lineno} killID:{killID}') continue dead_json = dead_re.json() dead_name = dead_json['name'] @@ -156,7 +156,7 @@ async def km(): try: dead_corporation_re = await client.get(url=f'https://esi.evetech.net/latest/corporations/{dead_json["corporation_id"]}/?datasource=tranquility', headers=headers) except: - logger.error(f'文件:{__file__} 行号:{sys._getframe().f_lineno}') + logger.error(f'文件:{__file__} 行号:{sys._getframe().f_lineno} killID:{killID}') continue dead_corporation_json = dead_corporation_re.json() dead_corporation_ticker = '[' + dead_corporation_json['ticker'] + ']' @@ -164,7 +164,7 @@ async def km(): try: dead_alliance_re = await client.get(url=f'https://esi.evetech.net/latest/alliances/{dead_json["alliance_id"]}/?datasource=tranquility', headers=headers) except: - logger.error(f'文件:{__file__} 行号:{sys._getframe().f_lineno}') + logger.error(f'文件:{__file__} 行号:{sys._getframe().f_lineno} killID:{killID}') continue dead_alliance_json = dead_alliance_re.json() dead_alliance_ticker = '<' + dead_alliance_json['ticker'] + '>' @@ -186,7 +186,7 @@ async def km(): try: killer_re = await client.get(url=f'https://esi.evetech.net/latest/characters/{killer_id}/?datasource=tranquility', headers=headers) except: - logger.error(f'文件:{__file__} 行号:{sys._getframe().f_lineno}') + logger.error(f'文件:{__file__} 行号:{sys._getframe().f_lineno} killID:{killID}') continue killer_json = killer_re.json() killer_name = killer_json['name'] @@ -194,7 +194,7 @@ async def km(): try: killer_corporation_re = await client.get(url=f'https://esi.evetech.net/latest/corporations/{killer_json["corporation_id"]}/?datasource=tranquility', headers=headers) except: - logger.error(f'文件:{__file__} 行号:{sys._getframe().f_lineno}') + logger.error(f'文件:{__file__} 行号:{sys._getframe().f_lineno} killID:{killID}') continue killer_corporation_json = killer_corporation_re.json() killer_corporation_ticker = '[' + killer_corporation_json['ticker'] + ']' @@ -204,7 +204,7 @@ async def km(): try: killer_alliance_re = await client.get(url=f'https://esi.evetech.net/latest/alliances/{killer_json["alliance_id"]}/?datasource=tranquility', headers=headers) except: - logger.error(f'文件:{__file__} 行号:{sys._getframe().f_lineno}') + logger.error(f'文件:{__file__} 行号:{sys._getframe().f_lineno} killID:{killID}') continue killer_alliance_json = killer_alliance_re.json() killer_alliance_ticker = '<' + killer_alliance_json['ticker'] + '>' From 49e295c9b425517d10664ba77d083bc157e8ee61 Mon Sep 17 00:00:00 2001 From: Amelie Date: Sun, 26 Jun 2022 12:46:54 +0800 Subject: [PATCH 10/13] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E7=89=A9=E5=93=81=E5=90=8D=E7=9A=84=E4=B8=AD=E8=8B=B1=E6=96=87?= =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=88=B0Excel=E7=9A=84=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Tools/README.md | 9 +++++++++ Tools/itemname_translate.py | 20 ++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 Tools/itemname_translate.py diff --git a/Tools/README.md b/Tools/README.md index a7c7360..99380a7 100644 --- a/Tools/README.md +++ b/Tools/README.md @@ -30,3 +30,12 @@ pip3 install pillow python3 pic_resize.py ``` +## `itemname_translate.py` + +使用前需要安装 python 包: + +```shell +pip3 install pandas openpyxl +``` + +解析 `typeIDs.yaml` 文件,导出到 `物品名中英对照表.xlsx` Excel 表格文件 diff --git a/Tools/itemname_translate.py b/Tools/itemname_translate.py new file mode 100644 index 0000000..072e1f3 --- /dev/null +++ b/Tools/itemname_translate.py @@ -0,0 +1,20 @@ +import pandas as pd +import yaml + +old_file = open('typeIDs.yaml', 'r', encoding='utf-8') +old_data = yaml.load(old_file.read(), Loader=yaml.FullLoader) +old_file.close() + +new_data = [] + +i = 0 + +for k, v in old_data.items() : + node = { 'id': k, 'en': v['name']['en'] } + if 'zh' in v['name'] : + node['zh'] = v['name']['zh'] + new_data.append(node) + i = i + 1 + +out = pd.DataFrame(new_data) +out.to_excel('物品名中英对照表.xlsx', encoding='utf-8', index=False) \ No newline at end of file From 4462ea887467cebdb51b478491cf1d30f57e7760 Mon Sep 17 00:00:00 2001 From: Amelie Date: Sun, 26 Jun 2022 12:49:11 +0800 Subject: [PATCH 11/13] =?UTF-8?q?=E7=B2=BE=E7=AE=80=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Tools/itemname_translate.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/Tools/itemname_translate.py b/Tools/itemname_translate.py index 072e1f3..0060679 100644 --- a/Tools/itemname_translate.py +++ b/Tools/itemname_translate.py @@ -7,14 +7,11 @@ new_data = [] -i = 0 - for k, v in old_data.items() : node = { 'id': k, 'en': v['name']['en'] } if 'zh' in v['name'] : node['zh'] = v['name']['zh'] new_data.append(node) - i = i + 1 out = pd.DataFrame(new_data) out.to_excel('物品名中英对照表.xlsx', encoding='utf-8', index=False) \ No newline at end of file From 0c1c6239fd118b73a15fbe81bb355983d166cd19 Mon Sep 17 00:00:00 2001 From: Amelie Date: Sun, 26 Jun 2022 12:50:51 +0800 Subject: [PATCH 12/13] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Tools/itemname_translate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/itemname_translate.py b/Tools/itemname_translate.py index 0060679..0f4f78a 100644 --- a/Tools/itemname_translate.py +++ b/Tools/itemname_translate.py @@ -14,4 +14,4 @@ new_data.append(node) out = pd.DataFrame(new_data) -out.to_excel('物品名中英对照表.xlsx', encoding='utf-8', index=False) \ No newline at end of file +out.to_excel('物品名中英对照表.xlsx', encoding='utf-8', index=False) From 9319407d903070c611accea1df28781eaab9971d Mon Sep 17 00:00:00 2001 From: Amelie Date: Sun, 26 Jun 2022 13:05:40 +0800 Subject: [PATCH 13/13] =?UTF-8?q?=E6=9B=B4=E6=96=B0README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Tools/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Tools/README.md b/Tools/README.md index 99380a7..110a546 100644 --- a/Tools/README.md +++ b/Tools/README.md @@ -39,3 +39,6 @@ pip3 install pandas openpyxl ``` 解析 `typeIDs.yaml` 文件,导出到 `物品名中英对照表.xlsx` Excel 表格文件 + +因为数据量庞大,所以执行时间很长,需要5分钟左右 +