@zhin.js/adapter-slack 1.0.36 → 1.0.38
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/CHANGELOG.md +14 -0
- package/lib/adapter.d.ts +20 -0
- package/lib/adapter.d.ts.map +1 -0
- package/lib/adapter.js +310 -0
- package/lib/adapter.js.map +1 -0
- package/lib/bot.d.ts +104 -0
- package/lib/bot.d.ts.map +1 -0
- package/lib/bot.js +620 -0
- package/lib/bot.js.map +1 -0
- package/lib/index.d.ts +4 -130
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +9 -925
- package/lib/index.js.map +1 -1
- package/lib/types.d.ts +17 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +2 -0
- package/lib/types.js.map +1 -0
- package/package.json +7 -3
- package/skills/slack/SKILL.md +17 -0
- package/src/adapter.ts +321 -0
- package/src/bot.ts +691 -0
- package/src/index.ts +31 -0
- package/src/types.ts +18 -0
package/lib/index.d.ts
CHANGED
|
@@ -1,136 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { KnownEventFromType } from "@slack/bolt";
|
|
3
|
-
import { Bot, Adapter, Plugin, Message, SendOptions } from "zhin.js";
|
|
1
|
+
import { SlackAdapter } from "./adapter.js";
|
|
4
2
|
declare module "zhin.js" {
|
|
5
3
|
interface Adapters {
|
|
6
4
|
slack: SlackAdapter;
|
|
7
5
|
}
|
|
8
6
|
}
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
name: string;
|
|
13
|
-
signingSecret: string;
|
|
14
|
-
appToken?: string;
|
|
15
|
-
socketMode?: boolean;
|
|
16
|
-
port?: number;
|
|
17
|
-
logLevel?: LogLevel;
|
|
18
|
-
}
|
|
19
|
-
export interface SlackBot {
|
|
20
|
-
$config: SlackBotConfig;
|
|
21
|
-
}
|
|
22
|
-
type SlackMessageEvent = KnownEventFromType<"message">;
|
|
23
|
-
export declare class SlackBot implements Bot<SlackBotConfig, SlackMessageEvent> {
|
|
24
|
-
adapter: SlackAdapter;
|
|
25
|
-
$config: SlackBotConfig;
|
|
26
|
-
$connected: boolean;
|
|
27
|
-
private app;
|
|
28
|
-
private client;
|
|
29
|
-
get $id(): string;
|
|
30
|
-
constructor(adapter: SlackAdapter, $config: SlackBotConfig);
|
|
31
|
-
$connect(): Promise<void>;
|
|
32
|
-
$disconnect(): Promise<void>;
|
|
33
|
-
private handleSlackMessage;
|
|
34
|
-
$formatMessage(msg: SlackMessageEvent): Message<SlackMessageEvent>;
|
|
35
|
-
private parseMessageContent;
|
|
36
|
-
private parseSlackText;
|
|
37
|
-
$sendMessage(options: SendOptions): Promise<string>;
|
|
38
|
-
private sendContentToChannel;
|
|
39
|
-
$recallMessage(id: string): Promise<void>;
|
|
40
|
-
/**
|
|
41
|
-
* 邀请用户到频道
|
|
42
|
-
* @param channel 频道 ID
|
|
43
|
-
* @param users 用户 ID 列表
|
|
44
|
-
*/
|
|
45
|
-
inviteToChannel(channel: string, users: string[]): Promise<boolean>;
|
|
46
|
-
/**
|
|
47
|
-
* 从频道踢出用户
|
|
48
|
-
* @param channel 频道 ID
|
|
49
|
-
* @param user 用户 ID
|
|
50
|
-
*/
|
|
51
|
-
kickFromChannel(channel: string, user: string): Promise<boolean>;
|
|
52
|
-
/**
|
|
53
|
-
* 设置频道话题
|
|
54
|
-
* @param channel 频道 ID
|
|
55
|
-
* @param topic 话题
|
|
56
|
-
*/
|
|
57
|
-
setChannelTopic(channel: string, topic: string): Promise<boolean>;
|
|
58
|
-
/**
|
|
59
|
-
* 设置频道目的
|
|
60
|
-
* @param channel 频道 ID
|
|
61
|
-
* @param purpose 目的
|
|
62
|
-
*/
|
|
63
|
-
setChannelPurpose(channel: string, purpose: string): Promise<boolean>;
|
|
64
|
-
/**
|
|
65
|
-
* 归档频道
|
|
66
|
-
* @param channel 频道 ID
|
|
67
|
-
*/
|
|
68
|
-
archiveChannel(channel: string): Promise<boolean>;
|
|
69
|
-
/**
|
|
70
|
-
* 取消归档频道
|
|
71
|
-
* @param channel 频道 ID
|
|
72
|
-
*/
|
|
73
|
-
unarchiveChannel(channel: string): Promise<boolean>;
|
|
74
|
-
/**
|
|
75
|
-
* 重命名频道
|
|
76
|
-
* @param channel 频道 ID
|
|
77
|
-
* @param name 新名称
|
|
78
|
-
*/
|
|
79
|
-
renameChannel(channel: string, name: string): Promise<boolean>;
|
|
80
|
-
/**
|
|
81
|
-
* 获取频道成员列表
|
|
82
|
-
* @param channel 频道 ID
|
|
83
|
-
*/
|
|
84
|
-
getChannelMembers(channel: string): Promise<string[]>;
|
|
85
|
-
/**
|
|
86
|
-
* 获取频道信息
|
|
87
|
-
* @param channel 频道 ID
|
|
88
|
-
*/
|
|
89
|
-
getChannelInfo(channel: string): Promise<any>;
|
|
90
|
-
/**
|
|
91
|
-
* 获取用户信息
|
|
92
|
-
* @param user 用户 ID
|
|
93
|
-
*/
|
|
94
|
-
getUserInfo(user: string): Promise<any>;
|
|
95
|
-
/**
|
|
96
|
-
* 添加消息反应
|
|
97
|
-
* @param channel 频道 ID
|
|
98
|
-
* @param timestamp 消息时间戳
|
|
99
|
-
* @param name 表情名称
|
|
100
|
-
*/
|
|
101
|
-
addReaction(channel: string, timestamp: string, name: string): Promise<boolean>;
|
|
102
|
-
/**
|
|
103
|
-
* 移除消息反应
|
|
104
|
-
* @param channel 频道 ID
|
|
105
|
-
* @param timestamp 消息时间戳
|
|
106
|
-
* @param name 表情名称
|
|
107
|
-
*/
|
|
108
|
-
removeReaction(channel: string, timestamp: string, name: string): Promise<boolean>;
|
|
109
|
-
/**
|
|
110
|
-
* 置顶消息
|
|
111
|
-
* @param channel 频道 ID
|
|
112
|
-
* @param timestamp 消息时间戳
|
|
113
|
-
*/
|
|
114
|
-
pinMessage(channel: string, timestamp: string): Promise<boolean>;
|
|
115
|
-
/**
|
|
116
|
-
* 取消置顶消息
|
|
117
|
-
* @param channel 频道 ID
|
|
118
|
-
* @param timestamp 消息时间戳
|
|
119
|
-
*/
|
|
120
|
-
unpinMessage(channel: string, timestamp: string): Promise<boolean>;
|
|
121
|
-
}
|
|
122
|
-
declare class SlackAdapter extends Adapter<SlackBot> {
|
|
123
|
-
constructor(plugin: Plugin);
|
|
124
|
-
createBot(config: SlackBotConfig): SlackBot;
|
|
125
|
-
kickMember(botId: string, sceneId: string, userId: string): Promise<boolean>;
|
|
126
|
-
setGroupName(botId: string, sceneId: string, name: string): Promise<boolean>;
|
|
127
|
-
listMembers(botId: string, sceneId: string): Promise<string[]>;
|
|
128
|
-
getGroupInfo(botId: string, sceneId: string): Promise<any>;
|
|
129
|
-
start(): Promise<void>;
|
|
130
|
-
/**
|
|
131
|
-
* 注册 Slack 平台特有工具(邀请到频道等)
|
|
132
|
-
*/
|
|
133
|
-
private registerSlackPlatformTools;
|
|
134
|
-
}
|
|
135
|
-
export {};
|
|
7
|
+
export * from "./types.js";
|
|
8
|
+
export { SlackBot } from "./bot.js";
|
|
9
|
+
export { SlackAdapter } from "./adapter.js";
|
|
136
10
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,QAAQ,SAAS,CAAC;IACvB,UAAU,QAAQ;QAChB,KAAK,EAAE,YAAY,CAAC;KACrB;CACF;AAED,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC"}
|