forked from KilluaSakata/Kiba
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Killua-Blitz
authored and
Killua-Blitz
committed
Feb 18, 2022
1 parent
22f0639
commit 1cc6dc5
Showing
19 changed files
with
2,174 additions
and
480 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"ExpandedNodes": [ | ||
"" | ||
], | ||
"SelectedNode": "\\D:\\Source\\Kiba", | ||
"PreviewInSolutionExplorer": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>{c6a8b0a4-7c95-46ce-9835-6f398dbcd044}</ProjectGuid> | ||
<ProjectHome /> | ||
<StartupFile>bot.py</StartupFile> | ||
<SearchPath /> | ||
<WorkingDirectory>.</WorkingDirectory> | ||
<OutputPath>.</OutputPath> | ||
<ProjectTypeGuids>{888888a0-9f3d-457c-b088-3a5042f75d52}</ProjectTypeGuids> | ||
<LaunchProvider>Standard Python launcher</LaunchProvider> | ||
<InterpreterId /> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)' == 'Debug'" /> | ||
<PropertyGroup Condition="'$(Configuration)' == 'Release'" /> | ||
<PropertyGroup> | ||
<VisualStudioVersion Condition=" '$(VisualStudioVersion)' == '' ">10.0</VisualStudioVersion> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Content Include="requirements.txt" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="bot.py" /> | ||
<Compile Include="src\libraries\arcapi.py" /> | ||
<Compile Include="src\libraries\arcdraw.py" /> | ||
<Compile Include="src\libraries\arcsql.py" /> | ||
<Compile Include="src\libraries\config.py" /> | ||
<Compile Include="src\libraries\gosen_choyen.py" /> | ||
<Compile Include="src\libraries\image.py" /> | ||
<Compile Include="src\libraries\img_template.py" /> | ||
<Compile Include="src\libraries\maimaidx_guess.py" /> | ||
<Compile Include="src\libraries\maimaidx_music.py" /> | ||
<Compile Include="src\libraries\maimai_best_40.py" /> | ||
<Compile Include="src\libraries\maimai_plate.py" /> | ||
<Compile Include="src\libraries\tool.py" /> | ||
<Compile Include="src\plugins\arcaea.py" /> | ||
<Compile Include="src\plugins\coc.py" /> | ||
<Compile Include="src\plugins\database.py" /> | ||
<Compile Include="src\plugins\groupadmin.py" /> | ||
<Compile Include="src\plugins\guild.py" /> | ||
<Compile Include="src\plugins\image.py" /> | ||
<Compile Include="src\plugins\maimaidx.py" /> | ||
<Compile Include="src\plugins\majsoul.py" /> | ||
<Compile Include="src\plugins\public.py" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Folder Include="src\" /> | ||
<Folder Include="src\libraries" /> | ||
<Folder Include="src\plugins" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import aiohttp, websockets, json, brotli | ||
|
||
url = 'https://webapi.lowiro.com/' | ||
me = 'webapi/user/me' | ||
login = 'auth/login' | ||
est = 'wss://arc.estertion.win:616/' | ||
|
||
async def get_web_api(email, password): | ||
data = {'email': email, 'password': password} | ||
async with aiohttp.ClientSession() as session: | ||
async with session.post(url + login, data=data) as req: | ||
if req.status != 200: | ||
return '▿ Kiba - ArcAPI\n查询用账号异常,请联系 Kiba 超级管理员' | ||
async with session.get(url + me) as reqs: | ||
return await reqs.json() | ||
|
||
async def arcb30(arcid: str, re: bool = False): | ||
try: | ||
b30_data = [] | ||
async with websockets.connect(est, timeout=10) as ws: | ||
await ws.send(str(arcid)) | ||
while True: | ||
if ws.closed: | ||
break | ||
data = await ws.recv() | ||
if data == 'error,add': | ||
return '▿ Kiba - ArcAPI\n连接查分器错误。' | ||
elif data == 'bye': | ||
return b30_data | ||
elif isinstance(data, bytes): | ||
info = json.loads(brotli.decompress(data)) | ||
if info['cmd'] == 'userinfo' and re: | ||
return info | ||
elif info['cmd'] == 'scores' or info['cmd'] == 'userinfo': | ||
b30_data.append(info) | ||
except websockets.ConnectionClosedError as e: | ||
return '▿ Kiba - ArcAPI\n当前可能在排队,请您暂时停用 <arcinfo> 和 <arcre:> 指令。' | ||
except Exception as e: | ||
return f'▿ Kiba - ArcAPI\n查询失败。可能是网络数据库连接有问题,请检查是否正在版本更新?\n[Exception Occurred]\n{e}' |
Oops, something went wrong.