Skip to content

Commit

Permalink
0.11.28 Discord新增指定intents账号类型
Browse files Browse the repository at this point in the history
  • Loading branch information
lunzhiPenxil committed Jan 2, 2024
1 parent 03ff73d commit b98e205
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
13 changes: 10 additions & 3 deletions OlivOS/adapter/discord/discordSDK.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ class intents_T(IntEnum):


class bot_info_T(object):
def __init__(self, id=-1, access_token=None, model='private'):
def __init__(self, id=-1, port=-1, access_token=None, model='private'):
self.id = id
self.intents = port
self.access_token = access_token
self.model = model
self.debug_mode = False
Expand All @@ -89,6 +90,7 @@ def __init__(self, id=-1, access_token=None, model='private'):
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.port,
plugin_bot_info.post_info.access_token
)
res.debug_mode = plugin_bot_info.debug_mode
Expand Down Expand Up @@ -178,9 +180,14 @@ 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 | intents_T.GUILD_MESSAGES))):
def __init__(
self,
bot_info:bot_info_T,
intents=(int(intents_T.GUILDS) | int(intents_T.DIRECT_MESSAGE | intents_T.GUILD_MESSAGES))
):
tmp_intents = intents
if bot_info.model == 'intents':
tmp_intents = bot_info.intents
payload_template.__init__(self)
self.data.op = 2
try:
Expand Down
4 changes: 2 additions & 2 deletions OlivOS/core/info/infoAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import OlivOS


OlivOS_Version = '0.11.27'
OlivOS_SVN = 147
OlivOS_Version = '0.11.28'
OlivOS_SVN = 148

# Compatible <= Plugin[compatible_svn] : Compatible
# OldCompatible <= Plugin[compatible_svn] < Compatible : OldCompatible Warn
Expand Down
16 changes: 13 additions & 3 deletions OlivOS/nativeGUI/multiLoginUIAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non
'米游社/大别野/私域',
'米游社/大别野/沙盒',
'Discord',
'Discord/指定intents',
'Telegram',
'Fanbook',
'Hack.Chat',
Expand Down Expand Up @@ -696,6 +697,11 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non
'TOKEN': 'edit_root_Entry_Server_access_token'
}
],
'Discord/指定intents': ['discord', 'discord_link', 'intents', 'True', 'websocket', {
'TOKEN': 'edit_root_Entry_Server_access_token',
'intents': 'edit_root_Entry_Server_port'
}
],
'渡渡语音/Dodo/V2': ['dodo', 'dodo_link', 'default', 'True', 'websocket', {
'BotID': 'edit_root_Entry_ID',
'Bot私钥': 'edit_root_Entry_Server_access_token'
Expand Down Expand Up @@ -885,7 +891,8 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non
},
'discord': {
'discord_link': [
'default'
'default',
'intents'
]
},
'dodo': {
Expand Down Expand Up @@ -1055,8 +1062,11 @@ 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 [
'intents'
]:
if tmp_port == '':
tmp_port = '0'
if tmp_platform_platform == 'kaiheila' \
and tmp_platform_sdk == 'kaiheila_link':
if tmp_id == '':
Expand Down

0 comments on commit b98e205

Please sign in to comment.