UNPKG

1.86 kBTypeScriptView Raw
1import { Bot } from '@xene/core';
2import { SlackbotDispatcher } from './dispatcher';
3import { Message } from './types';
4import { Auth, RTM, Chat, Users, Groups, Channels, Files } from './api';
5export declare class Slackbot extends Bot<string | Message> {
6 static dispatcher: SlackbotDispatcher;
7 static middleware: (handler: (context: {
8 readonly token: string;
9 readonly callbackId: string;
10 readonly responseUrl: string;
11 readonly user: {
12 id: string;
13 name: string;
14 };
15 readonly team: {
16 id: string;
17 domain: string;
18 };
19 readonly channel: {
20 id: string;
21 name: string;
22 };
23 readonly action: {
24 value: string;
25 type: "select" | "button";
26 id: string;
27 };
28 message: Message;
29 ephemeral: string | Message;
30 }) => void | Promise<void>) => (...args: any[]) => Promise<any>;
31 static oauthAccess: typeof Auth.access;
32 id: string;
33 bot: {
34 id: string;
35 name: string;
36 };
37 rtm: RTM;
38 auth: Auth;
39 chat: Chat;
40 users: Users;
41 groups: Groups;
42 channels: Channels;
43 files: Files;
44 constructor(options: {
45 id?: string;
46 botToken: string;
47 appToken?: string;
48 dispatcher?: SlackbotDispatcher;
49 });
50 say(channel: string, message: string | Message): Promise<{
51 channel: string;
52 ts: string;
53 message: Message;
54 }>;
55 listen(): this;
56 /**
57 * Process incoming interactive messages
58 * like button actions from slack
59 * Called from Dispatcher
60 */
61 onInteractiveMessage(payload: any): Promise<Message>;
62 /**
63 * Process new incoming RTM messages
64 */
65 private onRtmMessage(payload);
66 private markActionSelected(action, attachment);
67}