/** * If you import a dependency which does not include its own type definitions, * TypeScript will try to find a definition for it by following the `typeRoots` * compiler option in tsconfig.json. For this project, we've configured it to * fall back to this folder if nothing is found in node_modules/@types. * * Often, you can install the DefinitelyTyped * (https://github.com/DefinitelyTyped/DefinitelyTyped) type definition for the * dependency in question. However, if no one has yet contributed definitions * for the package, you may want to declare your own. (If you're using the * `noImplicitAny` compiler options, you'll be required to declare it.) * * This is an example type definition for the `sha.js` package, used in hash.ts. * * (This definition was primarily extracted from: * https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/v8/index.d.ts */ import { MessageAttachment } from '@slack/web-api'; export interface SlackMessageKey { channel_id: string; timestamp: string; } export declare type SlackMessage = SlackMessageKey & { text: string; attachments?: MessageAttachment[]; ephemeral: boolean; }; export declare type SlackInteractionRequest = { payload: string; }; export declare type SlashCommandPayload = { channel_id: string; user_id: string; user_name: string; command: string; text: string; response_url: string; trigger_id: string; }; export declare type SlackRequest = SlackInteractionRequest | SlashCommandPayload; export interface SlackInteractionPayloadBase { user: { id: string; name: string; }; } export interface InteractiveMessagePayload extends SlackInteractionPayloadBase { type: 'interactive_message'; callback_id: string; message_ts: string; actions: SlackAction[]; channel: { id: string; }; original_message: { attachments?: object[]; edited?: object; }; } export interface SlackInteractionPayloadBlockActions extends SlackInteractionPayloadBase { type: 'block_actions'; } interface PlainTextInput { type: 'plain_text_input'; text?: string; value?: string; emoji?: boolean; } interface StaticSelect { type: 'static_select'; selected_option: { value: string; }; } export interface SlackInteractionViewSubmissionPayload extends SlackInteractionPayloadBase { type: 'view_submission'; view: { callback_id: string; private_metadata: string; state: { values: { [key: string]: { [key: string]: PlainTextInput | StaticSelect; }; }; }; }; } export declare type SlackInteractionPayload = InteractiveMessagePayload | SlackInteractionPayloadBlockActions | SlackInteractionViewSubmissionPayload; export interface SlackInteractionCommandResponse { response_type?: 'in_channel' | 'ephemeral'; text?: string; attachments?: MessageAttachment[]; } export interface SlackInteractionMessageResponse { replace_original?: 'true' | 'false'; response_type?: 'in_channel' | 'ephemeral'; text?: string; attachments?: MessageAttachment[]; } export declare type SlackInteractionViewSubmissionResponse = undefined | { response_action: 'clear' | 'errors' | 'update' | 'push'; }; export declare type SlackInteractionResponse = undefined | SlackInteractionCommandResponse | SlackInteractionMessageResponse | SlackInteractionViewSubmissionResponse; export declare type CommonNamedArgs = { owner: string; repo: string; unnamed_args: string; args: string; }; export declare type SlackAction = { name: string; value: string; type: 'button' | 'select'; }; export declare type DispatchEventOptions = { command: string; args: string; response_url: string; }; export declare type TextType = 'text' | 'options' | 'slackRequestPayload'; export interface CommmandResponse { type: 'in_channel' | 'ephemeral'; render: TextType; text?: string; } export {};