block-creater.ts 714 B

12345678910111213141516171819202122232425262728293031
  1. import { SectionBlock, InputBlock } from '@slack/types';
  2. export const generateMarkdownSectionBlock = (blocks:string):SectionBlock => {
  3. return {
  4. type: 'section',
  5. text: {
  6. type: 'mrkdwn',
  7. text: blocks,
  8. },
  9. };
  10. };
  11. export const generateInputSectionBlock = (blockId:string, labelText:string, actionId:string, isMultiline:boolean, placeholder:string):InputBlock => {
  12. return {
  13. type: 'input',
  14. block_id: blockId,
  15. label: {
  16. type: 'plain_text',
  17. text: labelText,
  18. },
  19. element: {
  20. type: 'plain_text_input',
  21. action_id: actionId,
  22. multiline: isMultiline,
  23. placeholder: {
  24. type: 'plain_text',
  25. text: placeholder,
  26. },
  27. },
  28. };
  29. };