UNPKG

951 BTypeScriptView Raw
1import { StringMap } from '@naturalcycles/js-lib';
2import { SlackAttachmentField, SlackMessage, SlackServiceCfg } from './slack.service.model';
3/**
4 * Has 2 main methods:
5 *
6 * 1. .send({ items: any, channel: ..., ... })
7 * Low-level method with all possible options available.
8 *
9 * 2. .log(...items: any[])
10 * Shortcut method to "just log a bunch of things", everything is "by default" there.
11 *
12 * .send method has a shortcut:
13 * .send(string, ctx?: CTX)
14 */
15export declare class SlackService<CTX = any> {
16 constructor(cfg: Partial<SlackServiceCfg<CTX>>);
17 cfg: SlackServiceCfg<CTX>;
18 /**
19 * Allows to "log" many things at once, similar to `console.log(one, two, three).
20 */
21 log(...items: any[]): Promise<void>;
22 send(msg: SlackMessage<CTX> | string, ctx?: CTX): Promise<void>;
23 kvToFields(kv: StringMap<any>): SlackAttachmentField[];
24}
25export declare function slackDefaultMessagePrefixHook(msg: SlackMessage): string[];