Skip to content

Commit

Permalink
KOOK消息兼容模式可选
Browse files Browse the repository at this point in the history
  • Loading branch information
lunzhiPenxil committed Nov 1, 2023
1 parent 28c1845 commit c07548d
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 8 deletions.
4 changes: 3 additions & 1 deletion OlivOS/dodoLinkSDK.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ def get_SDK_bot_info_from_Event(target_event):
class event(object):
def __init__(self, payload_obj=None, bot_info=None):
self.payload = payload_obj
self.platform = bot_info.platform
self.platform = {'sdk': 'dodo_link', 'platform': 'dodo', 'model': 'default'}
if type(bot_info.platform) is dict:
self.platform.update(bot_info.platform)
self.active = False
if self.payload is not None:
self.active = True
Expand Down
11 changes: 10 additions & 1 deletion OlivOS/kaiheilaSDK.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ class event(object):
def __init__(self, payload_obj=None, bot_info=None):
self.payload = payload_obj
self.platform = {'sdk': 'kaiheila_link', 'platform': 'kaiheila', 'model': 'default'}
if type(bot_info.platform) is dict:
self.platform.update(bot_info.platform)
self.active = False
if self.payload is not None:
self.active = True
Expand Down Expand Up @@ -569,7 +571,14 @@ def get_Event_from_SDK(target_event):

# 支持OlivOS API调用的方法实现
class event_action(object):
def send_msg(target_event, chat_id, message, flag_direct=False, message_type='card'):
def send_msg(target_event, chat_id, message, flag_direct=False, message_type_in='card'):
message_type = message_type_in
if target_event is not None:
if target_event.bot_info.platform['model'] != 'default':
if target_event.bot_info.platform['model'] == 'text':
message_type = 'text'
elif target_event.bot_info.platform['model'] == 'card':
message_type = 'card'
if message_type not in ['text', 'card']:
message_type = 'card'
this_msg = None
Expand Down
4 changes: 3 additions & 1 deletion OlivOS/messageAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@
},
'kaiheila': {
'kaiheila_link': {
'default': 'olivos_para'
'default': 'olivos_para',
'card': 'olivos_para',
'text': 'olivos_para'
}
},
'discord': {
Expand Down
17 changes: 12 additions & 5 deletions OlivOS/multiLoginUIAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,10 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non
'edit_root_Entry_qsign_num': 1,
'edit_root_Combobox_dict': {
'type_list': [
'开黑啦/KOOK',
'KOOK',
'KOOK/消息兼容',
'钉钉',
'渡渡语音/Dodo',
'渡渡语音/Dodo/V2',
'渡渡语音/Dodo/V1',
'QQ频道/公域',
'QQ频道/私域',
Expand Down Expand Up @@ -554,7 +555,11 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non
'微信号': 'edit_root_Entry_ID'
}
],
'开黑啦/KOOK': ['kaiheila', 'kaiheila_link', 'default', 'True', 'websocket', {
'KOOK': ['kaiheila', 'kaiheila_link', 'default', 'True', 'websocket', {
'Token': 'edit_root_Entry_Server_access_token'
}
],
'KOOK/消息兼容': ['kaiheila', 'kaiheila_link', 'text', 'True', 'websocket', {
'Token': 'edit_root_Entry_Server_access_token'
}
],
Expand Down Expand Up @@ -584,7 +589,7 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non
'TOKEN': 'edit_root_Entry_Server_access_token'
}
],
'渡渡语音/Dodo': ['dodo', 'dodo_link', 'default', 'True', 'websocket', {
'渡渡语音/Dodo/V2': ['dodo', 'dodo_link', 'default', 'True', 'websocket', {
'BotID': 'edit_root_Entry_ID',
'Bot私钥': 'edit_root_Entry_Server_access_token'
}
Expand Down Expand Up @@ -728,7 +733,9 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non
},
'kaiheila': {
'kaiheila_link': [
'default'
'default',
'card',
'text'
]
},
'telegram': {
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@
<p align="center">
<a href="https://doc.olivos.wiki/">文档</a>
·
<a href="https://forum.olivos.run/">论坛</a>
·
<a href="https://github.com/OlivOS-Team/OlivOS/releases">下载</a>
·
<a href="https://afdian.net/a/OlivOS">赞助</a>
</p>

</div>
Expand Down

0 comments on commit c07548d

Please sign in to comment.