* feat(webui): improve channel setup flows * fix(webui): refine channel setup interactions (NAN-112) * fix(webui): keep email setup sections channel-owned * fix(webui): remove concrete channel details from shared components * refactor(webui): remove unused channel setup resources * fix(webui): finish channel-owned setup boundaries * fix(webui): update channel switches optimistically * test(channels): remove obsolete absence assertions * fix(webui): flatten channel instance settings disclosure * fix(webui): complete channel setup and connection flows * fix(whatsapp): wait for session database release * fix(webui): preserve scrolling channel controls * fix(webui): stage channel connection checks * fix(channels): align verification actions * fix(email): expose connection checks * fix(webui): align channel field actions * fix(email): verify account credentials * fix(wecom): bypass system proxy for websocket * fix(channels): stabilize async connection cleanup * fix(webui): autosave channel credentials * fix(email): make provider presets non-destructive * test(weixin): isolate persisted QR credentials
37 lines
1.3 KiB
Python
37 lines
1.3 KiB
Python
"""Discord management contract."""
|
|
|
|
from nanobot.channels._manifest import DIRECT_GROUP_POLICIES, field, required
|
|
from nanobot.channels.contracts import ChannelSetupSpec
|
|
from nanobot.channels.discord.validation import validate
|
|
from nanobot.channels.plugin import ChannelPlugin
|
|
|
|
SETUP_SPEC = ChannelSetupSpec(
|
|
fields={
|
|
"token": field("secret"),
|
|
"proxy": field(),
|
|
"proxyUsername": field(),
|
|
"proxyPassword": field("secret"),
|
|
"allowFrom": field("list", snapshot=False),
|
|
"allowChannels": field("list"),
|
|
"groupPolicy": field("enum", choices=DIRECT_GROUP_POLICIES, default="mention"),
|
|
"intents": field("int", default=37377),
|
|
"readReceiptEmoji": field(default="👀"),
|
|
"workingEmoji": field(default="🔧"),
|
|
"workingEmojiDelay": field("float", default=2.0),
|
|
"streaming": field("bool", default=True),
|
|
},
|
|
required=(required("token"),),
|
|
official_url="https://discord.com/developers/applications",
|
|
validator=validate,
|
|
verifies_connection=True,
|
|
)
|
|
|
|
PLUGIN = ChannelPlugin(
|
|
name="discord",
|
|
display_name="Discord",
|
|
runtime=f"{__package__}.runtime:DiscordChannel",
|
|
setup=SETUP_SPEC,
|
|
dependencies=("discord.py>=2.5.2,<3.0.0",),
|
|
webui="webui/index.ts",
|
|
)
|