agent-messenger 1.14.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/README.md +94 -13
- package/.claude-plugin/marketplace.json +51 -12
- package/.claude-plugin/plugin.json +14 -3
- package/CONTRIBUTING.md +49 -3
- package/README.md +211 -54
- package/bun.lock +350 -2
- package/cubic.yaml +69 -0
- package/dist/package.json +118 -9
- package/dist/src/cli.d.ts.map +1 -1
- package/dist/src/cli.js +27 -6
- package/dist/src/cli.js.map +1 -1
- package/dist/src/platforms/channeltalk/client.d.ts +5 -1
- package/dist/src/platforms/channeltalk/client.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/client.js +23 -6
- package/dist/src/platforms/channeltalk/client.js.map +1 -1
- package/dist/src/platforms/channeltalk/commands/auth.d.ts +1 -1
- package/dist/src/platforms/channeltalk/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/commands/auth.js +4 -4
- package/dist/src/platforms/channeltalk/commands/auth.js.map +1 -1
- package/dist/src/platforms/channeltalk/commands/shared.js +1 -1
- package/dist/src/platforms/channeltalk/commands/shared.js.map +1 -1
- package/dist/src/platforms/channeltalk/ensure-auth.d.ts +2 -2
- package/dist/src/platforms/channeltalk/ensure-auth.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/ensure-auth.js +4 -4
- package/dist/src/platforms/channeltalk/ensure-auth.js.map +1 -1
- package/dist/src/platforms/channeltalk/index.d.ts +2 -2
- package/dist/src/platforms/channeltalk/index.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/index.js +1 -2
- package/dist/src/platforms/channeltalk/index.js.map +1 -1
- package/dist/src/platforms/channeltalk/token-extractor.d.ts +8 -0
- package/dist/src/platforms/channeltalk/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/token-extractor.js +127 -13
- package/dist/src/platforms/channeltalk/token-extractor.js.map +1 -1
- package/dist/src/platforms/channeltalk/types.d.ts +52 -949
- package/dist/src/platforms/channeltalk/types.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/types.js +1 -1
- package/dist/src/platforms/channeltalk/types.js.map +1 -1
- package/dist/src/platforms/channeltalkbot/client.d.ts +5 -1
- package/dist/src/platforms/channeltalkbot/client.d.ts.map +1 -1
- package/dist/src/platforms/channeltalkbot/client.js +24 -9
- package/dist/src/platforms/channeltalkbot/client.js.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/auth.js +2 -2
- package/dist/src/platforms/channeltalkbot/commands/auth.js.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/shared.js +1 -1
- package/dist/src/platforms/channeltalkbot/commands/shared.js.map +1 -1
- package/dist/src/platforms/channeltalkbot/index.d.ts +2 -1
- package/dist/src/platforms/channeltalkbot/index.d.ts.map +1 -1
- package/dist/src/platforms/channeltalkbot/index.js.map +1 -1
- package/dist/src/platforms/channeltalkbot/types.d.ts +24 -186
- package/dist/src/platforms/channeltalkbot/types.d.ts.map +1 -1
- package/dist/src/platforms/discord/client.d.ts +7 -1
- package/dist/src/platforms/discord/client.d.ts.map +1 -1
- package/dist/src/platforms/discord/client.js +27 -6
- package/dist/src/platforms/discord/client.js.map +1 -1
- package/dist/src/platforms/discord/commands/auth.js +2 -2
- package/dist/src/platforms/discord/commands/auth.js.map +1 -1
- package/dist/src/platforms/discord/commands/channel.js +3 -3
- package/dist/src/platforms/discord/commands/channel.js.map +1 -1
- package/dist/src/platforms/discord/commands/dm.js +2 -2
- package/dist/src/platforms/discord/commands/dm.js.map +1 -1
- package/dist/src/platforms/discord/commands/file.js +3 -3
- package/dist/src/platforms/discord/commands/file.js.map +1 -1
- package/dist/src/platforms/discord/commands/friend.js +1 -1
- package/dist/src/platforms/discord/commands/friend.js.map +1 -1
- package/dist/src/platforms/discord/commands/member.js +1 -1
- package/dist/src/platforms/discord/commands/member.js.map +1 -1
- package/dist/src/platforms/discord/commands/mention.js +1 -1
- package/dist/src/platforms/discord/commands/mention.js.map +1 -1
- package/dist/src/platforms/discord/commands/message.js +6 -6
- package/dist/src/platforms/discord/commands/message.js.map +1 -1
- package/dist/src/platforms/discord/commands/note.js +2 -2
- package/dist/src/platforms/discord/commands/note.js.map +1 -1
- package/dist/src/platforms/discord/commands/profile.js +1 -1
- package/dist/src/platforms/discord/commands/profile.js.map +1 -1
- package/dist/src/platforms/discord/commands/reaction.js +3 -3
- package/dist/src/platforms/discord/commands/reaction.js.map +1 -1
- package/dist/src/platforms/discord/commands/server.js +1 -1
- package/dist/src/platforms/discord/commands/server.js.map +1 -1
- package/dist/src/platforms/discord/commands/snapshot.js +1 -1
- package/dist/src/platforms/discord/commands/snapshot.js.map +1 -1
- package/dist/src/platforms/discord/commands/thread.js +2 -2
- package/dist/src/platforms/discord/commands/thread.js.map +1 -1
- package/dist/src/platforms/discord/commands/user.js +3 -3
- package/dist/src/platforms/discord/commands/user.js.map +1 -1
- package/dist/src/platforms/discord/ensure-auth.js +1 -1
- package/dist/src/platforms/discord/ensure-auth.js.map +1 -1
- package/dist/src/platforms/discord/index.d.ts +6 -0
- package/dist/src/platforms/discord/index.d.ts.map +1 -0
- package/dist/src/platforms/discord/index.js +5 -0
- package/dist/src/platforms/discord/index.js.map +1 -0
- package/dist/src/platforms/discord/listener.d.ts +41 -0
- package/dist/src/platforms/discord/listener.d.ts.map +1 -0
- package/dist/src/platforms/discord/listener.js +262 -0
- package/dist/src/platforms/discord/listener.js.map +1 -0
- package/dist/src/platforms/discord/types.d.ts +150 -352
- package/dist/src/platforms/discord/types.d.ts.map +1 -1
- package/dist/src/platforms/discord/types.js +28 -0
- package/dist/src/platforms/discord/types.js.map +1 -1
- package/dist/src/platforms/discordbot/client.d.ts +4 -1
- package/dist/src/platforms/discordbot/client.d.ts.map +1 -1
- package/dist/src/platforms/discordbot/client.js +23 -7
- package/dist/src/platforms/discordbot/client.js.map +1 -1
- package/dist/src/platforms/discordbot/commands/auth.js +2 -2
- package/dist/src/platforms/discordbot/commands/auth.js.map +1 -1
- package/dist/src/platforms/discordbot/commands/shared.js +1 -1
- package/dist/src/platforms/discordbot/commands/shared.js.map +1 -1
- package/dist/src/platforms/discordbot/types.d.ts +15 -203
- package/dist/src/platforms/discordbot/types.d.ts.map +1 -1
- package/dist/src/platforms/instagram/cli.d.ts +5 -0
- package/dist/src/platforms/instagram/cli.d.ts.map +1 -0
- package/dist/src/platforms/instagram/cli.js +30 -0
- package/dist/src/platforms/instagram/cli.js.map +1 -0
- package/dist/src/platforms/instagram/client.d.ts +65 -0
- package/dist/src/platforms/instagram/client.d.ts.map +1 -0
- package/dist/src/platforms/instagram/client.js +524 -0
- package/dist/src/platforms/instagram/client.js.map +1 -0
- package/dist/src/platforms/instagram/commands/auth.d.ts +3 -0
- package/dist/src/platforms/instagram/commands/auth.d.ts.map +1 -0
- package/dist/src/platforms/instagram/commands/auth.js +330 -0
- package/dist/src/platforms/instagram/commands/auth.js.map +1 -0
- package/dist/src/platforms/instagram/commands/chat.d.ts +3 -0
- package/dist/src/platforms/instagram/commands/chat.d.ts.map +1 -0
- package/dist/src/platforms/instagram/commands/chat.js +42 -0
- package/dist/src/platforms/instagram/commands/chat.js.map +1 -0
- package/dist/src/platforms/instagram/commands/index.d.ts +4 -0
- package/dist/src/platforms/instagram/commands/index.d.ts.map +1 -0
- package/dist/src/platforms/instagram/commands/index.js +4 -0
- package/dist/src/platforms/instagram/commands/index.js.map +1 -0
- package/dist/src/platforms/instagram/commands/message.d.ts +3 -0
- package/dist/src/platforms/instagram/commands/message.d.ts.map +1 -0
- package/dist/src/platforms/instagram/commands/message.js +102 -0
- package/dist/src/platforms/instagram/commands/message.js.map +1 -0
- package/dist/src/platforms/instagram/commands/shared.d.ts +8 -0
- package/dist/src/platforms/instagram/commands/shared.d.ts.map +1 -0
- package/dist/src/platforms/instagram/commands/shared.js +31 -0
- package/dist/src/platforms/instagram/commands/shared.js.map +1 -0
- package/dist/src/platforms/instagram/credential-manager.d.ts +20 -0
- package/dist/src/platforms/instagram/credential-manager.d.ts.map +1 -0
- package/dist/src/platforms/instagram/credential-manager.js +104 -0
- package/dist/src/platforms/instagram/credential-manager.js.map +1 -0
- package/dist/src/platforms/instagram/ensure-auth.d.ts +2 -0
- package/dist/src/platforms/instagram/ensure-auth.d.ts.map +1 -0
- package/dist/src/platforms/instagram/ensure-auth.js +21 -0
- package/dist/src/platforms/instagram/ensure-auth.js.map +1 -0
- package/dist/src/platforms/instagram/index.d.ts +5 -0
- package/dist/src/platforms/instagram/index.d.ts.map +1 -0
- package/dist/src/platforms/instagram/index.js +5 -0
- package/dist/src/platforms/instagram/index.js.map +1 -0
- package/dist/src/platforms/instagram/listener.d.ts +32 -0
- package/dist/src/platforms/instagram/listener.d.ts.map +1 -0
- package/dist/src/platforms/instagram/listener.js +87 -0
- package/dist/src/platforms/instagram/listener.js.map +1 -0
- package/dist/src/platforms/instagram/types.d.ts +61 -0
- package/dist/src/platforms/instagram/types.d.ts.map +1 -0
- package/dist/src/platforms/instagram/types.js +89 -0
- package/dist/src/platforms/instagram/types.js.map +1 -0
- package/dist/src/platforms/kakaotalk/auth/kakao-login.d.ts +27 -0
- package/dist/src/platforms/kakaotalk/auth/kakao-login.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/auth/kakao-login.js +213 -0
- package/dist/src/platforms/kakaotalk/auth/kakao-login.js.map +1 -0
- package/dist/src/platforms/kakaotalk/cli.d.ts +5 -0
- package/dist/src/platforms/kakaotalk/cli.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/cli.js +30 -0
- package/dist/src/platforms/kakaotalk/cli.js.map +1 -0
- package/dist/src/platforms/kakaotalk/client.d.ts +40 -0
- package/dist/src/platforms/kakaotalk/client.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/client.js +290 -0
- package/dist/src/platforms/kakaotalk/client.js.map +1 -0
- package/dist/src/platforms/kakaotalk/commands/auth.d.ts +3 -0
- package/dist/src/platforms/kakaotalk/commands/auth.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/commands/auth.js +515 -0
- package/dist/src/platforms/kakaotalk/commands/auth.js.map +1 -0
- package/dist/src/platforms/kakaotalk/commands/chat.d.ts +3 -0
- package/dist/src/platforms/kakaotalk/commands/chat.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/commands/chat.js +23 -0
- package/dist/src/platforms/kakaotalk/commands/chat.js.map +1 -0
- package/dist/src/platforms/kakaotalk/commands/index.d.ts +4 -0
- package/dist/src/platforms/kakaotalk/commands/index.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/commands/index.js +4 -0
- package/dist/src/platforms/kakaotalk/commands/index.js.map +1 -0
- package/dist/src/platforms/kakaotalk/commands/message.d.ts +3 -0
- package/dist/src/platforms/kakaotalk/commands/message.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/commands/message.js +41 -0
- package/dist/src/platforms/kakaotalk/commands/message.js.map +1 -0
- package/dist/src/platforms/kakaotalk/commands/shared.d.ts +7 -0
- package/dist/src/platforms/kakaotalk/commands/shared.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/commands/shared.js +24 -0
- package/dist/src/platforms/kakaotalk/commands/shared.js.map +1 -0
- package/dist/src/platforms/kakaotalk/credential-manager.d.ts +27 -0
- package/dist/src/platforms/kakaotalk/credential-manager.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/credential-manager.js +82 -0
- package/dist/src/platforms/kakaotalk/credential-manager.js.map +1 -0
- package/dist/src/platforms/kakaotalk/ensure-auth.d.ts +3 -0
- package/dist/src/platforms/kakaotalk/ensure-auth.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/ensure-auth.js +11 -0
- package/dist/src/platforms/kakaotalk/ensure-auth.js.map +1 -0
- package/dist/src/platforms/kakaotalk/index.d.ts +7 -0
- package/dist/src/platforms/kakaotalk/index.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/index.js +5 -0
- package/dist/src/platforms/kakaotalk/index.js.map +1 -0
- package/dist/src/platforms/kakaotalk/listener.d.ts +24 -0
- package/dist/src/platforms/kakaotalk/listener.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/listener.js +171 -0
- package/dist/src/platforms/kakaotalk/listener.js.map +1 -0
- package/dist/src/platforms/kakaotalk/protocol/config.d.ts +14 -0
- package/dist/src/platforms/kakaotalk/protocol/config.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/protocol/config.js +23 -0
- package/dist/src/platforms/kakaotalk/protocol/config.js.map +1 -0
- package/dist/src/platforms/kakaotalk/protocol/connection.d.ts +25 -0
- package/dist/src/platforms/kakaotalk/protocol/connection.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/protocol/connection.js +144 -0
- package/dist/src/platforms/kakaotalk/protocol/connection.js.map +1 -0
- package/dist/src/platforms/kakaotalk/protocol/crypto.d.ts +8 -0
- package/dist/src/platforms/kakaotalk/protocol/crypto.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/protocol/crypto.js +51 -0
- package/dist/src/platforms/kakaotalk/protocol/crypto.js.map +1 -0
- package/dist/src/platforms/kakaotalk/protocol/packet.d.ts +7 -0
- package/dist/src/platforms/kakaotalk/protocol/packet.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/protocol/packet.js +38 -0
- package/dist/src/platforms/kakaotalk/protocol/packet.js.map +1 -0
- package/dist/src/platforms/kakaotalk/protocol/session.d.ts +18 -0
- package/dist/src/platforms/kakaotalk/protocol/session.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/protocol/session.js +127 -0
- package/dist/src/platforms/kakaotalk/protocol/session.js.map +1 -0
- package/dist/src/platforms/kakaotalk/protocol/types.d.ts +41 -0
- package/dist/src/platforms/kakaotalk/protocol/types.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/protocol/types.js +8 -0
- package/dist/src/platforms/kakaotalk/protocol/types.js.map +1 -0
- package/dist/src/platforms/kakaotalk/token-extractor.d.ts +17 -0
- package/dist/src/platforms/kakaotalk/token-extractor.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/token-extractor.js +273 -0
- package/dist/src/platforms/kakaotalk/token-extractor.js.map +1 -0
- package/dist/src/platforms/kakaotalk/types.d.ts +198 -0
- package/dist/src/platforms/kakaotalk/types.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/types.js +74 -0
- package/dist/src/platforms/kakaotalk/types.js.map +1 -0
- package/dist/src/platforms/line/cli.d.ts +5 -0
- package/dist/src/platforms/line/cli.d.ts.map +1 -0
- package/dist/src/platforms/line/cli.js +32 -0
- package/dist/src/platforms/line/cli.js.map +1 -0
- package/dist/src/platforms/line/client.d.ts +31 -0
- package/dist/src/platforms/line/client.d.ts.map +1 -0
- package/dist/src/platforms/line/client.js +296 -0
- package/dist/src/platforms/line/client.js.map +1 -0
- package/dist/src/platforms/line/commands/auth.d.ts +3 -0
- package/dist/src/platforms/line/commands/auth.d.ts.map +1 -0
- package/dist/src/platforms/line/commands/auth.js +199 -0
- package/dist/src/platforms/line/commands/auth.js.map +1 -0
- package/dist/src/platforms/line/commands/chat.d.ts +3 -0
- package/dist/src/platforms/line/commands/chat.d.ts.map +1 -0
- package/dist/src/platforms/line/commands/chat.js +28 -0
- package/dist/src/platforms/line/commands/chat.js.map +1 -0
- package/dist/src/platforms/line/commands/friend.d.ts +3 -0
- package/dist/src/platforms/line/commands/friend.d.ts.map +1 -0
- package/dist/src/platforms/line/commands/friend.js +25 -0
- package/dist/src/platforms/line/commands/friend.js.map +1 -0
- package/dist/src/platforms/line/commands/index.d.ts +6 -0
- package/dist/src/platforms/line/commands/index.d.ts.map +1 -0
- package/dist/src/platforms/line/commands/index.js +6 -0
- package/dist/src/platforms/line/commands/index.js.map +1 -0
- package/dist/src/platforms/line/commands/message.d.ts +3 -0
- package/dist/src/platforms/line/commands/message.d.ts.map +1 -0
- package/dist/src/platforms/line/commands/message.js +48 -0
- package/dist/src/platforms/line/commands/message.js.map +1 -0
- package/dist/src/platforms/line/commands/profile.d.ts +3 -0
- package/dist/src/platforms/line/commands/profile.d.ts.map +1 -0
- package/dist/src/platforms/line/commands/profile.js +23 -0
- package/dist/src/platforms/line/commands/profile.js.map +1 -0
- package/dist/src/platforms/line/credential-manager.d.ts +22 -0
- package/dist/src/platforms/line/credential-manager.d.ts.map +1 -0
- package/dist/src/platforms/line/credential-manager.js +71 -0
- package/dist/src/platforms/line/credential-manager.js.map +1 -0
- package/dist/src/platforms/line/ensure-auth.d.ts +3 -0
- package/dist/src/platforms/line/ensure-auth.d.ts.map +1 -0
- package/dist/src/platforms/line/ensure-auth.js +10 -0
- package/dist/src/platforms/line/ensure-auth.js.map +1 -0
- package/dist/src/platforms/line/index.d.ts +7 -0
- package/dist/src/platforms/line/index.d.ts.map +1 -0
- package/dist/src/platforms/line/index.js +6 -0
- package/dist/src/platforms/line/index.js.map +1 -0
- package/dist/src/platforms/line/listener.d.ts +22 -0
- package/dist/src/platforms/line/listener.d.ts.map +1 -0
- package/dist/src/platforms/line/listener.js +121 -0
- package/dist/src/platforms/line/listener.js.map +1 -0
- package/dist/src/platforms/line/types.d.ts +165 -0
- package/dist/src/platforms/line/types.d.ts.map +1 -0
- package/dist/src/platforms/line/types.js +79 -0
- package/dist/src/platforms/line/types.js.map +1 -0
- package/dist/src/platforms/slack/cli.d.ts.map +1 -1
- package/dist/src/platforms/slack/cli.js +6 -1
- package/dist/src/platforms/slack/cli.js.map +1 -1
- package/dist/src/platforms/slack/client.d.ts +85 -3
- package/dist/src/platforms/slack/client.d.ts.map +1 -1
- package/dist/src/platforms/slack/client.js +577 -40
- package/dist/src/platforms/slack/client.js.map +1 -1
- package/dist/src/platforms/slack/commands/activity.js +1 -1
- package/dist/src/platforms/slack/commands/activity.js.map +1 -1
- package/dist/src/platforms/slack/commands/auth.js +2 -2
- package/dist/src/platforms/slack/commands/auth.js.map +1 -1
- package/dist/src/platforms/slack/commands/bookmark.d.ts +3 -0
- package/dist/src/platforms/slack/commands/bookmark.d.ts.map +1 -0
- package/dist/src/platforms/slack/commands/bookmark.js +116 -0
- package/dist/src/platforms/slack/commands/bookmark.js.map +1 -0
- package/dist/src/platforms/slack/commands/channel.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/channel.js +198 -5
- package/dist/src/platforms/slack/commands/channel.js.map +1 -1
- package/dist/src/platforms/slack/commands/drafts.js +1 -1
- package/dist/src/platforms/slack/commands/drafts.js.map +1 -1
- package/dist/src/platforms/slack/commands/emoji.d.ts +3 -0
- package/dist/src/platforms/slack/commands/emoji.d.ts.map +1 -0
- package/dist/src/platforms/slack/commands/emoji.js +27 -0
- package/dist/src/platforms/slack/commands/emoji.js.map +1 -0
- package/dist/src/platforms/slack/commands/file.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/file.js +26 -5
- package/dist/src/platforms/slack/commands/file.js.map +1 -1
- package/dist/src/platforms/slack/commands/index.d.ts +5 -0
- package/dist/src/platforms/slack/commands/index.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/index.js +5 -0
- package/dist/src/platforms/slack/commands/index.js.map +1 -1
- package/dist/src/platforms/slack/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/message.js +134 -8
- package/dist/src/platforms/slack/commands/message.js.map +1 -1
- package/dist/src/platforms/slack/commands/pin.d.ts +3 -0
- package/dist/src/platforms/slack/commands/pin.d.ts.map +1 -0
- package/dist/src/platforms/slack/commands/pin.js +76 -0
- package/dist/src/platforms/slack/commands/pin.js.map +1 -0
- package/dist/src/platforms/slack/commands/reaction.js +3 -3
- package/dist/src/platforms/slack/commands/reaction.js.map +1 -1
- package/dist/src/platforms/slack/commands/reminder.d.ts +3 -0
- package/dist/src/platforms/slack/commands/reminder.d.ts.map +1 -0
- package/dist/src/platforms/slack/commands/reminder.js +98 -0
- package/dist/src/platforms/slack/commands/reminder.js.map +1 -0
- package/dist/src/platforms/slack/commands/saved.js +1 -1
- package/dist/src/platforms/slack/commands/saved.js.map +1 -1
- package/dist/src/platforms/slack/commands/sections.js +1 -1
- package/dist/src/platforms/slack/commands/sections.js.map +1 -1
- package/dist/src/platforms/slack/commands/snapshot.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/snapshot.js +12 -1
- package/dist/src/platforms/slack/commands/snapshot.js.map +1 -1
- package/dist/src/platforms/slack/commands/unread.js +3 -3
- package/dist/src/platforms/slack/commands/unread.js.map +1 -1
- package/dist/src/platforms/slack/commands/user.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/user.js +78 -1
- package/dist/src/platforms/slack/commands/user.js.map +1 -1
- package/dist/src/platforms/slack/commands/usergroup.d.ts +3 -0
- package/dist/src/platforms/slack/commands/usergroup.d.ts.map +1 -0
- package/dist/src/platforms/slack/commands/usergroup.js +190 -0
- package/dist/src/platforms/slack/commands/usergroup.js.map +1 -0
- package/dist/src/platforms/slack/credential-manager.d.ts +2 -1
- package/dist/src/platforms/slack/credential-manager.d.ts.map +1 -1
- package/dist/src/platforms/slack/credential-manager.js +2 -1
- package/dist/src/platforms/slack/credential-manager.js.map +1 -1
- package/dist/src/platforms/slack/ensure-auth.js +4 -4
- package/dist/src/platforms/slack/ensure-auth.js.map +1 -1
- package/dist/src/platforms/slack/index.d.ts +4 -1
- package/dist/src/platforms/slack/index.d.ts.map +1 -1
- package/dist/src/platforms/slack/index.js +3 -1
- package/dist/src/platforms/slack/index.js.map +1 -1
- package/dist/src/platforms/slack/listener.d.ts +30 -0
- package/dist/src/platforms/slack/listener.d.ts.map +1 -0
- package/dist/src/platforms/slack/listener.js +157 -0
- package/dist/src/platforms/slack/listener.js.map +1 -0
- package/dist/src/platforms/slack/types.d.ts +198 -275
- package/dist/src/platforms/slack/types.d.ts.map +1 -1
- package/dist/src/platforms/slack/types.js +22 -0
- package/dist/src/platforms/slack/types.js.map +1 -1
- package/dist/src/platforms/slackbot/client.d.ts +4 -1
- package/dist/src/platforms/slackbot/client.d.ts.map +1 -1
- package/dist/src/platforms/slackbot/client.js +40 -21
- package/dist/src/platforms/slackbot/client.js.map +1 -1
- package/dist/src/platforms/slackbot/commands/auth.js +2 -2
- package/dist/src/platforms/slackbot/commands/auth.js.map +1 -1
- package/dist/src/platforms/slackbot/commands/shared.js +1 -1
- package/dist/src/platforms/slackbot/commands/shared.js.map +1 -1
- package/dist/src/platforms/slackbot/types.d.ts +20 -282
- package/dist/src/platforms/slackbot/types.d.ts.map +1 -1
- package/dist/src/platforms/teams/client.d.ts +5 -1
- package/dist/src/platforms/teams/client.d.ts.map +1 -1
- package/dist/src/platforms/teams/client.js +27 -9
- package/dist/src/platforms/teams/client.js.map +1 -1
- package/dist/src/platforms/teams/commands/auth.js +3 -3
- package/dist/src/platforms/teams/commands/auth.js.map +1 -1
- package/dist/src/platforms/teams/commands/channel.js +3 -3
- package/dist/src/platforms/teams/commands/channel.js.map +1 -1
- package/dist/src/platforms/teams/commands/file.js +3 -3
- package/dist/src/platforms/teams/commands/file.js.map +1 -1
- package/dist/src/platforms/teams/commands/message.js +4 -4
- package/dist/src/platforms/teams/commands/message.js.map +1 -1
- package/dist/src/platforms/teams/commands/reaction.js +2 -2
- package/dist/src/platforms/teams/commands/reaction.js.map +1 -1
- package/dist/src/platforms/teams/commands/snapshot.js +1 -1
- package/dist/src/platforms/teams/commands/snapshot.js.map +1 -1
- package/dist/src/platforms/teams/commands/team.js +1 -1
- package/dist/src/platforms/teams/commands/team.js.map +1 -1
- package/dist/src/platforms/teams/commands/user.js +3 -3
- package/dist/src/platforms/teams/commands/user.js.map +1 -1
- package/dist/src/platforms/teams/ensure-auth.js +1 -1
- package/dist/src/platforms/teams/ensure-auth.js.map +1 -1
- package/dist/src/platforms/teams/index.d.ts +6 -0
- package/dist/src/platforms/teams/index.d.ts.map +1 -0
- package/dist/src/platforms/teams/index.js +5 -0
- package/dist/src/platforms/teams/index.js.map +1 -0
- package/dist/src/platforms/teams/types.d.ts +26 -193
- package/dist/src/platforms/teams/types.d.ts.map +1 -1
- package/dist/src/platforms/telegram/app-config.d.ts +7 -0
- package/dist/src/platforms/telegram/app-config.d.ts.map +1 -0
- package/dist/src/platforms/telegram/app-config.js +39 -0
- package/dist/src/platforms/telegram/app-config.js.map +1 -0
- package/dist/src/platforms/telegram/chat-utils.d.ts +5 -0
- package/dist/src/platforms/telegram/chat-utils.d.ts.map +1 -0
- package/dist/src/platforms/telegram/chat-utils.js +33 -0
- package/dist/src/platforms/telegram/chat-utils.js.map +1 -0
- package/dist/src/platforms/telegram/cli.d.ts +5 -0
- package/dist/src/platforms/telegram/cli.d.ts.map +1 -0
- package/dist/src/platforms/telegram/cli.js +15 -0
- package/dist/src/platforms/telegram/cli.js.map +1 -0
- package/dist/src/platforms/telegram/client.d.ts +47 -0
- package/dist/src/platforms/telegram/client.d.ts.map +1 -0
- package/dist/src/platforms/telegram/client.js +481 -0
- package/dist/src/platforms/telegram/client.js.map +1 -0
- package/dist/src/platforms/telegram/commands/auth.d.ts +44 -0
- package/dist/src/platforms/telegram/commands/auth.d.ts.map +1 -0
- package/dist/src/platforms/telegram/commands/auth.js +522 -0
- package/dist/src/platforms/telegram/commands/auth.js.map +1 -0
- package/dist/src/platforms/telegram/commands/chat.d.ts +3 -0
- package/dist/src/platforms/telegram/commands/chat.d.ts.map +1 -0
- package/dist/src/platforms/telegram/commands/chat.js +55 -0
- package/dist/src/platforms/telegram/commands/chat.js.map +1 -0
- package/dist/src/platforms/telegram/commands/index.d.ts +4 -0
- package/dist/src/platforms/telegram/commands/index.d.ts.map +1 -0
- package/dist/src/platforms/telegram/commands/index.js +4 -0
- package/dist/src/platforms/telegram/commands/index.js.map +1 -0
- package/dist/src/platforms/telegram/commands/message.d.ts +3 -0
- package/dist/src/platforms/telegram/commands/message.d.ts.map +1 -0
- package/dist/src/platforms/telegram/commands/message.js +40 -0
- package/dist/src/platforms/telegram/commands/message.js.map +1 -0
- package/dist/src/platforms/telegram/commands/shared.d.ts +10 -0
- package/dist/src/platforms/telegram/commands/shared.d.ts.map +1 -0
- package/dist/src/platforms/telegram/commands/shared.js +32 -0
- package/dist/src/platforms/telegram/commands/shared.js.map +1 -0
- package/dist/src/platforms/telegram/credential-manager.d.ts +25 -0
- package/dist/src/platforms/telegram/credential-manager.d.ts.map +1 -0
- package/dist/src/platforms/telegram/credential-manager.js +159 -0
- package/dist/src/platforms/telegram/credential-manager.js.map +1 -0
- package/dist/src/platforms/telegram/my-telegram-org.d.ts +14 -0
- package/dist/src/platforms/telegram/my-telegram-org.d.ts.map +1 -0
- package/dist/src/platforms/telegram/my-telegram-org.js +164 -0
- package/dist/src/platforms/telegram/my-telegram-org.js.map +1 -0
- package/dist/src/platforms/telegram/tdlib.d.ts +11 -0
- package/dist/src/platforms/telegram/tdlib.d.ts.map +1 -0
- package/dist/src/platforms/telegram/tdlib.js +113 -0
- package/dist/src/platforms/telegram/tdlib.js.map +1 -0
- package/dist/src/platforms/telegram/types.d.ts +192 -0
- package/dist/src/platforms/telegram/types.d.ts.map +1 -0
- package/dist/src/platforms/telegram/types.js +183 -0
- package/dist/src/platforms/telegram/types.js.map +1 -0
- package/dist/src/platforms/whatsapp/cli.d.ts +6 -0
- package/dist/src/platforms/whatsapp/cli.d.ts.map +1 -0
- package/dist/src/platforms/whatsapp/cli.js +31 -0
- package/dist/src/platforms/whatsapp/cli.js.map +1 -0
- package/dist/src/platforms/whatsapp/client.d.ts +39 -0
- package/dist/src/platforms/whatsapp/client.d.ts.map +1 -0
- package/dist/src/platforms/whatsapp/client.js +436 -0
- package/dist/src/platforms/whatsapp/client.js.map +1 -0
- package/dist/src/platforms/whatsapp/commands/auth.d.ts +3 -0
- package/dist/src/platforms/whatsapp/commands/auth.d.ts.map +1 -0
- package/dist/src/platforms/whatsapp/commands/auth.js +170 -0
- package/dist/src/platforms/whatsapp/commands/auth.js.map +1 -0
- package/dist/src/platforms/whatsapp/commands/chat.d.ts +3 -0
- package/dist/src/platforms/whatsapp/commands/chat.d.ts.map +1 -0
- package/dist/src/platforms/whatsapp/commands/chat.js +42 -0
- package/dist/src/platforms/whatsapp/commands/chat.js.map +1 -0
- package/dist/src/platforms/whatsapp/commands/index.d.ts +4 -0
- package/dist/src/platforms/whatsapp/commands/index.d.ts.map +1 -0
- package/dist/src/platforms/whatsapp/commands/index.js +4 -0
- package/dist/src/platforms/whatsapp/commands/index.js.map +1 -0
- package/dist/src/platforms/whatsapp/commands/message.d.ts +3 -0
- package/dist/src/platforms/whatsapp/commands/message.d.ts.map +1 -0
- package/dist/src/platforms/whatsapp/commands/message.js +61 -0
- package/dist/src/platforms/whatsapp/commands/message.js.map +1 -0
- package/dist/src/platforms/whatsapp/commands/shared.d.ts +8 -0
- package/dist/src/platforms/whatsapp/commands/shared.d.ts.map +1 -0
- package/dist/src/platforms/whatsapp/commands/shared.js +37 -0
- package/dist/src/platforms/whatsapp/commands/shared.js.map +1 -0
- package/dist/src/platforms/whatsapp/credential-manager.d.ts +20 -0
- package/dist/src/platforms/whatsapp/credential-manager.d.ts.map +1 -0
- package/dist/src/platforms/whatsapp/credential-manager.js +104 -0
- package/dist/src/platforms/whatsapp/credential-manager.js.map +1 -0
- package/dist/src/platforms/whatsapp/ensure-auth.d.ts +2 -0
- package/dist/src/platforms/whatsapp/ensure-auth.d.ts.map +1 -0
- package/dist/src/platforms/whatsapp/ensure-auth.js +23 -0
- package/dist/src/platforms/whatsapp/ensure-auth.js.map +1 -0
- package/dist/src/platforms/whatsapp/index.d.ts +4 -0
- package/dist/src/platforms/whatsapp/index.d.ts.map +1 -0
- package/dist/src/platforms/whatsapp/index.js +4 -0
- package/dist/src/platforms/whatsapp/index.js.map +1 -0
- package/dist/src/platforms/whatsapp/suppress-ws-warnings.d.ts +11 -0
- package/dist/src/platforms/whatsapp/suppress-ws-warnings.d.ts.map +1 -0
- package/dist/src/platforms/whatsapp/suppress-ws-warnings.js +24 -0
- package/dist/src/platforms/whatsapp/suppress-ws-warnings.js.map +1 -0
- package/dist/src/platforms/whatsapp/types.d.ts +42 -0
- package/dist/src/platforms/whatsapp/types.d.ts.map +1 -0
- package/dist/src/platforms/whatsapp/types.js +75 -0
- package/dist/src/platforms/whatsapp/types.js.map +1 -0
- package/dist/src/platforms/whatsappbot/cli.d.ts +5 -0
- package/dist/src/platforms/whatsappbot/cli.d.ts.map +1 -0
- package/dist/src/platforms/whatsappbot/cli.js +17 -0
- package/dist/src/platforms/whatsappbot/cli.js.map +1 -0
- package/dist/src/platforms/whatsappbot/client.d.ts +31 -0
- package/dist/src/platforms/whatsappbot/client.d.ts.map +1 -0
- package/dist/src/platforms/whatsappbot/client.js +202 -0
- package/dist/src/platforms/whatsappbot/client.js.map +1 -0
- package/dist/src/platforms/whatsappbot/commands/auth.d.ts +28 -0
- package/dist/src/platforms/whatsappbot/commands/auth.d.ts.map +1 -0
- package/dist/src/platforms/whatsappbot/commands/auth.js +163 -0
- package/dist/src/platforms/whatsappbot/commands/auth.js.map +1 -0
- package/dist/src/platforms/whatsappbot/commands/index.d.ts +4 -0
- package/dist/src/platforms/whatsappbot/commands/index.d.ts.map +1 -0
- package/dist/src/platforms/whatsappbot/commands/index.js +4 -0
- package/dist/src/platforms/whatsappbot/commands/index.js.map +1 -0
- package/dist/src/platforms/whatsappbot/commands/message.d.ts +27 -0
- package/dist/src/platforms/whatsappbot/commands/message.d.ts.map +1 -0
- package/dist/src/platforms/whatsappbot/commands/message.js +122 -0
- package/dist/src/platforms/whatsappbot/commands/message.js.map +1 -0
- package/dist/src/platforms/whatsappbot/commands/shared.d.ts +9 -0
- package/dist/src/platforms/whatsappbot/commands/shared.d.ts.map +1 -0
- package/dist/src/platforms/whatsappbot/commands/shared.js +13 -0
- package/dist/src/platforms/whatsappbot/commands/shared.js.map +1 -0
- package/dist/src/platforms/whatsappbot/commands/template.d.ts +16 -0
- package/dist/src/platforms/whatsappbot/commands/template.d.ts.map +1 -0
- package/dist/src/platforms/whatsappbot/commands/template.js +51 -0
- package/dist/src/platforms/whatsappbot/commands/template.js.map +1 -0
- package/dist/src/platforms/whatsappbot/credential-manager.d.ts +17 -0
- package/dist/src/platforms/whatsappbot/credential-manager.d.ts.map +1 -0
- package/dist/src/platforms/whatsappbot/credential-manager.js +121 -0
- package/dist/src/platforms/whatsappbot/credential-manager.js.map +1 -0
- package/dist/src/platforms/whatsappbot/index.d.ts +5 -0
- package/dist/src/platforms/whatsappbot/index.d.ts.map +1 -0
- package/dist/src/platforms/whatsappbot/index.js +4 -0
- package/dist/src/platforms/whatsappbot/index.js.map +1 -0
- package/dist/src/platforms/whatsappbot/types.d.ts +66 -0
- package/dist/src/platforms/whatsappbot/types.d.ts.map +1 -0
- package/dist/src/platforms/whatsappbot/types.js +28 -0
- package/dist/src/platforms/whatsappbot/types.js.map +1 -0
- package/dist/src/tui/adapters/channeltalk-adapter.d.ts +19 -0
- package/dist/src/tui/adapters/channeltalk-adapter.d.ts.map +1 -0
- package/dist/src/tui/adapters/channeltalk-adapter.js +88 -0
- package/dist/src/tui/adapters/channeltalk-adapter.js.map +1 -0
- package/dist/src/tui/adapters/discord-adapter.d.ts +22 -0
- package/dist/src/tui/adapters/discord-adapter.d.ts.map +1 -0
- package/dist/src/tui/adapters/discord-adapter.js +100 -0
- package/dist/src/tui/adapters/discord-adapter.js.map +1 -0
- package/dist/src/tui/adapters/instagram-adapter.d.ts +18 -0
- package/dist/src/tui/adapters/instagram-adapter.d.ts.map +1 -0
- package/dist/src/tui/adapters/instagram-adapter.js +115 -0
- package/dist/src/tui/adapters/instagram-adapter.js.map +1 -0
- package/dist/src/tui/adapters/kakaotalk-adapter.d.ts +18 -0
- package/dist/src/tui/adapters/kakaotalk-adapter.d.ts.map +1 -0
- package/dist/src/tui/adapters/kakaotalk-adapter.js +146 -0
- package/dist/src/tui/adapters/kakaotalk-adapter.js.map +1 -0
- package/dist/src/tui/adapters/line-adapter.d.ts +18 -0
- package/dist/src/tui/adapters/line-adapter.d.ts.map +1 -0
- package/dist/src/tui/adapters/line-adapter.js +92 -0
- package/dist/src/tui/adapters/line-adapter.js.map +1 -0
- package/dist/src/tui/adapters/slack-adapter.d.ts +23 -0
- package/dist/src/tui/adapters/slack-adapter.d.ts.map +1 -0
- package/dist/src/tui/adapters/slack-adapter.js +111 -0
- package/dist/src/tui/adapters/slack-adapter.js.map +1 -0
- package/dist/src/tui/adapters/teams-adapter.d.ts +20 -0
- package/dist/src/tui/adapters/teams-adapter.d.ts.map +1 -0
- package/dist/src/tui/adapters/teams-adapter.js +85 -0
- package/dist/src/tui/adapters/teams-adapter.js.map +1 -0
- package/dist/src/tui/adapters/telegram-adapter.d.ts +18 -0
- package/dist/src/tui/adapters/telegram-adapter.d.ts.map +1 -0
- package/dist/src/tui/adapters/telegram-adapter.js +183 -0
- package/dist/src/tui/adapters/telegram-adapter.js.map +1 -0
- package/dist/src/tui/adapters/types.d.ts +41 -0
- package/dist/src/tui/adapters/types.d.ts.map +1 -0
- package/dist/src/tui/adapters/types.js +2 -0
- package/dist/src/tui/adapters/types.js.map +1 -0
- package/dist/src/tui/adapters/whatsapp-adapter.d.ts +18 -0
- package/dist/src/tui/adapters/whatsapp-adapter.d.ts.map +1 -0
- package/dist/src/tui/adapters/whatsapp-adapter.js +120 -0
- package/dist/src/tui/adapters/whatsapp-adapter.js.map +1 -0
- package/dist/src/tui/app.d.ts +2 -0
- package/dist/src/tui/app.d.ts.map +1 -0
- package/dist/src/tui/app.js +652 -0
- package/dist/src/tui/app.js.map +1 -0
- package/dist/src/tui/cli.d.ts +3 -0
- package/dist/src/tui/cli.d.ts.map +1 -0
- package/dist/src/tui/cli.js +14 -0
- package/dist/src/tui/cli.js.map +1 -0
- package/dist/src/tui/utils.d.ts +5 -0
- package/dist/src/tui/utils.d.ts.map +1 -0
- package/dist/src/tui/utils.js +54 -0
- package/dist/src/tui/utils.js.map +1 -0
- package/dist/src/tui/views/channel-picker.d.ts +18 -0
- package/dist/src/tui/views/channel-picker.d.ts.map +1 -0
- package/dist/src/tui/views/channel-picker.js +131 -0
- package/dist/src/tui/views/channel-picker.js.map +1 -0
- package/dist/src/tui/views/workspace-picker.d.ts +18 -0
- package/dist/src/tui/views/workspace-picker.d.ts.map +1 -0
- package/dist/src/tui/views/workspace-picker.js +131 -0
- package/dist/src/tui/views/workspace-picker.js.map +1 -0
- package/docs/bun.lock +2 -666
- package/docs/content/docs/agent-skills.mdx +1 -1
- package/docs/content/docs/cli/channeltalk.mdx +264 -0
- package/docs/content/docs/cli/channeltalkbot.mdx +261 -0
- package/docs/content/docs/cli/instagram.mdx +211 -0
- package/docs/content/docs/cli/kakaotalk.mdx +286 -0
- package/docs/content/docs/cli/line.mdx +306 -0
- package/docs/content/docs/cli/meta.json +18 -0
- package/docs/content/docs/cli/slack.mdx +395 -0
- package/docs/content/docs/{integrations → cli}/slackbot.mdx +1 -1
- package/docs/content/docs/{integrations → cli}/teams.mdx +2 -2
- package/docs/content/docs/cli/telegram.mdx +107 -0
- package/docs/content/docs/cli/whatsapp.mdx +163 -0
- package/docs/content/docs/cli/whatsappbot.mdx +169 -0
- package/docs/content/docs/index.mdx +21 -13
- package/docs/content/docs/meta.json +9 -1
- package/docs/content/docs/quick-start.mdx +29 -6
- package/docs/content/docs/sdk/channeltalk.mdx +384 -0
- package/docs/content/docs/sdk/channeltalkbot.mdx +395 -0
- package/docs/content/docs/sdk/discord.mdx +535 -0
- package/docs/content/docs/sdk/instagram.mdx +367 -0
- package/docs/content/docs/sdk/kakaotalk.mdx +290 -0
- package/docs/content/docs/sdk/line.mdx +347 -0
- package/docs/content/docs/sdk/meta.json +4 -0
- package/docs/content/docs/sdk/slack.mdx +671 -0
- package/docs/content/docs/sdk/teams.mdx +350 -0
- package/docs/content/docs/sdk/whatsapp.mdx +293 -0
- package/docs/content/docs/sdk/whatsappbot.mdx +266 -0
- package/docs/content/docs/tui.mdx +137 -0
- package/docs/public/tui.png +0 -0
- package/docs/src/app/page.tsx +885 -308
- package/e2e/discordbot.e2e.test.ts +1 -1
- package/examples/discord-listen.ts +56 -0
- package/examples/kakaotalk-listen.ts +49 -0
- package/examples/slack-listen.ts +60 -0
- package/package.json +118 -9
- package/scripts/postbuild.ts +1 -0
- package/scripts/prepublish.ts +21 -1
- package/skills/agent-channeltalk/SKILL.md +18 -6
- package/skills/agent-channeltalkbot/SKILL.md +1 -1
- package/skills/agent-discord/SKILL.md +77 -2
- package/skills/agent-discord/references/common-patterns.md +1 -1
- package/skills/agent-discordbot/SKILL.md +1 -1
- package/skills/agent-instagram/SKILL.md +383 -0
- package/skills/agent-instagram/references/authentication.md +256 -0
- package/skills/agent-instagram/references/common-patterns.md +362 -0
- package/skills/agent-instagram/templates/chat-summary.sh +124 -0
- package/skills/agent-instagram/templates/monitor-chat.sh +143 -0
- package/skills/agent-instagram/templates/post-message.sh +130 -0
- package/skills/agent-kakaotalk/SKILL.md +587 -0
- package/skills/agent-kakaotalk/references/authentication.md +343 -0
- package/skills/agent-kakaotalk/references/common-patterns.md +403 -0
- package/skills/agent-kakaotalk/templates/chat-summary.sh +121 -0
- package/skills/agent-kakaotalk/templates/monitor-chat.sh +160 -0
- package/skills/agent-kakaotalk/templates/post-message.sh +123 -0
- package/skills/agent-line/SKILL.md +490 -0
- package/skills/agent-line/references/authentication.md +297 -0
- package/skills/agent-line/references/common-patterns.md +355 -0
- package/skills/agent-line/templates/chat-summary.sh +63 -0
- package/skills/agent-line/templates/monitor-chat.sh +76 -0
- package/skills/agent-line/templates/post-message.sh +123 -0
- package/skills/agent-slack/SKILL.md +266 -7
- package/skills/agent-slack/references/common-patterns.md +105 -39
- package/skills/agent-slackbot/SKILL.md +1 -1
- package/skills/agent-slackbot/references/common-patterns.md +52 -0
- package/skills/agent-teams/SKILL.md +49 -1
- package/skills/agent-telegram/SKILL.md +123 -0
- package/skills/agent-whatsapp/SKILL.md +382 -0
- package/skills/agent-whatsapp/references/authentication.md +191 -0
- package/skills/agent-whatsapp/references/common-patterns.md +336 -0
- package/skills/agent-whatsapp/templates/chat-summary.sh +122 -0
- package/skills/agent-whatsapp/templates/monitor-chat.sh +157 -0
- package/skills/agent-whatsapp/templates/post-message.sh +120 -0
- package/skills/agent-whatsappbot/SKILL.md +371 -0
- package/skills/agent-whatsappbot/references/authentication.md +216 -0
- package/skills/agent-whatsappbot/references/common-patterns.md +331 -0
- package/skills/agent-whatsappbot/templates/account-summary.sh +127 -0
- package/skills/agent-whatsappbot/templates/post-message.sh +120 -0
- package/skills/agent-whatsappbot/templates/send-template.sh +153 -0
- package/src/cli.ts +34 -6
- package/src/platforms/channeltalk/client.test.ts +30 -28
- package/src/platforms/channeltalk/client.ts +29 -8
- package/src/platforms/channeltalk/commands/auth.ts +9 -7
- package/src/platforms/channeltalk/commands/shared.ts +1 -1
- package/src/platforms/channeltalk/ensure-auth.ts +10 -8
- package/src/platforms/channeltalk/index.test.ts +114 -0
- package/src/platforms/channeltalk/index.ts +27 -14
- package/src/platforms/channeltalk/token-extractor.test.ts +227 -65
- package/src/platforms/channeltalk/token-extractor.ts +146 -25
- package/src/platforms/channeltalk/types.ts +3 -1
- package/src/platforms/channeltalkbot/client.test.ts +12 -12
- package/src/platforms/channeltalkbot/client.ts +31 -11
- package/src/platforms/channeltalkbot/commands/auth.test.ts +1 -5
- package/src/platforms/channeltalkbot/commands/auth.ts +2 -2
- package/src/platforms/channeltalkbot/commands/shared.ts +1 -1
- package/src/platforms/channeltalkbot/index.test.ts +76 -0
- package/src/platforms/channeltalkbot/index.ts +14 -11
- package/src/platforms/discord/client.test.ts +30 -30
- package/src/platforms/discord/client.ts +33 -6
- package/src/platforms/discord/commands/auth.test.ts +2 -2
- package/src/platforms/discord/commands/auth.ts +2 -2
- package/src/platforms/discord/commands/channel.test.ts +6 -6
- package/src/platforms/discord/commands/channel.ts +3 -3
- package/src/platforms/discord/commands/dm.ts +2 -2
- package/src/platforms/discord/commands/file.ts +3 -3
- package/src/platforms/discord/commands/friend.test.ts +5 -5
- package/src/platforms/discord/commands/friend.ts +1 -1
- package/src/platforms/discord/commands/member.test.ts +4 -4
- package/src/platforms/discord/commands/member.ts +1 -1
- package/src/platforms/discord/commands/mention.test.ts +4 -4
- package/src/platforms/discord/commands/mention.ts +1 -1
- package/src/platforms/discord/commands/message.ts +6 -6
- package/src/platforms/discord/commands/note.ts +2 -2
- package/src/platforms/discord/commands/profile.ts +1 -1
- package/src/platforms/discord/commands/reaction.ts +3 -3
- package/src/platforms/discord/commands/server.test.ts +2 -2
- package/src/platforms/discord/commands/server.ts +1 -1
- package/src/platforms/discord/commands/snapshot.ts +1 -1
- package/src/platforms/discord/commands/thread.test.ts +5 -5
- package/src/platforms/discord/commands/thread.ts +2 -2
- package/src/platforms/discord/commands/user.ts +3 -3
- package/src/platforms/discord/ensure-auth.ts +1 -1
- package/src/platforms/discord/index.test.ts +84 -0
- package/src/platforms/discord/index.ts +51 -0
- package/src/platforms/discord/listener.test.ts +782 -0
- package/src/platforms/discord/listener.ts +297 -0
- package/src/platforms/discord/types.ts +133 -0
- package/src/platforms/discordbot/client.test.ts +33 -33
- package/src/platforms/discordbot/client.ts +28 -7
- package/src/platforms/discordbot/commands/auth.test.ts +1 -5
- package/src/platforms/discordbot/commands/auth.ts +2 -2
- package/src/platforms/discordbot/commands/channel.test.ts +1 -5
- package/src/platforms/discordbot/commands/message.test.ts +1 -3
- package/src/platforms/discordbot/commands/server.test.ts +1 -5
- package/src/platforms/discordbot/commands/shared.ts +1 -1
- package/src/platforms/discordbot/commands/snapshot.test.ts +1 -3
- package/src/platforms/discordbot/commands/thread.test.ts +1 -3
- package/src/platforms/discordbot/commands/user.test.ts +1 -5
- package/src/platforms/instagram/cli.ts +37 -0
- package/src/platforms/instagram/client.test.ts +396 -0
- package/src/platforms/instagram/client.ts +655 -0
- package/src/platforms/instagram/commands/auth.ts +401 -0
- package/src/platforms/instagram/commands/chat.ts +49 -0
- package/src/platforms/instagram/commands/index.ts +3 -0
- package/src/platforms/instagram/commands/message.ts +134 -0
- package/src/platforms/instagram/commands/shared.test.ts +51 -0
- package/src/platforms/instagram/commands/shared.ts +55 -0
- package/src/platforms/instagram/credential-manager.test.ts +277 -0
- package/src/platforms/instagram/credential-manager.ts +134 -0
- package/src/platforms/instagram/ensure-auth.test.ts +84 -0
- package/src/platforms/instagram/ensure-auth.ts +24 -0
- package/src/platforms/instagram/index.test.ts +44 -0
- package/src/platforms/instagram/index.ts +16 -0
- package/src/platforms/instagram/listener.test.ts +130 -0
- package/src/platforms/instagram/listener.ts +106 -0
- package/src/platforms/instagram/types.test.ts +228 -0
- package/src/platforms/instagram/types.ts +153 -0
- package/src/platforms/kakaotalk/auth/kakao-login.ts +296 -0
- package/src/platforms/kakaotalk/cli.ts +37 -0
- package/src/platforms/kakaotalk/client.test.ts +490 -0
- package/src/platforms/kakaotalk/client.ts +328 -0
- package/src/platforms/kakaotalk/commands/auth.ts +569 -0
- package/src/platforms/kakaotalk/commands/chat.ts +34 -0
- package/src/platforms/kakaotalk/commands/index.ts +3 -0
- package/src/platforms/kakaotalk/commands/message.ts +56 -0
- package/src/platforms/kakaotalk/commands/shared.ts +38 -0
- package/src/platforms/kakaotalk/credential-manager.test.ts +231 -0
- package/src/platforms/kakaotalk/credential-manager.ts +110 -0
- package/src/platforms/kakaotalk/ensure-auth.ts +16 -0
- package/src/platforms/kakaotalk/index.test.ts +68 -0
- package/src/platforms/kakaotalk/index.ts +30 -0
- package/src/platforms/kakaotalk/listener.test.ts +370 -0
- package/src/platforms/kakaotalk/listener.ts +203 -0
- package/src/platforms/kakaotalk/protocol/NOTICE.md +51 -0
- package/src/platforms/kakaotalk/protocol/config.ts +28 -0
- package/src/platforms/kakaotalk/protocol/connection.ts +159 -0
- package/src/platforms/kakaotalk/protocol/crypto.ts +71 -0
- package/src/platforms/kakaotalk/protocol/packet.ts +47 -0
- package/src/platforms/kakaotalk/protocol/session.ts +156 -0
- package/src/platforms/kakaotalk/protocol/types.ts +42 -0
- package/src/platforms/kakaotalk/token-extractor.ts +320 -0
- package/src/platforms/kakaotalk/types.ts +212 -0
- package/src/platforms/line/cli.ts +39 -0
- package/src/platforms/line/client.test.ts +162 -0
- package/src/platforms/line/client.ts +352 -0
- package/src/platforms/line/commands/auth.ts +219 -0
- package/src/platforms/line/commands/chat.ts +34 -0
- package/src/platforms/line/commands/friend.ts +28 -0
- package/src/platforms/line/commands/index.ts +5 -0
- package/src/platforms/line/commands/message.ts +59 -0
- package/src/platforms/line/commands/profile.ts +24 -0
- package/src/platforms/line/credential-manager.test.ts +163 -0
- package/src/platforms/line/credential-manager.ts +99 -0
- package/src/platforms/line/ensure-auth.ts +13 -0
- package/src/platforms/line/index.test.ts +48 -0
- package/src/platforms/line/index.ts +27 -0
- package/src/platforms/line/listener.test.ts +341 -0
- package/src/platforms/line/listener.ts +138 -0
- package/src/platforms/line/types.test.ts +157 -0
- package/src/platforms/line/types.ts +181 -0
- package/src/platforms/slack/cli.ts +10 -0
- package/src/platforms/slack/client.test.ts +703 -69
- package/src/platforms/slack/client.ts +664 -43
- package/src/platforms/slack/commands/activity.ts +1 -1
- package/src/platforms/slack/commands/auth.ts +2 -2
- package/src/platforms/slack/commands/bookmark.test.ts +91 -0
- package/src/platforms/slack/commands/bookmark.ts +148 -0
- package/src/platforms/slack/commands/channel.test.ts +47 -1
- package/src/platforms/slack/commands/channel.ts +255 -4
- package/src/platforms/slack/commands/drafts.ts +1 -1
- package/src/platforms/slack/commands/emoji.test.ts +32 -0
- package/src/platforms/slack/commands/emoji.ts +33 -0
- package/src/platforms/slack/commands/file.ts +30 -4
- package/src/platforms/slack/commands/index.ts +5 -0
- package/src/platforms/slack/commands/message.ts +173 -7
- package/src/platforms/slack/commands/pin.test.ts +72 -0
- package/src/platforms/slack/commands/pin.ts +93 -0
- package/src/platforms/slack/commands/reaction.ts +3 -3
- package/src/platforms/slack/commands/reminder.test.ts +86 -0
- package/src/platforms/slack/commands/reminder.ts +125 -0
- package/src/platforms/slack/commands/saved.ts +1 -1
- package/src/platforms/slack/commands/sections.ts +1 -1
- package/src/platforms/slack/commands/snapshot.test.ts +4 -4
- package/src/platforms/slack/commands/snapshot.ts +14 -1
- package/src/platforms/slack/commands/unread.test.ts +3 -3
- package/src/platforms/slack/commands/unread.ts +3 -3
- package/src/platforms/slack/commands/user.ts +90 -1
- package/src/platforms/slack/commands/usergroup.test.ts +157 -0
- package/src/platforms/slack/commands/usergroup.ts +242 -0
- package/src/platforms/slack/credential-manager.ts +3 -1
- package/src/platforms/slack/ensure-auth.ts +4 -4
- package/src/platforms/slack/index.test.ts +59 -0
- package/src/platforms/slack/index.ts +46 -1
- package/src/platforms/slack/listener.test.ts +370 -0
- package/src/platforms/slack/listener.ts +181 -0
- package/src/platforms/slack/types.ts +187 -0
- package/src/platforms/slackbot/client.test.ts +26 -26
- package/src/platforms/slackbot/client.ts +40 -22
- package/src/platforms/slackbot/commands/auth.test.ts +1 -5
- package/src/platforms/slackbot/commands/auth.ts +2 -2
- package/src/platforms/slackbot/commands/shared.ts +1 -1
- package/src/platforms/teams/client.test.ts +34 -34
- package/src/platforms/teams/client.ts +32 -9
- package/src/platforms/teams/commands/auth.test.ts +2 -2
- package/src/platforms/teams/commands/auth.ts +3 -3
- package/src/platforms/teams/commands/channel.test.ts +6 -6
- package/src/platforms/teams/commands/channel.ts +3 -3
- package/src/platforms/teams/commands/file.ts +3 -3
- package/src/platforms/teams/commands/message.ts +4 -4
- package/src/platforms/teams/commands/reaction.ts +2 -2
- package/src/platforms/teams/commands/snapshot.ts +1 -1
- package/src/platforms/teams/commands/team.test.ts +2 -2
- package/src/platforms/teams/commands/team.ts +1 -1
- package/src/platforms/teams/commands/user.ts +3 -3
- package/src/platforms/teams/ensure-auth.ts +1 -1
- package/src/platforms/teams/index.test.ts +74 -0
- package/src/platforms/teams/index.ts +30 -0
- package/src/platforms/telegram/app-config.test.ts +44 -0
- package/src/platforms/telegram/app-config.ts +53 -0
- package/src/platforms/telegram/chat-utils.test.ts +71 -0
- package/src/platforms/telegram/chat-utils.ts +39 -0
- package/src/platforms/telegram/cli.ts +20 -0
- package/src/platforms/telegram/client.test.ts +90 -0
- package/src/platforms/telegram/client.ts +623 -0
- package/src/platforms/telegram/commands/auth.test.ts +113 -0
- package/src/platforms/telegram/commands/auth.ts +662 -0
- package/src/platforms/telegram/commands/chat.ts +65 -0
- package/src/platforms/telegram/commands/index.ts +3 -0
- package/src/platforms/telegram/commands/message.ts +51 -0
- package/src/platforms/telegram/commands/shared.test.ts +15 -0
- package/src/platforms/telegram/commands/shared.ts +50 -0
- package/src/platforms/telegram/credential-manager.test.ts +152 -0
- package/src/platforms/telegram/credential-manager.ts +203 -0
- package/src/platforms/telegram/my-telegram-org.ts +206 -0
- package/src/platforms/telegram/tdlib.ts +159 -0
- package/src/platforms/telegram/types.test.ts +74 -0
- package/src/platforms/telegram/types.ts +417 -0
- package/src/platforms/whatsapp/cli.ts +38 -0
- package/src/platforms/whatsapp/client.ts +526 -0
- package/src/platforms/whatsapp/commands/auth.ts +205 -0
- package/src/platforms/whatsapp/commands/chat.ts +49 -0
- package/src/platforms/whatsapp/commands/index.ts +3 -0
- package/src/platforms/whatsapp/commands/message.ts +79 -0
- package/src/platforms/whatsapp/commands/shared.ts +61 -0
- package/src/platforms/whatsapp/credential-manager.test.ts +278 -0
- package/src/platforms/whatsapp/credential-manager.ts +134 -0
- package/src/platforms/whatsapp/ensure-auth.test.ts +85 -0
- package/src/platforms/whatsapp/ensure-auth.ts +26 -0
- package/src/platforms/whatsapp/index.test.ts +39 -0
- package/src/platforms/whatsapp/index.ts +16 -0
- package/src/platforms/whatsapp/suppress-ws-warnings.ts +21 -0
- package/src/platforms/whatsapp/types.test.ts +190 -0
- package/src/platforms/whatsapp/types.ts +95 -0
- package/src/platforms/whatsappbot/cli.ts +23 -0
- package/src/platforms/whatsappbot/client.test.ts +411 -0
- package/src/platforms/whatsappbot/client.ts +256 -0
- package/src/platforms/whatsappbot/commands/auth.ts +206 -0
- package/src/platforms/whatsappbot/commands/index.ts +3 -0
- package/src/platforms/whatsappbot/commands/message.ts +148 -0
- package/src/platforms/whatsappbot/commands/shared.ts +22 -0
- package/src/platforms/whatsappbot/commands/template.ts +69 -0
- package/src/platforms/whatsappbot/credential-manager.test.ts +303 -0
- package/src/platforms/whatsappbot/credential-manager.ts +148 -0
- package/src/platforms/whatsappbot/index.test.ts +34 -0
- package/src/platforms/whatsappbot/index.ts +18 -0
- package/src/platforms/whatsappbot/types.test.ts +141 -0
- package/src/platforms/whatsappbot/types.ts +71 -0
- package/src/tui/adapters/channeltalk-adapter.ts +102 -0
- package/src/tui/adapters/discord-adapter.ts +112 -0
- package/src/tui/adapters/instagram-adapter.ts +132 -0
- package/src/tui/adapters/kakaotalk-adapter.ts +163 -0
- package/src/tui/adapters/line-adapter.ts +109 -0
- package/src/tui/adapters/slack-adapter.ts +128 -0
- package/src/tui/adapters/teams-adapter.ts +95 -0
- package/src/tui/adapters/telegram-adapter.ts +203 -0
- package/src/tui/adapters/types.ts +43 -0
- package/src/tui/adapters/whatsapp-adapter.ts +138 -0
- package/src/tui/app.ts +689 -0
- package/src/tui/cli.ts +18 -0
- package/src/tui/utils.test.ts +149 -0
- package/src/tui/utils.ts +58 -0
- package/src/tui/views/channel-picker.ts +146 -0
- package/src/tui/views/workspace-picker.ts +146 -0
- package/docs/content/docs/integrations/meta.json +0 -5
- package/docs/content/docs/integrations/slack.mdx +0 -218
- package/docs/content/docs/{integrations → cli}/discord.mdx +19 -19
- package/docs/content/docs/{integrations → cli}/discordbot.mdx +8 -8
|
@@ -46,23 +46,23 @@ function resetMocks() {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
describe('SlackClient', () => {
|
|
49
|
-
describe('
|
|
50
|
-
test('throws SlackError when token is empty', () => {
|
|
51
|
-
expect(()
|
|
52
|
-
expect(()
|
|
49
|
+
describe('login', () => {
|
|
50
|
+
test('throws SlackError when token is empty', async () => {
|
|
51
|
+
await expect(new SlackClient().login({ token: '', cookie: 'xoxd-cookie' })).rejects.toThrow(SlackError)
|
|
52
|
+
await expect(new SlackClient().login({ token: '', cookie: 'xoxd-cookie' })).rejects.toThrow('Token is required')
|
|
53
53
|
})
|
|
54
54
|
|
|
55
|
-
test('throws SlackError when cookie is empty', () => {
|
|
56
|
-
expect(()
|
|
57
|
-
expect(()
|
|
55
|
+
test('throws SlackError when cookie is empty', async () => {
|
|
56
|
+
await expect(new SlackClient().login({ token: 'xoxc-token', cookie: '' })).rejects.toThrow(SlackError)
|
|
57
|
+
await expect(new SlackClient().login({ token: 'xoxc-token', cookie: '' })).rejects.toThrow('Cookie is required')
|
|
58
58
|
})
|
|
59
59
|
|
|
60
|
-
test('throws SlackError when both token and cookie are empty', () => {
|
|
61
|
-
expect(()
|
|
60
|
+
test('throws SlackError when both token and cookie are empty', async () => {
|
|
61
|
+
await expect(new SlackClient().login({ token: '', cookie: '' })).rejects.toThrow(SlackError)
|
|
62
62
|
})
|
|
63
63
|
|
|
64
|
-
test('creates client successfully with valid token and cookie', () => {
|
|
65
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
64
|
+
test('creates client successfully with valid token and cookie', async () => {
|
|
65
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
66
66
|
expect(client).toBeInstanceOf(SlackClient)
|
|
67
67
|
})
|
|
68
68
|
})
|
|
@@ -79,7 +79,7 @@ describe('SlackClient', () => {
|
|
|
79
79
|
team: 'Test Team',
|
|
80
80
|
})
|
|
81
81
|
|
|
82
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
82
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
83
83
|
// @ts-expect-error - accessing private property for testing
|
|
84
84
|
client.client = mockWebClient as unknown as WebClient
|
|
85
85
|
|
|
@@ -94,7 +94,7 @@ describe('SlackClient', () => {
|
|
|
94
94
|
error: 'invalid_auth',
|
|
95
95
|
})
|
|
96
96
|
|
|
97
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
97
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
98
98
|
// @ts-expect-error - accessing private property for testing
|
|
99
99
|
client.client = mockWebClient as unknown as WebClient
|
|
100
100
|
|
|
@@ -128,7 +128,7 @@ describe('SlackClient', () => {
|
|
|
128
128
|
],
|
|
129
129
|
})
|
|
130
130
|
|
|
131
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
131
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
132
132
|
// @ts-expect-error - accessing private property for testing
|
|
133
133
|
client.client = mockWebClient as unknown as WebClient
|
|
134
134
|
|
|
@@ -168,7 +168,7 @@ describe('SlackClient', () => {
|
|
|
168
168
|
],
|
|
169
169
|
})
|
|
170
170
|
|
|
171
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
171
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
172
172
|
// @ts-expect-error - accessing private property for testing
|
|
173
173
|
client.client = mockWebClient as unknown as WebClient
|
|
174
174
|
|
|
@@ -183,7 +183,7 @@ describe('SlackClient', () => {
|
|
|
183
183
|
error: 'channel_not_found',
|
|
184
184
|
})
|
|
185
185
|
|
|
186
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
186
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
187
187
|
// @ts-expect-error - accessing private property for testing
|
|
188
188
|
client.client = mockWebClient as unknown as WebClient
|
|
189
189
|
|
|
@@ -207,7 +207,7 @@ describe('SlackClient', () => {
|
|
|
207
207
|
},
|
|
208
208
|
})
|
|
209
209
|
|
|
210
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
210
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
211
211
|
// @ts-expect-error - accessing private property for testing
|
|
212
212
|
client.client = mockWebClient as unknown as WebClient
|
|
213
213
|
|
|
@@ -222,7 +222,7 @@ describe('SlackClient', () => {
|
|
|
222
222
|
error: 'channel_not_found',
|
|
223
223
|
})
|
|
224
224
|
|
|
225
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
225
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
226
226
|
// @ts-expect-error - accessing private property for testing
|
|
227
227
|
client.client = mockWebClient as unknown as WebClient
|
|
228
228
|
|
|
@@ -234,19 +234,19 @@ describe('SlackClient', () => {
|
|
|
234
234
|
beforeEach(() => resetMocks())
|
|
235
235
|
|
|
236
236
|
test('returns channel ID unchanged when input starts with C', async () => {
|
|
237
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
237
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
238
238
|
const channel = await client.resolveChannel('C123ABC')
|
|
239
239
|
expect(channel).toBe('C123ABC')
|
|
240
240
|
})
|
|
241
241
|
|
|
242
242
|
test('returns channel ID unchanged when input starts with D', async () => {
|
|
243
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
243
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
244
244
|
const channel = await client.resolveChannel('D123ABC')
|
|
245
245
|
expect(channel).toBe('D123ABC')
|
|
246
246
|
})
|
|
247
247
|
|
|
248
248
|
test('returns channel ID unchanged when input starts with G', async () => {
|
|
249
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
249
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
250
250
|
const channel = await client.resolveChannel('G123ABC')
|
|
251
251
|
expect(channel).toBe('G123ABC')
|
|
252
252
|
})
|
|
@@ -266,7 +266,7 @@ describe('SlackClient', () => {
|
|
|
266
266
|
],
|
|
267
267
|
})
|
|
268
268
|
|
|
269
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
269
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
270
270
|
// @ts-expect-error - accessing private property for testing
|
|
271
271
|
client.client = mockWebClient as unknown as WebClient
|
|
272
272
|
|
|
@@ -290,7 +290,7 @@ describe('SlackClient', () => {
|
|
|
290
290
|
],
|
|
291
291
|
})
|
|
292
292
|
|
|
293
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
293
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
294
294
|
// @ts-expect-error - accessing private property for testing
|
|
295
295
|
client.client = mockWebClient as unknown as WebClient
|
|
296
296
|
|
|
@@ -300,7 +300,7 @@ describe('SlackClient', () => {
|
|
|
300
300
|
})
|
|
301
301
|
|
|
302
302
|
test('returns channel ID unchanged when input is #C prefixed ID', async () => {
|
|
303
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
303
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
304
304
|
const channel = await client.resolveChannel('#C123ABC')
|
|
305
305
|
expect(channel).toBe('C123ABC')
|
|
306
306
|
})
|
|
@@ -320,7 +320,7 @@ describe('SlackClient', () => {
|
|
|
320
320
|
],
|
|
321
321
|
})
|
|
322
322
|
|
|
323
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
323
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
324
324
|
// @ts-expect-error - accessing private property for testing
|
|
325
325
|
client.client = mockWebClient as unknown as WebClient
|
|
326
326
|
|
|
@@ -345,7 +345,7 @@ describe('SlackClient', () => {
|
|
|
345
345
|
messages,
|
|
346
346
|
})
|
|
347
347
|
|
|
348
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
348
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
349
349
|
// @ts-expect-error - accessing private property for testing
|
|
350
350
|
client.client = mockWebClient as unknown as WebClient
|
|
351
351
|
|
|
@@ -362,7 +362,7 @@ describe('SlackClient', () => {
|
|
|
362
362
|
messages: [{ ts: '123.456', text: 'Hello', type: 'message' }],
|
|
363
363
|
})
|
|
364
364
|
|
|
365
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
365
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
366
366
|
// @ts-expect-error - accessing private property for testing
|
|
367
367
|
client.client = mockWebClient as unknown as WebClient
|
|
368
368
|
|
|
@@ -378,7 +378,7 @@ describe('SlackClient', () => {
|
|
|
378
378
|
error: 'channel_not_found',
|
|
379
379
|
})
|
|
380
380
|
|
|
381
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
381
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
382
382
|
// @ts-expect-error - accessing private property for testing
|
|
383
383
|
client.client = mockWebClient as unknown as WebClient
|
|
384
384
|
|
|
@@ -396,7 +396,7 @@ describe('SlackClient', () => {
|
|
|
396
396
|
message: { ts: '123.456', text: 'Hello', type: 'message' },
|
|
397
397
|
})
|
|
398
398
|
|
|
399
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
399
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
400
400
|
// @ts-expect-error - accessing private property for testing
|
|
401
401
|
client.client = mockWebClient as unknown as WebClient
|
|
402
402
|
|
|
@@ -414,7 +414,7 @@ describe('SlackClient', () => {
|
|
|
414
414
|
message: { ts: '123.789', text: 'Reply', type: 'message', thread_ts: '123.456' },
|
|
415
415
|
})
|
|
416
416
|
|
|
417
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
417
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
418
418
|
// @ts-expect-error - accessing private property for testing
|
|
419
419
|
client.client = mockWebClient as unknown as WebClient
|
|
420
420
|
|
|
@@ -431,7 +431,7 @@ describe('SlackClient', () => {
|
|
|
431
431
|
error: 'channel_not_found',
|
|
432
432
|
})
|
|
433
433
|
|
|
434
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
434
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
435
435
|
// @ts-expect-error - accessing private property for testing
|
|
436
436
|
client.client = mockWebClient as unknown as WebClient
|
|
437
437
|
|
|
@@ -449,7 +449,7 @@ describe('SlackClient', () => {
|
|
|
449
449
|
message: { ts: '123.456', text: 'Updated', type: 'message' },
|
|
450
450
|
})
|
|
451
451
|
|
|
452
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
452
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
453
453
|
// @ts-expect-error - accessing private property for testing
|
|
454
454
|
client.client = mockWebClient as unknown as WebClient
|
|
455
455
|
|
|
@@ -466,7 +466,7 @@ describe('SlackClient', () => {
|
|
|
466
466
|
error: 'message_not_found',
|
|
467
467
|
})
|
|
468
468
|
|
|
469
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
469
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
470
470
|
// @ts-expect-error - accessing private property for testing
|
|
471
471
|
client.client = mockWebClient as unknown as WebClient
|
|
472
472
|
|
|
@@ -480,7 +480,7 @@ describe('SlackClient', () => {
|
|
|
480
480
|
test('deletes message', async () => {
|
|
481
481
|
mockWebClient.chat.delete.mockResolvedValue({ ok: true })
|
|
482
482
|
|
|
483
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
483
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
484
484
|
// @ts-expect-error - accessing private property for testing
|
|
485
485
|
client.client = mockWebClient as unknown as WebClient
|
|
486
486
|
|
|
@@ -496,7 +496,7 @@ describe('SlackClient', () => {
|
|
|
496
496
|
error: 'message_not_found',
|
|
497
497
|
})
|
|
498
498
|
|
|
499
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
499
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
500
500
|
// @ts-expect-error - accessing private property for testing
|
|
501
501
|
client.client = mockWebClient as unknown as WebClient
|
|
502
502
|
|
|
@@ -510,7 +510,7 @@ describe('SlackClient', () => {
|
|
|
510
510
|
test('adds reaction to message', async () => {
|
|
511
511
|
mockWebClient.reactions.add.mockResolvedValue({ ok: true })
|
|
512
512
|
|
|
513
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
513
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
514
514
|
// @ts-expect-error - accessing private property for testing
|
|
515
515
|
client.client = mockWebClient as unknown as WebClient
|
|
516
516
|
|
|
@@ -526,7 +526,7 @@ describe('SlackClient', () => {
|
|
|
526
526
|
error: 'already_reacted',
|
|
527
527
|
})
|
|
528
528
|
|
|
529
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
529
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
530
530
|
// @ts-expect-error - accessing private property for testing
|
|
531
531
|
client.client = mockWebClient as unknown as WebClient
|
|
532
532
|
|
|
@@ -540,7 +540,7 @@ describe('SlackClient', () => {
|
|
|
540
540
|
test('removes reaction from message', async () => {
|
|
541
541
|
mockWebClient.reactions.remove.mockResolvedValue({ ok: true })
|
|
542
542
|
|
|
543
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
543
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
544
544
|
// @ts-expect-error - accessing private property for testing
|
|
545
545
|
client.client = mockWebClient as unknown as WebClient
|
|
546
546
|
|
|
@@ -556,7 +556,7 @@ describe('SlackClient', () => {
|
|
|
556
556
|
error: 'no_reaction',
|
|
557
557
|
})
|
|
558
558
|
|
|
559
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
559
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
560
560
|
// @ts-expect-error - accessing private property for testing
|
|
561
561
|
client.client = mockWebClient as unknown as WebClient
|
|
562
562
|
|
|
@@ -592,7 +592,7 @@ describe('SlackClient', () => {
|
|
|
592
592
|
],
|
|
593
593
|
})
|
|
594
594
|
|
|
595
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
595
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
596
596
|
// @ts-expect-error - accessing private property for testing
|
|
597
597
|
client.client = mockWebClient as unknown as WebClient
|
|
598
598
|
|
|
@@ -634,7 +634,7 @@ describe('SlackClient', () => {
|
|
|
634
634
|
],
|
|
635
635
|
})
|
|
636
636
|
|
|
637
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
637
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
638
638
|
// @ts-expect-error - accessing private property for testing
|
|
639
639
|
client.client = mockWebClient as unknown as WebClient
|
|
640
640
|
|
|
@@ -649,7 +649,7 @@ describe('SlackClient', () => {
|
|
|
649
649
|
error: 'invalid_auth',
|
|
650
650
|
})
|
|
651
651
|
|
|
652
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
652
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
653
653
|
// @ts-expect-error - accessing private property for testing
|
|
654
654
|
client.client = mockWebClient as unknown as WebClient
|
|
655
655
|
|
|
@@ -666,7 +666,7 @@ describe('SlackClient', () => {
|
|
|
666
666
|
members: ['U123', 'U456', 'U789'],
|
|
667
667
|
})
|
|
668
668
|
|
|
669
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
669
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
670
670
|
// @ts-expect-error - accessing private property for testing
|
|
671
671
|
client.client = mockWebClient as unknown as WebClient
|
|
672
672
|
|
|
@@ -689,7 +689,7 @@ describe('SlackClient', () => {
|
|
|
689
689
|
members: ['U789'],
|
|
690
690
|
})
|
|
691
691
|
|
|
692
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
692
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
693
693
|
// @ts-expect-error - accessing private property for testing
|
|
694
694
|
client.client = mockWebClient as unknown as WebClient
|
|
695
695
|
|
|
@@ -704,7 +704,7 @@ describe('SlackClient', () => {
|
|
|
704
704
|
error: 'channel_not_found',
|
|
705
705
|
})
|
|
706
706
|
|
|
707
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
707
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
708
708
|
// @ts-expect-error - accessing private property for testing
|
|
709
709
|
client.client = mockWebClient as unknown as WebClient
|
|
710
710
|
|
|
@@ -729,7 +729,7 @@ describe('SlackClient', () => {
|
|
|
729
729
|
},
|
|
730
730
|
})
|
|
731
731
|
|
|
732
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
732
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
733
733
|
// @ts-expect-error - accessing private property for testing
|
|
734
734
|
client.client = mockWebClient as unknown as WebClient
|
|
735
735
|
|
|
@@ -744,7 +744,7 @@ describe('SlackClient', () => {
|
|
|
744
744
|
error: 'user_not_found',
|
|
745
745
|
})
|
|
746
746
|
|
|
747
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
747
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
748
748
|
// @ts-expect-error - accessing private property for testing
|
|
749
749
|
client.client = mockWebClient as unknown as WebClient
|
|
750
750
|
|
|
@@ -777,7 +777,7 @@ describe('SlackClient', () => {
|
|
|
777
777
|
],
|
|
778
778
|
})
|
|
779
779
|
|
|
780
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
780
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
781
781
|
// @ts-expect-error - accessing private property for testing
|
|
782
782
|
client.client = mockWebClient as unknown as WebClient
|
|
783
783
|
|
|
@@ -794,7 +794,7 @@ describe('SlackClient', () => {
|
|
|
794
794
|
error: 'file_upload_failed',
|
|
795
795
|
})
|
|
796
796
|
|
|
797
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
797
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
798
798
|
// @ts-expect-error - accessing private property for testing
|
|
799
799
|
client.client = mockWebClient as unknown as WebClient
|
|
800
800
|
|
|
@@ -807,7 +807,7 @@ describe('SlackClient', () => {
|
|
|
807
807
|
files: [],
|
|
808
808
|
})
|
|
809
809
|
|
|
810
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
810
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
811
811
|
// @ts-expect-error - accessing private property for testing
|
|
812
812
|
client.client = mockWebClient as unknown as WebClient
|
|
813
813
|
|
|
@@ -820,7 +820,7 @@ describe('SlackClient', () => {
|
|
|
820
820
|
files: [{ ok: true, files: [] }],
|
|
821
821
|
})
|
|
822
822
|
|
|
823
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
823
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
824
824
|
// @ts-expect-error - accessing private property for testing
|
|
825
825
|
client.client = mockWebClient as unknown as WebClient
|
|
826
826
|
|
|
@@ -848,7 +848,7 @@ describe('SlackClient', () => {
|
|
|
848
848
|
],
|
|
849
849
|
})
|
|
850
850
|
|
|
851
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
851
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
852
852
|
// @ts-expect-error - accessing private property for testing
|
|
853
853
|
client.client = mockWebClient as unknown as WebClient
|
|
854
854
|
|
|
@@ -863,7 +863,7 @@ describe('SlackClient', () => {
|
|
|
863
863
|
files: [],
|
|
864
864
|
})
|
|
865
865
|
|
|
866
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
866
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
867
867
|
// @ts-expect-error - accessing private property for testing
|
|
868
868
|
client.client = mockWebClient as unknown as WebClient
|
|
869
869
|
|
|
@@ -877,7 +877,7 @@ describe('SlackClient', () => {
|
|
|
877
877
|
error: 'invalid_auth',
|
|
878
878
|
})
|
|
879
879
|
|
|
880
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
880
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
881
881
|
// @ts-expect-error - accessing private property for testing
|
|
882
882
|
client.client = mockWebClient as unknown as WebClient
|
|
883
883
|
|
|
@@ -904,7 +904,7 @@ describe('SlackClient', () => {
|
|
|
904
904
|
},
|
|
905
905
|
})
|
|
906
906
|
|
|
907
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
907
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
908
908
|
// @ts-expect-error - accessing private property for testing
|
|
909
909
|
client.client = mockWebClient as unknown as WebClient
|
|
910
910
|
|
|
@@ -917,7 +917,7 @@ describe('SlackClient', () => {
|
|
|
917
917
|
test('throws on API failure', async () => {
|
|
918
918
|
mockWebClient.files.info.mockResolvedValue({ ok: false, error: 'file_not_found' })
|
|
919
919
|
|
|
920
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
920
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
921
921
|
// @ts-expect-error - accessing private property for testing
|
|
922
922
|
client.client = mockWebClient as unknown as WebClient
|
|
923
923
|
|
|
@@ -947,7 +947,7 @@ describe('SlackClient', () => {
|
|
|
947
947
|
globalThis.fetch = async () => new Response(Buffer.from('test content'), { status: 200 })
|
|
948
948
|
|
|
949
949
|
try {
|
|
950
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
950
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
951
951
|
// @ts-expect-error - accessing private property for testing
|
|
952
952
|
client.client = mockWebClient as unknown as WebClient
|
|
953
953
|
|
|
@@ -975,7 +975,7 @@ describe('SlackClient', () => {
|
|
|
975
975
|
},
|
|
976
976
|
})
|
|
977
977
|
|
|
978
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
978
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
979
979
|
// @ts-expect-error - accessing private property for testing
|
|
980
980
|
client.client = mockWebClient as unknown as WebClient
|
|
981
981
|
|
|
@@ -1001,7 +1001,7 @@ describe('SlackClient', () => {
|
|
|
1001
1001
|
globalThis.fetch = async () => new Response('Forbidden', { status: 403, statusText: 'Forbidden' })
|
|
1002
1002
|
|
|
1003
1003
|
try {
|
|
1004
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
1004
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
1005
1005
|
// @ts-expect-error - accessing private property for testing
|
|
1006
1006
|
client.client = mockWebClient as unknown as WebClient
|
|
1007
1007
|
|
|
@@ -1034,7 +1034,7 @@ describe('SlackClient', () => {
|
|
|
1034
1034
|
}
|
|
1035
1035
|
|
|
1036
1036
|
try {
|
|
1037
|
-
const client = new SlackClient('xoxc-test-token', 'xoxd-test-cookie')
|
|
1037
|
+
const client = await new SlackClient().login({ token: 'xoxc-test-token', cookie: 'xoxd-test-cookie' })
|
|
1038
1038
|
// @ts-expect-error - accessing private property for testing
|
|
1039
1039
|
client.client = mockWebClient as unknown as WebClient
|
|
1040
1040
|
|
|
@@ -1080,7 +1080,7 @@ describe('SlackClient', () => {
|
|
|
1080
1080
|
has_more: false,
|
|
1081
1081
|
})
|
|
1082
1082
|
|
|
1083
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
1083
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
1084
1084
|
// @ts-expect-error - accessing private property for testing
|
|
1085
1085
|
client.client = mockWebClient as unknown as WebClient
|
|
1086
1086
|
|
|
@@ -1100,7 +1100,7 @@ describe('SlackClient', () => {
|
|
|
1100
1100
|
has_more: false,
|
|
1101
1101
|
})
|
|
1102
1102
|
|
|
1103
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
1103
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
1104
1104
|
// @ts-expect-error - accessing private property for testing
|
|
1105
1105
|
client.client = mockWebClient as unknown as WebClient
|
|
1106
1106
|
|
|
@@ -1117,7 +1117,7 @@ describe('SlackClient', () => {
|
|
|
1117
1117
|
has_more: false,
|
|
1118
1118
|
})
|
|
1119
1119
|
|
|
1120
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
1120
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
1121
1121
|
// @ts-expect-error - accessing private property for testing
|
|
1122
1122
|
client.client = mockWebClient as unknown as WebClient
|
|
1123
1123
|
|
|
@@ -1143,7 +1143,7 @@ describe('SlackClient', () => {
|
|
|
1143
1143
|
response_metadata: { next_cursor: 'cursor123' },
|
|
1144
1144
|
})
|
|
1145
1145
|
|
|
1146
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
1146
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
1147
1147
|
// @ts-expect-error - accessing private property for testing
|
|
1148
1148
|
client.client = mockWebClient as unknown as WebClient
|
|
1149
1149
|
|
|
@@ -1158,7 +1158,7 @@ describe('SlackClient', () => {
|
|
|
1158
1158
|
error: 'thread_not_found',
|
|
1159
1159
|
})
|
|
1160
1160
|
|
|
1161
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
1161
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
1162
1162
|
// @ts-expect-error - accessing private property for testing
|
|
1163
1163
|
client.client = mockWebClient as unknown as WebClient
|
|
1164
1164
|
|
|
@@ -1171,7 +1171,7 @@ describe('SlackClient', () => {
|
|
|
1171
1171
|
error: 'channel_not_found',
|
|
1172
1172
|
})
|
|
1173
1173
|
|
|
1174
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
1174
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
1175
1175
|
// @ts-expect-error - accessing private property for testing
|
|
1176
1176
|
client.client = mockWebClient as unknown as WebClient
|
|
1177
1177
|
|
|
@@ -1204,7 +1204,7 @@ describe('SlackClient', () => {
|
|
|
1204
1204
|
],
|
|
1205
1205
|
})
|
|
1206
1206
|
|
|
1207
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
1207
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
1208
1208
|
// @ts-expect-error - accessing private property for testing
|
|
1209
1209
|
client.client = mockWebClient as unknown as WebClient
|
|
1210
1210
|
|
|
@@ -1220,7 +1220,7 @@ describe('SlackClient', () => {
|
|
|
1220
1220
|
|
|
1221
1221
|
mockWebClient.conversations.list.mockRejectedValue(rateLimitError)
|
|
1222
1222
|
|
|
1223
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
1223
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
1224
1224
|
// @ts-expect-error - accessing private property for testing
|
|
1225
1225
|
client.client = mockWebClient as unknown as WebClient
|
|
1226
1226
|
|
|
@@ -1235,7 +1235,7 @@ describe('SlackClient', () => {
|
|
|
1235
1235
|
|
|
1236
1236
|
mockWebClient.conversations.list.mockRejectedValue(otherError)
|
|
1237
1237
|
|
|
1238
|
-
const client = new SlackClient('xoxc-token', 'xoxd-cookie')
|
|
1238
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
1239
1239
|
// @ts-expect-error - accessing private property for testing
|
|
1240
1240
|
client.client = mockWebClient as unknown as WebClient
|
|
1241
1241
|
|
|
@@ -1263,3 +1263,637 @@ describe('SlackClient', () => {
|
|
|
1263
1263
|
})
|
|
1264
1264
|
})
|
|
1265
1265
|
})
|
|
1266
|
+
|
|
1267
|
+
describe('SlackClient extended methods', () => {
|
|
1268
|
+
async function makeClient() {
|
|
1269
|
+
const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
|
|
1270
|
+
const mock: any = {
|
|
1271
|
+
pins: {
|
|
1272
|
+
add: mock_fn(() => Promise.resolve({ ok: true })),
|
|
1273
|
+
remove: mock_fn(() => Promise.resolve({ ok: true })),
|
|
1274
|
+
list: mock_fn(() => Promise.resolve({ ok: true, items: [] })),
|
|
1275
|
+
},
|
|
1276
|
+
conversations: {
|
|
1277
|
+
create: mock_fn(() => Promise.resolve({ ok: true, channel: { id: 'C001', name: 'test', is_private: false, is_archived: false, created: 0, creator: 'U001' } })),
|
|
1278
|
+
archive: mock_fn(() => Promise.resolve({ ok: true })),
|
|
1279
|
+
setTopic: mock_fn(() => Promise.resolve({ ok: true, topic: 'new-topic' })),
|
|
1280
|
+
setPurpose: mock_fn(() => Promise.resolve({ ok: true, purpose: 'new-purpose' })),
|
|
1281
|
+
invite: mock_fn(() => Promise.resolve({ ok: true, channel: { id: 'C001', name: 'test', is_private: false, is_archived: false, created: 0, creator: 'U001' } })),
|
|
1282
|
+
join: mock_fn(() => Promise.resolve({ ok: true, channel: { id: 'C001', name: 'test', is_private: false, is_archived: false, created: 0, creator: 'U001' } })),
|
|
1283
|
+
leave: mock_fn(() => Promise.resolve({ ok: true })),
|
|
1284
|
+
list: mock_fn(() => Promise.resolve({ ok: true, channels: [] })),
|
|
1285
|
+
},
|
|
1286
|
+
chat: {
|
|
1287
|
+
scheduleMessage: mock_fn(() => Promise.resolve({ ok: true, scheduled_message_id: 'SM001' })),
|
|
1288
|
+
scheduledMessages: {
|
|
1289
|
+
list: mock_fn(() => Promise.resolve({ ok: true, scheduled_messages: [] })),
|
|
1290
|
+
},
|
|
1291
|
+
deleteScheduledMessage: mock_fn(() => Promise.resolve({ ok: true })),
|
|
1292
|
+
postEphemeral: mock_fn(() => Promise.resolve({ ok: true, message_ts: '123.456' })),
|
|
1293
|
+
getPermalink: mock_fn(() => Promise.resolve({ ok: true, permalink: 'https://slack.com/archives/C001/p123456' })),
|
|
1294
|
+
},
|
|
1295
|
+
users: {
|
|
1296
|
+
lookupByEmail: mock_fn(() => Promise.resolve({ ok: true, user: { id: 'U001', name: 'test', real_name: 'Test User', is_admin: false, is_owner: false, is_bot: false, is_app_user: false } })),
|
|
1297
|
+
profile: {
|
|
1298
|
+
get: mock_fn(() => Promise.resolve({ ok: true, profile: { display_name: 'Test', status_text: '', status_emoji: '' } })),
|
|
1299
|
+
set: mock_fn(() => Promise.resolve({ ok: true, profile: { display_name: 'Test', status_text: 'Working', status_emoji: ':computer:' } })),
|
|
1300
|
+
},
|
|
1301
|
+
},
|
|
1302
|
+
reminders: {
|
|
1303
|
+
add: mock_fn(() => Promise.resolve({ ok: true, reminder: { id: 'Rm001', creator: 'U001', text: 'Test', user: 'U001', recurring: false, time: 1700000000, complete_ts: 0 } })),
|
|
1304
|
+
list: mock_fn(() => Promise.resolve({ ok: true, reminders: [] })),
|
|
1305
|
+
complete: mock_fn(() => Promise.resolve({ ok: true })),
|
|
1306
|
+
delete: mock_fn(() => Promise.resolve({ ok: true })),
|
|
1307
|
+
},
|
|
1308
|
+
files: {
|
|
1309
|
+
delete: mock_fn(() => Promise.resolve({ ok: true })),
|
|
1310
|
+
},
|
|
1311
|
+
emoji: {
|
|
1312
|
+
list: mock_fn(() => Promise.resolve({ ok: true, emoji: { party_blob: 'https://example.com/party_blob.gif' } })),
|
|
1313
|
+
},
|
|
1314
|
+
apiCall: mock_fn((method: string) => {
|
|
1315
|
+
if (method === 'bookmarks.add') return Promise.resolve({ ok: true, bookmark: { id: 'Bm001', channel_id: 'C001', title: 'Test', link: 'https://example.com', type: 'link', date_created: 0, date_updated: 0, created_by: 'U001' } })
|
|
1316
|
+
if (method === 'bookmarks.edit') return Promise.resolve({ ok: true, bookmark: { id: 'Bm001', channel_id: 'C001', title: 'Updated', link: 'https://example.com', type: 'link', date_created: 0, date_updated: 1, created_by: 'U001' } })
|
|
1317
|
+
if (method === 'bookmarks.remove') return Promise.resolve({ ok: true })
|
|
1318
|
+
if (method === 'bookmarks.list') return Promise.resolve({ ok: true, bookmarks: [] })
|
|
1319
|
+
if (method === 'usergroups.list') return Promise.resolve({ ok: true, usergroups: [{ id: 'S001', team_id: 'T001', name: 'Engineering', handle: 'engineering', description: 'Eng team', is_external: false, is_usergroup: true, date_create: 100, date_update: 200, date_delete: 0, auto_type: null, created_by: 'U001', updated_by: 'U001', deleted_by: null, prefs: { channels: [], groups: [] }, users: ['U001'], user_count: 1 }] })
|
|
1320
|
+
if (method === 'usergroups.create') return Promise.resolve({ ok: true, usergroup: { id: 'S002', team_id: 'T001', name: 'Marketing', handle: 'marketing', description: '', is_external: false, is_usergroup: true, date_create: 100, date_update: 100, date_delete: 0, auto_type: null, created_by: 'U001', updated_by: 'U001', deleted_by: null, prefs: { channels: [], groups: [] }, users: [], user_count: 0 } })
|
|
1321
|
+
if (method === 'usergroups.update') return Promise.resolve({ ok: true, usergroup: { id: 'S001', team_id: 'T001', name: 'Updated', handle: 'updated', description: 'New desc', is_external: false, is_usergroup: true, date_create: 100, date_update: 300, date_delete: 0, auto_type: null, created_by: 'U001', updated_by: 'U001', deleted_by: null, prefs: { channels: [], groups: [] }, users: ['U001'], user_count: 1 } })
|
|
1322
|
+
if (method === 'usergroups.disable') return Promise.resolve({ ok: true, usergroup: { id: 'S001', team_id: 'T001', name: 'Engineering', handle: 'engineering', description: '', is_external: false, is_usergroup: true, date_create: 100, date_update: 300, date_delete: 400, auto_type: null, created_by: 'U001', updated_by: 'U001', deleted_by: 'U001', prefs: { channels: [], groups: [] }, users: [], user_count: 0 } })
|
|
1323
|
+
if (method === 'usergroups.enable') return Promise.resolve({ ok: true, usergroup: { id: 'S001', team_id: 'T001', name: 'Engineering', handle: 'engineering', description: '', is_external: false, is_usergroup: true, date_create: 100, date_update: 500, date_delete: 0, auto_type: null, created_by: 'U001', updated_by: 'U001', deleted_by: null, prefs: { channels: [], groups: [] }, users: ['U001'], user_count: 1 } })
|
|
1324
|
+
if (method === 'usergroups.users.list') return Promise.resolve({ ok: true, users: ['U001', 'U002'] })
|
|
1325
|
+
if (method === 'usergroups.users.update') return Promise.resolve({ ok: true, usergroup: { id: 'S001', team_id: 'T001', name: 'Engineering', handle: 'engineering', description: '', is_external: false, is_usergroup: true, date_create: 100, date_update: 600, date_delete: 0, auto_type: null, created_by: 'U001', updated_by: 'U001', deleted_by: null, prefs: { channels: [], groups: [] }, users: ['U001', 'U003'], user_count: 2 } })
|
|
1326
|
+
return Promise.resolve({ ok: true })
|
|
1327
|
+
}),
|
|
1328
|
+
}
|
|
1329
|
+
// @ts-expect-error - accessing private property for testing
|
|
1330
|
+
client.client = mock
|
|
1331
|
+
return { client, mock }
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
function mock_fn(impl: (...args: any[]) => any) {
|
|
1335
|
+
return mock(impl)
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
describe('pinMessage', () => {
|
|
1339
|
+
test('calls pins.add with correct args', async () => {
|
|
1340
|
+
const { client, mock } = await makeClient()
|
|
1341
|
+
await client.pinMessage('C001', '123.456')
|
|
1342
|
+
expect(mock.pins.add).toHaveBeenCalledWith({ channel: 'C001', timestamp: '123.456' })
|
|
1343
|
+
})
|
|
1344
|
+
|
|
1345
|
+
test('throws SlackError on API failure', async () => {
|
|
1346
|
+
const { client, mock } = await makeClient()
|
|
1347
|
+
mock.pins.add.mockResolvedValue({ ok: false, error: 'not_pinned' })
|
|
1348
|
+
await expect(client.pinMessage('C001', '123.456')).rejects.toThrow(SlackError)
|
|
1349
|
+
})
|
|
1350
|
+
})
|
|
1351
|
+
|
|
1352
|
+
describe('unpinMessage', () => {
|
|
1353
|
+
test('calls pins.remove with correct args', async () => {
|
|
1354
|
+
const { client, mock } = await makeClient()
|
|
1355
|
+
await client.unpinMessage('C001', '123.456')
|
|
1356
|
+
expect(mock.pins.remove).toHaveBeenCalledWith({ channel: 'C001', timestamp: '123.456' })
|
|
1357
|
+
})
|
|
1358
|
+
|
|
1359
|
+
test('throws SlackError on API failure', async () => {
|
|
1360
|
+
const { client, mock } = await makeClient()
|
|
1361
|
+
mock.pins.remove.mockResolvedValue({ ok: false, error: 'no_pin' })
|
|
1362
|
+
await expect(client.unpinMessage('C001', '123.456')).rejects.toThrow(SlackError)
|
|
1363
|
+
})
|
|
1364
|
+
})
|
|
1365
|
+
|
|
1366
|
+
describe('listPins', () => {
|
|
1367
|
+
test('returns mapped pin items', async () => {
|
|
1368
|
+
const { client, mock } = await makeClient()
|
|
1369
|
+
mock.pins.list.mockResolvedValue({
|
|
1370
|
+
ok: true,
|
|
1371
|
+
items: [{ message: { ts: '1.2', text: 'hi', type: 'message' }, created: 100, created_by: 'U001' }],
|
|
1372
|
+
})
|
|
1373
|
+
const pins = await client.listPins('C001')
|
|
1374
|
+
expect(pins).toHaveLength(1)
|
|
1375
|
+
expect(pins[0].message.ts).toBe('1.2')
|
|
1376
|
+
expect(pins[0].created_by).toBe('U001')
|
|
1377
|
+
})
|
|
1378
|
+
|
|
1379
|
+
test('throws SlackError on API failure', async () => {
|
|
1380
|
+
const { client, mock } = await makeClient()
|
|
1381
|
+
mock.pins.list.mockResolvedValue({ ok: false, error: 'channel_not_found' })
|
|
1382
|
+
await expect(client.listPins('C001')).rejects.toThrow(SlackError)
|
|
1383
|
+
})
|
|
1384
|
+
})
|
|
1385
|
+
|
|
1386
|
+
describe('addBookmark', () => {
|
|
1387
|
+
test('calls bookmarks.add and returns bookmark', async () => {
|
|
1388
|
+
const { client } = await makeClient()
|
|
1389
|
+
const result = await client.addBookmark('C001', 'Test', 'https://example.com')
|
|
1390
|
+
expect(result.id).toBe('Bm001')
|
|
1391
|
+
expect(result.title).toBe('Test')
|
|
1392
|
+
})
|
|
1393
|
+
|
|
1394
|
+
test('throws SlackError on API failure', async () => {
|
|
1395
|
+
const { client, mock } = await makeClient()
|
|
1396
|
+
mock.apiCall.mockResolvedValue({ ok: false, error: 'channel_not_found' })
|
|
1397
|
+
await expect(client.addBookmark('C001', 'Test', 'https://example.com')).rejects.toThrow(SlackError)
|
|
1398
|
+
})
|
|
1399
|
+
})
|
|
1400
|
+
|
|
1401
|
+
describe('editBookmark', () => {
|
|
1402
|
+
test('calls bookmarks.edit and returns updated bookmark', async () => {
|
|
1403
|
+
const { client } = await makeClient()
|
|
1404
|
+
const result = await client.editBookmark('C001', 'Bm001', { title: 'Updated' })
|
|
1405
|
+
expect(result.title).toBe('Updated')
|
|
1406
|
+
})
|
|
1407
|
+
|
|
1408
|
+
test('throws SlackError on API failure', async () => {
|
|
1409
|
+
const { client, mock } = await makeClient()
|
|
1410
|
+
mock.apiCall.mockResolvedValue({ ok: false, error: 'bookmark_not_found' })
|
|
1411
|
+
await expect(client.editBookmark('C001', 'Bm001', { title: 'X' })).rejects.toThrow(SlackError)
|
|
1412
|
+
})
|
|
1413
|
+
})
|
|
1414
|
+
|
|
1415
|
+
describe('removeBookmark', () => {
|
|
1416
|
+
test('calls bookmarks.remove successfully', async () => {
|
|
1417
|
+
const { client, mock } = await makeClient()
|
|
1418
|
+
await client.removeBookmark('C001', 'Bm001')
|
|
1419
|
+
expect(mock.apiCall).toHaveBeenCalledWith('bookmarks.remove', { channel_id: 'C001', bookmark_id: 'Bm001' })
|
|
1420
|
+
})
|
|
1421
|
+
|
|
1422
|
+
test('throws SlackError on API failure', async () => {
|
|
1423
|
+
const { client, mock } = await makeClient()
|
|
1424
|
+
mock.apiCall.mockResolvedValue({ ok: false, error: 'bookmark_not_found' })
|
|
1425
|
+
await expect(client.removeBookmark('C001', 'Bm001')).rejects.toThrow(SlackError)
|
|
1426
|
+
})
|
|
1427
|
+
})
|
|
1428
|
+
|
|
1429
|
+
describe('listBookmarks', () => {
|
|
1430
|
+
test('returns empty array when no bookmarks', async () => {
|
|
1431
|
+
const { client } = await makeClient()
|
|
1432
|
+
const result = await client.listBookmarks('C001')
|
|
1433
|
+
expect(result).toHaveLength(0)
|
|
1434
|
+
})
|
|
1435
|
+
|
|
1436
|
+
test('throws SlackError on API failure', async () => {
|
|
1437
|
+
const { client, mock } = await makeClient()
|
|
1438
|
+
mock.apiCall.mockResolvedValue({ ok: false, error: 'channel_not_found' })
|
|
1439
|
+
await expect(client.listBookmarks('C001')).rejects.toThrow(SlackError)
|
|
1440
|
+
})
|
|
1441
|
+
})
|
|
1442
|
+
|
|
1443
|
+
describe('scheduleMessage', () => {
|
|
1444
|
+
test('returns scheduled message with id', async () => {
|
|
1445
|
+
const { client } = await makeClient()
|
|
1446
|
+
const result = await client.scheduleMessage('C001', 'Hello', 1700000000)
|
|
1447
|
+
expect(result.id).toBe('SM001')
|
|
1448
|
+
expect(result.text).toBe('Hello')
|
|
1449
|
+
expect(result.channel_id).toBe('C001')
|
|
1450
|
+
})
|
|
1451
|
+
|
|
1452
|
+
test('throws SlackError on API failure', async () => {
|
|
1453
|
+
const { client, mock } = await makeClient()
|
|
1454
|
+
mock.chat.scheduleMessage.mockResolvedValue({ ok: false, error: 'invalid_time' })
|
|
1455
|
+
await expect(client.scheduleMessage('C001', 'Hello', 1700000000)).rejects.toThrow(SlackError)
|
|
1456
|
+
})
|
|
1457
|
+
})
|
|
1458
|
+
|
|
1459
|
+
describe('listScheduledMessages', () => {
|
|
1460
|
+
test('returns empty array when no scheduled messages', async () => {
|
|
1461
|
+
const { client } = await makeClient()
|
|
1462
|
+
const result = await client.listScheduledMessages()
|
|
1463
|
+
expect(result).toHaveLength(0)
|
|
1464
|
+
})
|
|
1465
|
+
|
|
1466
|
+
test('throws SlackError on API failure', async () => {
|
|
1467
|
+
const { client, mock } = await makeClient()
|
|
1468
|
+
mock.chat.scheduledMessages.list.mockResolvedValue({ ok: false, error: 'invalid_auth' })
|
|
1469
|
+
await expect(client.listScheduledMessages()).rejects.toThrow(SlackError)
|
|
1470
|
+
})
|
|
1471
|
+
})
|
|
1472
|
+
|
|
1473
|
+
describe('deleteScheduledMessage', () => {
|
|
1474
|
+
test('calls deleteScheduledMessage with correct args', async () => {
|
|
1475
|
+
const { client, mock } = await makeClient()
|
|
1476
|
+
await client.deleteScheduledMessage('C001', 'SM001')
|
|
1477
|
+
expect(mock.chat.deleteScheduledMessage).toHaveBeenCalledWith({ channel: 'C001', scheduled_message_id: 'SM001' })
|
|
1478
|
+
})
|
|
1479
|
+
|
|
1480
|
+
test('throws SlackError on API failure', async () => {
|
|
1481
|
+
const { client, mock } = await makeClient()
|
|
1482
|
+
mock.chat.deleteScheduledMessage.mockResolvedValue({ ok: false, error: 'invalid_scheduled_message_id' })
|
|
1483
|
+
await expect(client.deleteScheduledMessage('C001', 'SM001')).rejects.toThrow(SlackError)
|
|
1484
|
+
})
|
|
1485
|
+
})
|
|
1486
|
+
|
|
1487
|
+
describe('createChannel', () => {
|
|
1488
|
+
test('returns created channel', async () => {
|
|
1489
|
+
const { client } = await makeClient()
|
|
1490
|
+
const ch = await client.createChannel('new-channel')
|
|
1491
|
+
expect(ch.id).toBe('C001')
|
|
1492
|
+
expect(ch.name).toBe('test')
|
|
1493
|
+
})
|
|
1494
|
+
|
|
1495
|
+
test('throws SlackError on API failure', async () => {
|
|
1496
|
+
const { client, mock } = await makeClient()
|
|
1497
|
+
mock.conversations.create.mockResolvedValue({ ok: false, error: 'name_taken' })
|
|
1498
|
+
await expect(client.createChannel('existing')).rejects.toThrow(SlackError)
|
|
1499
|
+
})
|
|
1500
|
+
})
|
|
1501
|
+
|
|
1502
|
+
describe('archiveChannel', () => {
|
|
1503
|
+
test('archives channel successfully', async () => {
|
|
1504
|
+
const { client, mock } = await makeClient()
|
|
1505
|
+
await client.archiveChannel('C001')
|
|
1506
|
+
expect(mock.conversations.archive).toHaveBeenCalledWith({ channel: 'C001' })
|
|
1507
|
+
})
|
|
1508
|
+
|
|
1509
|
+
test('throws SlackError on API failure', async () => {
|
|
1510
|
+
const { client, mock } = await makeClient()
|
|
1511
|
+
mock.conversations.archive.mockResolvedValue({ ok: false, error: 'already_archived' })
|
|
1512
|
+
await expect(client.archiveChannel('C001')).rejects.toThrow(SlackError)
|
|
1513
|
+
})
|
|
1514
|
+
})
|
|
1515
|
+
|
|
1516
|
+
describe('setChannelTopic', () => {
|
|
1517
|
+
test('returns new topic', async () => {
|
|
1518
|
+
const { client } = await makeClient()
|
|
1519
|
+
const result = await client.setChannelTopic('C001', 'new-topic')
|
|
1520
|
+
expect(result.topic).toBe('new-topic')
|
|
1521
|
+
})
|
|
1522
|
+
|
|
1523
|
+
test('throws SlackError on API failure', async () => {
|
|
1524
|
+
const { client, mock } = await makeClient()
|
|
1525
|
+
mock.conversations.setTopic.mockResolvedValue({ ok: false, error: 'channel_not_found' })
|
|
1526
|
+
await expect(client.setChannelTopic('C001', 'topic')).rejects.toThrow(SlackError)
|
|
1527
|
+
})
|
|
1528
|
+
})
|
|
1529
|
+
|
|
1530
|
+
describe('setChannelPurpose', () => {
|
|
1531
|
+
test('returns new purpose', async () => {
|
|
1532
|
+
const { client } = await makeClient()
|
|
1533
|
+
const result = await client.setChannelPurpose('C001', 'new-purpose')
|
|
1534
|
+
expect(result.purpose).toBe('new-purpose')
|
|
1535
|
+
})
|
|
1536
|
+
|
|
1537
|
+
test('throws SlackError on API failure', async () => {
|
|
1538
|
+
const { client, mock } = await makeClient()
|
|
1539
|
+
mock.conversations.setPurpose.mockResolvedValue({ ok: false, error: 'channel_not_found' })
|
|
1540
|
+
await expect(client.setChannelPurpose('C001', 'purpose')).rejects.toThrow(SlackError)
|
|
1541
|
+
})
|
|
1542
|
+
})
|
|
1543
|
+
|
|
1544
|
+
describe('inviteToChannel', () => {
|
|
1545
|
+
test('returns channel after invite', async () => {
|
|
1546
|
+
const { client } = await makeClient()
|
|
1547
|
+
const ch = await client.inviteToChannel('C001', 'U002')
|
|
1548
|
+
expect(ch.id).toBe('C001')
|
|
1549
|
+
})
|
|
1550
|
+
|
|
1551
|
+
test('throws SlackError on API failure', async () => {
|
|
1552
|
+
const { client, mock } = await makeClient()
|
|
1553
|
+
mock.conversations.invite.mockResolvedValue({ ok: false, error: 'user_not_found' })
|
|
1554
|
+
await expect(client.inviteToChannel('C001', 'U999')).rejects.toThrow(SlackError)
|
|
1555
|
+
})
|
|
1556
|
+
})
|
|
1557
|
+
|
|
1558
|
+
describe('joinChannel', () => {
|
|
1559
|
+
test('returns channel after joining', async () => {
|
|
1560
|
+
const { client } = await makeClient()
|
|
1561
|
+
const ch = await client.joinChannel('C001')
|
|
1562
|
+
expect(ch.id).toBe('C001')
|
|
1563
|
+
})
|
|
1564
|
+
|
|
1565
|
+
test('throws SlackError on API failure', async () => {
|
|
1566
|
+
const { client, mock } = await makeClient()
|
|
1567
|
+
mock.conversations.join.mockResolvedValue({ ok: false, error: 'channel_not_found' })
|
|
1568
|
+
await expect(client.joinChannel('C001')).rejects.toThrow(SlackError)
|
|
1569
|
+
})
|
|
1570
|
+
})
|
|
1571
|
+
|
|
1572
|
+
describe('leaveChannel', () => {
|
|
1573
|
+
test('leaves channel successfully', async () => {
|
|
1574
|
+
const { client, mock } = await makeClient()
|
|
1575
|
+
await client.leaveChannel('C001')
|
|
1576
|
+
expect(mock.conversations.leave).toHaveBeenCalledWith({ channel: 'C001' })
|
|
1577
|
+
})
|
|
1578
|
+
|
|
1579
|
+
test('throws SlackError on API failure', async () => {
|
|
1580
|
+
const { client, mock } = await makeClient()
|
|
1581
|
+
mock.conversations.leave.mockResolvedValue({ ok: false, error: 'channel_not_found' })
|
|
1582
|
+
await expect(client.leaveChannel('C001')).rejects.toThrow(SlackError)
|
|
1583
|
+
})
|
|
1584
|
+
})
|
|
1585
|
+
|
|
1586
|
+
describe('lookupUserByEmail', () => {
|
|
1587
|
+
test('returns user for given email', async () => {
|
|
1588
|
+
const { client } = await makeClient()
|
|
1589
|
+
const user = await client.lookupUserByEmail('test@example.com')
|
|
1590
|
+
expect(user.id).toBe('U001')
|
|
1591
|
+
expect(user.name).toBe('test')
|
|
1592
|
+
})
|
|
1593
|
+
|
|
1594
|
+
test('throws SlackError on API failure', async () => {
|
|
1595
|
+
const { client, mock } = await makeClient()
|
|
1596
|
+
mock.users.lookupByEmail.mockResolvedValue({ ok: false, error: 'users_not_found' })
|
|
1597
|
+
await expect(client.lookupUserByEmail('nobody@example.com')).rejects.toThrow(SlackError)
|
|
1598
|
+
})
|
|
1599
|
+
})
|
|
1600
|
+
|
|
1601
|
+
describe('getUserProfile', () => {
|
|
1602
|
+
test('returns user profile', async () => {
|
|
1603
|
+
const { client } = await makeClient()
|
|
1604
|
+
const profile = await client.getUserProfile('U001')
|
|
1605
|
+
expect(profile.display_name).toBe('Test')
|
|
1606
|
+
})
|
|
1607
|
+
|
|
1608
|
+
test('throws SlackError on API failure', async () => {
|
|
1609
|
+
const { client, mock } = await makeClient()
|
|
1610
|
+
mock.users.profile.get.mockResolvedValue({ ok: false, error: 'user_not_found' })
|
|
1611
|
+
await expect(client.getUserProfile('U999')).rejects.toThrow(SlackError)
|
|
1612
|
+
})
|
|
1613
|
+
})
|
|
1614
|
+
|
|
1615
|
+
describe('setUserProfile', () => {
|
|
1616
|
+
test('returns updated profile', async () => {
|
|
1617
|
+
const { client } = await makeClient()
|
|
1618
|
+
const profile = await client.setUserProfile({ status_text: 'Working', status_emoji: ':computer:' })
|
|
1619
|
+
expect(profile.status_text).toBe('Working')
|
|
1620
|
+
})
|
|
1621
|
+
|
|
1622
|
+
test('throws SlackError on API failure', async () => {
|
|
1623
|
+
const { client, mock } = await makeClient()
|
|
1624
|
+
mock.users.profile.set.mockResolvedValue({ ok: false, error: 'invalid_profile' })
|
|
1625
|
+
await expect(client.setUserProfile({ status_text: 'x' })).rejects.toThrow(SlackError)
|
|
1626
|
+
})
|
|
1627
|
+
})
|
|
1628
|
+
|
|
1629
|
+
describe('postEphemeral', () => {
|
|
1630
|
+
test('returns message_ts on success', async () => {
|
|
1631
|
+
const { client } = await makeClient()
|
|
1632
|
+
const ts = await client.postEphemeral('C001', 'U001', 'Hello!')
|
|
1633
|
+
expect(ts).toBe('123.456')
|
|
1634
|
+
})
|
|
1635
|
+
|
|
1636
|
+
test('throws SlackError on API failure', async () => {
|
|
1637
|
+
const { client, mock } = await makeClient()
|
|
1638
|
+
mock.chat.postEphemeral.mockResolvedValue({ ok: false, error: 'user_not_in_channel' })
|
|
1639
|
+
await expect(client.postEphemeral('C001', 'U001', 'Hello!')).rejects.toThrow(SlackError)
|
|
1640
|
+
})
|
|
1641
|
+
})
|
|
1642
|
+
|
|
1643
|
+
describe('getPermalink', () => {
|
|
1644
|
+
test('returns permalink on success', async () => {
|
|
1645
|
+
const { client } = await makeClient()
|
|
1646
|
+
const link = await client.getPermalink('C001', '123.456')
|
|
1647
|
+
expect(link).toBe('https://slack.com/archives/C001/p123456')
|
|
1648
|
+
})
|
|
1649
|
+
|
|
1650
|
+
test('throws SlackError on API failure', async () => {
|
|
1651
|
+
const { client, mock } = await makeClient()
|
|
1652
|
+
mock.chat.getPermalink.mockResolvedValue({ ok: false, error: 'message_not_found' })
|
|
1653
|
+
await expect(client.getPermalink('C001', '123.456')).rejects.toThrow(SlackError)
|
|
1654
|
+
})
|
|
1655
|
+
})
|
|
1656
|
+
|
|
1657
|
+
describe('addReminder', () => {
|
|
1658
|
+
test('returns reminder on success', async () => {
|
|
1659
|
+
const { client } = await makeClient()
|
|
1660
|
+
const reminder = await client.addReminder('Do something', 1700000000)
|
|
1661
|
+
expect(reminder.id).toBe('Rm001')
|
|
1662
|
+
expect(reminder.text).toBe('Test')
|
|
1663
|
+
})
|
|
1664
|
+
|
|
1665
|
+
test('throws SlackError on API failure', async () => {
|
|
1666
|
+
const { client, mock } = await makeClient()
|
|
1667
|
+
mock.reminders.add.mockResolvedValue({ ok: false, error: 'invalid_time' })
|
|
1668
|
+
await expect(client.addReminder('Do something', 1700000000)).rejects.toThrow(SlackError)
|
|
1669
|
+
})
|
|
1670
|
+
})
|
|
1671
|
+
|
|
1672
|
+
describe('listReminders', () => {
|
|
1673
|
+
test('returns empty array when no reminders', async () => {
|
|
1674
|
+
const { client } = await makeClient()
|
|
1675
|
+
const result = await client.listReminders()
|
|
1676
|
+
expect(result).toHaveLength(0)
|
|
1677
|
+
})
|
|
1678
|
+
|
|
1679
|
+
test('throws SlackError on API failure', async () => {
|
|
1680
|
+
const { client, mock } = await makeClient()
|
|
1681
|
+
mock.reminders.list.mockResolvedValue({ ok: false, error: 'invalid_auth' })
|
|
1682
|
+
await expect(client.listReminders()).rejects.toThrow(SlackError)
|
|
1683
|
+
})
|
|
1684
|
+
})
|
|
1685
|
+
|
|
1686
|
+
describe('completeReminder', () => {
|
|
1687
|
+
test('completes reminder successfully', async () => {
|
|
1688
|
+
const { client, mock } = await makeClient()
|
|
1689
|
+
await client.completeReminder('Rm001')
|
|
1690
|
+
expect(mock.reminders.complete).toHaveBeenCalledWith({ reminder: 'Rm001' })
|
|
1691
|
+
})
|
|
1692
|
+
|
|
1693
|
+
test('throws SlackError on API failure', async () => {
|
|
1694
|
+
const { client, mock } = await makeClient()
|
|
1695
|
+
mock.reminders.complete.mockResolvedValue({ ok: false, error: 'reminder_not_found' })
|
|
1696
|
+
await expect(client.completeReminder('Rm999')).rejects.toThrow(SlackError)
|
|
1697
|
+
})
|
|
1698
|
+
})
|
|
1699
|
+
|
|
1700
|
+
describe('deleteReminder', () => {
|
|
1701
|
+
test('deletes reminder successfully', async () => {
|
|
1702
|
+
const { client, mock } = await makeClient()
|
|
1703
|
+
await client.deleteReminder('Rm001')
|
|
1704
|
+
expect(mock.reminders.delete).toHaveBeenCalledWith({ reminder: 'Rm001' })
|
|
1705
|
+
})
|
|
1706
|
+
|
|
1707
|
+
test('throws SlackError on API failure', async () => {
|
|
1708
|
+
const { client, mock } = await makeClient()
|
|
1709
|
+
mock.reminders.delete.mockResolvedValue({ ok: false, error: 'reminder_not_found' })
|
|
1710
|
+
await expect(client.deleteReminder('Rm999')).rejects.toThrow(SlackError)
|
|
1711
|
+
})
|
|
1712
|
+
})
|
|
1713
|
+
|
|
1714
|
+
describe('deleteFile', () => {
|
|
1715
|
+
test('deletes file successfully', async () => {
|
|
1716
|
+
const { client, mock } = await makeClient()
|
|
1717
|
+
await client.deleteFile('F001')
|
|
1718
|
+
expect(mock.files.delete).toHaveBeenCalledWith({ file: 'F001' })
|
|
1719
|
+
})
|
|
1720
|
+
|
|
1721
|
+
test('throws SlackError on API failure', async () => {
|
|
1722
|
+
const { client, mock } = await makeClient()
|
|
1723
|
+
mock.files.delete.mockResolvedValue({ ok: false, error: 'file_not_found' })
|
|
1724
|
+
await expect(client.deleteFile('F999')).rejects.toThrow(SlackError)
|
|
1725
|
+
})
|
|
1726
|
+
})
|
|
1727
|
+
|
|
1728
|
+
describe('listEmoji', () => {
|
|
1729
|
+
test('returns emoji map on success', async () => {
|
|
1730
|
+
const { client } = await makeClient()
|
|
1731
|
+
const emoji = await client.listEmoji()
|
|
1732
|
+
expect(emoji['party_blob']).toBe('https://example.com/party_blob.gif')
|
|
1733
|
+
})
|
|
1734
|
+
|
|
1735
|
+
test('throws SlackError on API failure', async () => {
|
|
1736
|
+
const { client, mock } = await makeClient()
|
|
1737
|
+
mock.emoji.list.mockResolvedValue({ ok: false, error: 'invalid_auth' })
|
|
1738
|
+
await expect(client.listEmoji()).rejects.toThrow(SlackError)
|
|
1739
|
+
})
|
|
1740
|
+
})
|
|
1741
|
+
|
|
1742
|
+
describe('listUsergroups', () => {
|
|
1743
|
+
test('returns mapped usergroups', async () => {
|
|
1744
|
+
const { client } = await makeClient()
|
|
1745
|
+
const groups = await client.listUsergroups({ includeCount: true })
|
|
1746
|
+
expect(groups).toHaveLength(1)
|
|
1747
|
+
expect(groups[0].id).toBe('S001')
|
|
1748
|
+
expect(groups[0].name).toBe('Engineering')
|
|
1749
|
+
expect(groups[0].handle).toBe('engineering')
|
|
1750
|
+
expect(groups[0].user_count).toBe(1)
|
|
1751
|
+
})
|
|
1752
|
+
|
|
1753
|
+
test('calls apiCall with correct params', async () => {
|
|
1754
|
+
const { client, mock } = await makeClient()
|
|
1755
|
+
await client.listUsergroups({ includeDisabled: true, includeUsers: true, includeCount: true })
|
|
1756
|
+
expect(mock.apiCall).toHaveBeenCalledWith('usergroups.list', {
|
|
1757
|
+
include_disabled: true,
|
|
1758
|
+
include_users: true,
|
|
1759
|
+
include_count: true,
|
|
1760
|
+
})
|
|
1761
|
+
})
|
|
1762
|
+
|
|
1763
|
+
test('throws SlackError on API failure', async () => {
|
|
1764
|
+
const { client, mock } = await makeClient()
|
|
1765
|
+
mock.apiCall.mockResolvedValue({ ok: false, error: 'invalid_auth' })
|
|
1766
|
+
await expect(client.listUsergroups()).rejects.toThrow(SlackError)
|
|
1767
|
+
})
|
|
1768
|
+
})
|
|
1769
|
+
|
|
1770
|
+
describe('createUsergroup', () => {
|
|
1771
|
+
test('returns created usergroup', async () => {
|
|
1772
|
+
const { client } = await makeClient()
|
|
1773
|
+
const group = await client.createUsergroup('Marketing', { handle: 'marketing' })
|
|
1774
|
+
expect(group.id).toBe('S002')
|
|
1775
|
+
expect(group.name).toBe('Marketing')
|
|
1776
|
+
})
|
|
1777
|
+
|
|
1778
|
+
test('calls apiCall with correct params including channels', async () => {
|
|
1779
|
+
const { client, mock } = await makeClient()
|
|
1780
|
+
await client.createUsergroup('Marketing', { handle: 'marketing', description: 'Mktg', channels: ['C001', 'C002'] })
|
|
1781
|
+
expect(mock.apiCall).toHaveBeenCalledWith('usergroups.create', {
|
|
1782
|
+
name: 'Marketing',
|
|
1783
|
+
handle: 'marketing',
|
|
1784
|
+
description: 'Mktg',
|
|
1785
|
+
channels: 'C001,C002',
|
|
1786
|
+
})
|
|
1787
|
+
})
|
|
1788
|
+
|
|
1789
|
+
test('throws SlackError on API failure', async () => {
|
|
1790
|
+
const { client, mock } = await makeClient()
|
|
1791
|
+
mock.apiCall.mockResolvedValue({ ok: false, error: 'name_already_exists' })
|
|
1792
|
+
await expect(client.createUsergroup('Dup')).rejects.toThrow(SlackError)
|
|
1793
|
+
})
|
|
1794
|
+
})
|
|
1795
|
+
|
|
1796
|
+
describe('updateUsergroup', () => {
|
|
1797
|
+
test('returns updated usergroup', async () => {
|
|
1798
|
+
const { client } = await makeClient()
|
|
1799
|
+
const group = await client.updateUsergroup('S001', { name: 'Updated', handle: 'updated' })
|
|
1800
|
+
expect(group.name).toBe('Updated')
|
|
1801
|
+
expect(group.handle).toBe('updated')
|
|
1802
|
+
})
|
|
1803
|
+
|
|
1804
|
+
test('calls apiCall with correct params', async () => {
|
|
1805
|
+
const { client, mock } = await makeClient()
|
|
1806
|
+
await client.updateUsergroup('S001', { name: 'New', channels: ['C001'] })
|
|
1807
|
+
expect(mock.apiCall).toHaveBeenCalledWith('usergroups.update', {
|
|
1808
|
+
usergroup: 'S001',
|
|
1809
|
+
name: 'New',
|
|
1810
|
+
handle: undefined,
|
|
1811
|
+
description: undefined,
|
|
1812
|
+
channels: 'C001',
|
|
1813
|
+
})
|
|
1814
|
+
})
|
|
1815
|
+
|
|
1816
|
+
test('throws SlackError on API failure', async () => {
|
|
1817
|
+
const { client, mock } = await makeClient()
|
|
1818
|
+
mock.apiCall.mockResolvedValue({ ok: false, error: 'no_such_subteam' })
|
|
1819
|
+
await expect(client.updateUsergroup('S999', { name: 'X' })).rejects.toThrow(SlackError)
|
|
1820
|
+
})
|
|
1821
|
+
})
|
|
1822
|
+
|
|
1823
|
+
describe('disableUsergroup', () => {
|
|
1824
|
+
test('returns disabled usergroup with date_delete set', async () => {
|
|
1825
|
+
const { client } = await makeClient()
|
|
1826
|
+
const group = await client.disableUsergroup('S001')
|
|
1827
|
+
expect(group.id).toBe('S001')
|
|
1828
|
+
expect(group.date_delete).toBeGreaterThan(0)
|
|
1829
|
+
})
|
|
1830
|
+
|
|
1831
|
+
test('throws SlackError on API failure', async () => {
|
|
1832
|
+
const { client, mock } = await makeClient()
|
|
1833
|
+
mock.apiCall.mockResolvedValue({ ok: false, error: 'no_such_subteam' })
|
|
1834
|
+
await expect(client.disableUsergroup('S999')).rejects.toThrow(SlackError)
|
|
1835
|
+
})
|
|
1836
|
+
})
|
|
1837
|
+
|
|
1838
|
+
describe('enableUsergroup', () => {
|
|
1839
|
+
test('returns enabled usergroup with date_delete cleared', async () => {
|
|
1840
|
+
const { client } = await makeClient()
|
|
1841
|
+
const group = await client.enableUsergroup('S001')
|
|
1842
|
+
expect(group.id).toBe('S001')
|
|
1843
|
+
expect(group.date_delete).toBe(0)
|
|
1844
|
+
})
|
|
1845
|
+
|
|
1846
|
+
test('throws SlackError on API failure', async () => {
|
|
1847
|
+
const { client, mock } = await makeClient()
|
|
1848
|
+
mock.apiCall.mockResolvedValue({ ok: false, error: 'no_such_subteam' })
|
|
1849
|
+
await expect(client.enableUsergroup('S999')).rejects.toThrow(SlackError)
|
|
1850
|
+
})
|
|
1851
|
+
})
|
|
1852
|
+
|
|
1853
|
+
describe('listUsergroupMembers', () => {
|
|
1854
|
+
test('returns user ID array', async () => {
|
|
1855
|
+
const { client } = await makeClient()
|
|
1856
|
+
const users = await client.listUsergroupMembers('S001')
|
|
1857
|
+
expect(users).toEqual(['U001', 'U002'])
|
|
1858
|
+
})
|
|
1859
|
+
|
|
1860
|
+
test('calls apiCall with correct params', async () => {
|
|
1861
|
+
const { client, mock } = await makeClient()
|
|
1862
|
+
await client.listUsergroupMembers('S001', { includeDisabled: true })
|
|
1863
|
+
expect(mock.apiCall).toHaveBeenCalledWith('usergroups.users.list', {
|
|
1864
|
+
usergroup: 'S001',
|
|
1865
|
+
include_disabled: true,
|
|
1866
|
+
})
|
|
1867
|
+
})
|
|
1868
|
+
|
|
1869
|
+
test('throws SlackError on API failure', async () => {
|
|
1870
|
+
const { client, mock } = await makeClient()
|
|
1871
|
+
mock.apiCall.mockResolvedValue({ ok: false, error: 'no_such_subteam' })
|
|
1872
|
+
await expect(client.listUsergroupMembers('S999')).rejects.toThrow(SlackError)
|
|
1873
|
+
})
|
|
1874
|
+
})
|
|
1875
|
+
|
|
1876
|
+
describe('updateUsergroupMembers', () => {
|
|
1877
|
+
test('returns updated usergroup with new members', async () => {
|
|
1878
|
+
const { client } = await makeClient()
|
|
1879
|
+
const group = await client.updateUsergroupMembers('S001', ['U001', 'U003'])
|
|
1880
|
+
expect(group.users).toEqual(['U001', 'U003'])
|
|
1881
|
+
expect(group.user_count).toBe(2)
|
|
1882
|
+
})
|
|
1883
|
+
|
|
1884
|
+
test('calls apiCall with comma-joined user IDs', async () => {
|
|
1885
|
+
const { client, mock } = await makeClient()
|
|
1886
|
+
await client.updateUsergroupMembers('S001', ['U001', 'U003'])
|
|
1887
|
+
expect(mock.apiCall).toHaveBeenCalledWith('usergroups.users.update', {
|
|
1888
|
+
usergroup: 'S001',
|
|
1889
|
+
users: 'U001,U003',
|
|
1890
|
+
})
|
|
1891
|
+
})
|
|
1892
|
+
|
|
1893
|
+
test('throws SlackError on API failure', async () => {
|
|
1894
|
+
const { client, mock } = await makeClient()
|
|
1895
|
+
mock.apiCall.mockResolvedValue({ ok: false, error: 'no_users_provided' })
|
|
1896
|
+
await expect(client.updateUsergroupMembers('S001', [])).rejects.toThrow(SlackError)
|
|
1897
|
+
})
|
|
1898
|
+
})
|
|
1899
|
+
})
|