Compare commits
No commits in common. "6de8b46cc8c6b7bb82f249cd864b61937ce5a3ff" and "51011ec401ee07fe7446b24fad680a629e12ff56" have entirely different histories.
6de8b46cc8
...
51011ec401
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -2,8 +2,4 @@
|
||||||
config.toml
|
config.toml
|
||||||
.vs
|
.vs
|
||||||
.vscode
|
.vscode
|
||||||
<<<<<<< HEAD
|
__pycache__
|
||||||
.idea
|
|
||||||
=======
|
|
||||||
__pycache__
|
|
||||||
>>>>>>> 51011ec401ee07fe7446b24fad680a629e12ff56
|
|
3
.idea/.gitignore
vendored
3
.idea/.gitignore
vendored
|
@ -1,3 +0,0 @@
|
||||||
# 默认忽略的文件
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="PYTHON_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<content url="file://$MODULE_DIR$" />
|
|
||||||
<orderEntry type="jdk" jdkName="Python 3.9 (2)" jdkType="Python SDK" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
|
@ -1,6 +0,0 @@
|
||||||
<component name="InspectionProjectProfileManager">
|
|
||||||
<settings>
|
|
||||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
|
||||||
<version value="1.0" />
|
|
||||||
</settings>
|
|
||||||
</component>
|
|
|
@ -1,4 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (2)" project-jdk-type="Python SDK" />
|
|
||||||
</project>
|
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/icalingua-python-bot.iml" filepath="$PROJECT_DIR$/.idea/icalingua-python-bot.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
20
connect.py
20
connect.py
|
@ -191,6 +191,7 @@ async def add_message(data: Dict[str, Any]):
|
||||||
sender_id = data['message']['senderId']
|
sender_id = data['message']['senderId']
|
||||||
content = data['message']['content']
|
content = data['message']['content']
|
||||||
room_id = data['roomId']
|
room_id = data['roomId']
|
||||||
|
reply = ReplyMessage(id=data['message']['_id'])
|
||||||
|
|
||||||
if not is_self:
|
if not is_self:
|
||||||
if data.get('message').get('content') == '/bot':
|
if data.get('message').get('content') == '/bot':
|
||||||
|
@ -208,7 +209,7 @@ async def add_message(data: Dict[str, Any]):
|
||||||
# else:
|
# else:
|
||||||
# message = Message(content=f"此服务器空无一人",room_id=data['roomId'])
|
# 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())
|
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")
|
server = JavaServer.lookup("192.168.1.6:25565")
|
||||||
query = server.query()
|
query = server.query()
|
||||||
players = query.players.names
|
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())
|
await sio.emit('sendMessage', message.to_json())
|
||||||
|
|
||||||
|
@ -224,18 +225,20 @@ async def add_message(data: Dict[str, Any]):
|
||||||
|
|
||||||
ctypet = content[len("!!hitokoto "):]
|
ctypet = content[len("!!hitokoto "):]
|
||||||
if content == "!!hitokoto":
|
if content == "!!hitokoto":
|
||||||
result_code, result_data = hitokoto.hitokoto("没有")
|
result_code, result_data, result_type= hitokoto.hitokoto(None)
|
||||||
else:
|
else:
|
||||||
result_code, result_data = hitokoto.hitokoto(ctypet)
|
result_code, result_data, result_type= hitokoto.hitokoto(ctypet)
|
||||||
|
|
||||||
if result_code == 3:
|
if result_code == 3:
|
||||||
message = Message(content=f"参数不对哦!",room_id=data['roomId'])
|
message = Message(content=f"参数不对哦!你可以输入!!hitokoto help查看帮助",reply_to=reply,room_id=data['roomId'])
|
||||||
elif result_code == 2:
|
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 抖机灵",reply_to=reply,room_id=data['roomId'])
|
||||||
elif result_code == 0:
|
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_data['from']}\n类型:{result_type}",reply_to=reply,room_id=data['roomId'])
|
||||||
else:
|
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())
|
await sio.emit('sendMessage', message.to_json())
|
||||||
|
|
||||||
|
@ -277,7 +280,6 @@ async def add_message(data: Dict[str, Any]):
|
||||||
randomer = random.Random(f'{sender_id}-{data["message"]["date"]}-jrrp-v2')
|
randomer = random.Random(f'{sender_id}-{data["message"]["date"]}-jrrp-v2')
|
||||||
result = randomer.randint(0, 50) + randomer.randint(0, 50)
|
result = randomer.randint(0, 50) + randomer.randint(0, 50)
|
||||||
print(f'{sender_name} 今日人品值为 {result}')
|
print(f'{sender_name} 今日人品值为 {result}')
|
||||||
reply = ReplyMessage(id=data['message']['_id'])
|
|
||||||
message = Message(content=f'{sender_name} 今日人品值为 {result}',
|
message = Message(content=f'{sender_name} 今日人品值为 {result}',
|
||||||
reply_to=reply,
|
reply_to=reply,
|
||||||
room_id=room_id)
|
room_id=room_id)
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import requests
|
import requests
|
||||||
import random
|
import random
|
||||||
|
|
||||||
|
|
||||||
def hitokoto(ctypet):
|
def hitokoto(ctypet):
|
||||||
|
|
||||||
result_type = None
|
result_type = None
|
||||||
|
@ -18,7 +17,6 @@ def hitokoto(ctypet):
|
||||||
ctype = 'd'
|
ctype = 'd'
|
||||||
elif ctypet == '原创' or ctypet == 'e':
|
elif ctypet == '原创' or ctypet == 'e':
|
||||||
ctype = 'e'
|
ctype = 'e'
|
||||||
elif ctypet == '网络' or ctypet == 'f':
|
|
||||||
elif ctypet == '来自网络' or ctypet == 'f':
|
elif ctypet == '来自网络' or ctypet == 'f':
|
||||||
ctype = 'f'
|
ctype = 'f'
|
||||||
elif ctypet == '其他' or ctypet == 'g':
|
elif ctypet == '其他' or ctypet == 'g':
|
||||||
|
@ -33,15 +31,6 @@ def hitokoto(ctypet):
|
||||||
ctype = 'k'
|
ctype = 'k'
|
||||||
elif ctypet == '抖机灵' or ctypet == 'l':
|
elif ctypet == '抖机灵' or ctypet == 'l':
|
||||||
ctype = '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
|
|
||||||
elif ctypet == None:
|
elif ctypet == None:
|
||||||
ctype = random.choice('abcdefghijkl')
|
ctype = random.choice('abcdefghijkl')
|
||||||
elif ctypet == 'help':
|
elif ctypet == 'help':
|
||||||
|
@ -52,11 +41,6 @@ def hitokoto(ctypet):
|
||||||
params_value = {'c': ctype}
|
params_value = {'c': ctype}
|
||||||
hitokoto = requests.get('https://v1.hitokoto.cn', params=params_value)
|
hitokoto = requests.get('https://v1.hitokoto.cn', params=params_value)
|
||||||
|
|
||||||
return 0, hitokoto.json()
|
|
||||||
|
|
||||||
except IOError:
|
|
||||||
return 2, None
|
|
||||||
|
|
||||||
htype=hitokoto.json()['type']
|
htype=hitokoto.json()['type']
|
||||||
if htype=='a':
|
if htype=='a':
|
||||||
result_type = '动画'
|
result_type = '动画'
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -1,15 +0,0 @@
|
||||||
import time
|
|
||||||
import random
|
|
||||||
import asyncio
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
from typing import Dict, List, Tuple, Any, Optional, Union, Literal
|
|
||||||
|
|
||||||
import qtoml
|
|
||||||
import socketio
|
|
||||||
from colorama import Fore, Style
|
|
||||||
from nacl.signing import SigningKey
|
|
||||||
from lib_not_dr.types import Options
|
|
||||||
from mcstatus import JavaServer
|
|
||||||
|
|
||||||
def mcstatus():
|
|
|
@ -3,9 +3,5 @@ colorama
|
||||||
qtoml
|
qtoml
|
||||||
pynacl
|
pynacl
|
||||||
python-socketio[asyncio_client]
|
python-socketio[asyncio_client]
|
||||||
<<<<<<< HEAD
|
|
||||||
mcstatus
|
mcstatus
|
||||||
=======
|
requests
|
||||||
mcstatus
|
|
||||||
requests
|
|
||||||
>>>>>>> 51011ec401ee07fe7446b24fad680a629e12ff56
|
|
Loading…
Reference in New Issue
Block a user