diff --git a/OlivOS/adapter/qqGuild/qqGuildv2SDK.py b/OlivOS/adapter/qqGuild/qqGuildv2SDK.py index 210ea446..6206e5bd 100644 --- a/OlivOS/adapter/qqGuild/qqGuildv2SDK.py +++ b/OlivOS/adapter/qqGuild/qqGuildv2SDK.py @@ -75,22 +75,23 @@ class intents_T(IntEnum): class bot_info_T(object): - def __init__(self, id=-1, access_token=None, model='private'): + def __init__(self, id=-1, access_token=None, model='private', intents=0): self.id = id self.access_token = access_token self.model = model + self.intents = intents self.debug_mode = False self.debug_logger = None def get_SDK_bot_info_from_Plugin_bot_info(plugin_bot_info): res = bot_info_T( - plugin_bot_info.id, - plugin_bot_info.post_info.access_token + id = plugin_bot_info.id, + access_token = plugin_bot_info.post_info.access_token, + model = plugin_bot_info.platform.get('model', 'private'), + intents = plugin_bot_info.post_info.port ) res.debug_mode = plugin_bot_info.debug_mode - if plugin_bot_info.platform['model'] == 'public': - res.model = 'public' return res @@ -175,7 +176,7 @@ def __init__(self, data): payload_template.__init__(self, data, True) class sendIdentify(payload_template): - def __init__(self, bot_info, intents=(int(intents_T.GUILDS) | int(intents_T.DIRECT_MESSAGE))): + def __init__(self, bot_info:bot_info_T, intents=(int(intents_T.GUILDS) | int(intents_T.DIRECT_MESSAGE))): tmp_intents = intents if bot_info.model == 'private': tmp_intents |= int(intents_T.GUILD_MESSAGES) @@ -183,6 +184,10 @@ def __init__(self, bot_info, intents=(int(intents_T.GUILDS) | int(intents_T.DIRE elif bot_info.model == 'public': 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']: + tmp_intents = bot_info.intents payload_template.__init__(self) self.data.op = 2 try: diff --git a/OlivOS/nativeGUI/multiLoginUIAPI.py b/OlivOS/nativeGUI/multiLoginUIAPI.py index 74d12279..7f104e03 100644 --- a/OlivOS/nativeGUI/multiLoginUIAPI.py +++ b/OlivOS/nativeGUI/multiLoginUIAPI.py @@ -365,7 +365,10 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non '渡渡语音/Dodo/V2', '渡渡语音/Dodo/V1', 'QQ官方/公域/V2', + 'QQ官方/公域/V2/纯频道', + 'QQ官方/公域/V2/指定intents', 'QQ官方/私域/V2', + 'QQ官方/私域/V2/指定intents', 'QQ官方/公域/V1', 'QQ官方/私域/V1', '米游社/大别野/公域', @@ -663,11 +666,28 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'AppSecret': 'edit_root_Entry_Server_access_token' } ], + 'QQ官方/公域/V2/纯频道': ['qqGuild', 'qqGuildv2_link', 'public_guild_only', 'True', 'websocket', { + 'AppID': 'edit_root_Entry_ID', + 'AppSecret': 'edit_root_Entry_Server_access_token' + } + ], + 'QQ官方/公域/V2/指定intents': ['qqGuild', 'qqGuildv2_link', 'public_intents', 'True', 'websocket', { + 'AppID': 'edit_root_Entry_ID', + 'AppSecret': 'edit_root_Entry_Server_access_token', + 'intents': 'edit_root_Entry_Server_port' + } + ], 'QQ官方/私域/V2': ['qqGuild', 'qqGuildv2_link', 'private', 'True', 'websocket', { 'AppID': 'edit_root_Entry_ID', 'AppSecret': 'edit_root_Entry_Server_access_token' } ], + 'QQ官方/私域/V2/指定intents': ['qqGuild', 'qqGuildv2_link', 'private_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' } @@ -835,8 +855,11 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'default' ], 'qqGuildv2_link': [ - 'private', 'public', + 'public_guild_only', + 'public_intents', + 'private', + 'private_intents', 'default' ] }, @@ -989,8 +1012,12 @@ def tree_edit_commit(self): tmp_password = 'NONEED' if tmp_host == '': tmp_host = 'NONEED' - if tmp_port == '': - tmp_port = '0' + if tmp_platform_model not in [ + 'public_intents', + 'private_intents' + ]: + if tmp_port == '': + tmp_port = '0' if tmp_platform_platform == 'mhyVila' \ and tmp_platform_sdk == 'mhyVila_link': tmp_id = tmp_id.strip('\n')