Skip to content

Commit

Permalink
新增 QQ官方/沙盒/V2 账号类型
Browse files Browse the repository at this point in the history
  • Loading branch information
lunzhiPenxil committed Jul 5, 2024
1 parent 458363b commit d08afa5
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
12 changes: 10 additions & 2 deletions OlivOS/adapter/qqGuild/qqGuildv2SDK.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,12 @@ def __init__(self, bot_info:bot_info_T, intents=(int(intents_T.GUILDS) | int(int
if bot_info.model == 'private':
tmp_intents |= int(intents_T.GUILD_MESSAGES)
#tmp_intents |= int(intents_T.QQ_MESSAGES)
elif bot_info.model == 'public':
elif bot_info.model == ['public', 'sandbox']:
tmp_intents |= int(intents_T.PUBLIC_GUILD_MESSAGES)
tmp_intents |= int(intents_T.PUBLIC_QQ_MESSAGES)
elif bot_info.model == 'public_guild_only':
tmp_intents |= int(intents_T.PUBLIC_GUILD_MESSAGES)
elif bot_info.model in ['private_intents', 'public_intents']:
elif bot_info.model in ['private_intents', 'public_intents', 'sandbox_intents']:
tmp_intents = bot_info.intents
payload_template.__init__(self)
self.data.op = 2
Expand Down Expand Up @@ -232,8 +232,15 @@ def __init__(self):
self.route = None
self.res = None

def __switch_host(self):
global sdkAPIHost
if self.bot_info.model in ['sandbox', 'sandbox_intents']:
if self.host == sdkAPIHost['default']:
self.host = sdkAPIHost['sandbox']

def do_api_plant(self, req_type='POST'):
try:
self.__switch_host()
tmp_payload_dict = {}
tmp_sdkAPIRouteTemp = sdkAPIRouteTemp.copy()
if self.metadata is not None:
Expand Down Expand Up @@ -264,6 +271,7 @@ def do_api_plant(self, req_type='POST'):

def do_api(self, req_type='POST'):
try:
self.__switch_host()
tmp_payload_dict = {}
tmp_sdkAPIRouteTemp = sdkAPIRouteTemp.copy()
if self.metadata is not None:
Expand Down
6 changes: 5 additions & 1 deletion OlivOS/core/core/messageAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,12 @@
},
'qqGuildv2_link': {
'default': 'olivos_para',
'sandbox': 'olivos_para',
'sandbox_intents': 'olivos_para',
'private': 'olivos_para',
'public': 'olivos_para'
'private_intents': 'olivos_para',
'public': 'olivos_para',
'public_intents': 'olivos_para'
}
},
'telegram': {
Expand Down
18 changes: 17 additions & 1 deletion OlivOS/nativeGUI/multiLoginUIAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,8 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non
'QQ官方/公域/V2/指定intents',
'QQ官方/私域/V2',
'QQ官方/私域/V2/指定intents',
'QQ官方/沙盒/V2',
'QQ官方/沙盒/V2/指定intents',
'QQ官方/公域/V1',
'QQ官方/私域/V1',
'Discord',
Expand Down Expand Up @@ -710,6 +712,17 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non
'intents': 'edit_root_Entry_Server_port'
}
],
'QQ官方/沙盒/V2': ['qqGuild', 'qqGuildv2_link', 'sandbox', 'True', 'websocket', {
'AppID': 'edit_root_Entry_ID',
'AppSecret': 'edit_root_Entry_Server_access_token'
}
],
'QQ官方/沙盒/V2/指定intents': ['qqGuild', 'qqGuildv2_link', 'sandbox_intents', 'True', 'websocket', {
'AppID': 'edit_root_Entry_ID',
'AppSecret': 'edit_root_Entry_Server_access_token',
'intents': 'edit_root_Entry_Server_port'
}
],
'Telegram': ['telegram', 'telegram_poll', 'default', 'True', 'post', {
'TOKEN': 'edit_root_Entry_Server_access_token'
}
Expand Down Expand Up @@ -891,6 +904,8 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non
'public_intents',
'private',
'private_intents',
'sandbox',
'sandbox_intents',
'default'
]
},
Expand Down Expand Up @@ -1046,7 +1061,8 @@ def tree_edit_commit(self):
tmp_host = 'NONEED'
if tmp_platform_model not in [
'public_intents',
'private_intents'
'private_intents',
'sandbox_intents'
]:
if tmp_port == '':
tmp_port = '0'
Expand Down

0 comments on commit d08afa5

Please sign in to comment.