slack2md

package module
v0.0.0-...-ef6b6a5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2024 License: MIT Imports: 11 Imported by: 0

README

slack2md

slack2md is a cli tool.
slack2md get Slack messages and convert them to Markdown format.

$ ./slack2md --help
slack2md get Slack messages and convert them to Markdown format

Usage:
  slack2md [flags]

Flags:
      --config string   Path to config yaml (requred)
  -h, --help            help for slack2md
  -t, --token string    slack api token (required)

Config YAML format

output: string # path/to/markdown (required)
since: int # since x days ago (default: 1)
users: string array # include user id
channels:
  - id: string # slack channel id
    header: string # markdown header (default: slack channel name)
    no_header: bool # not output markdown header (default: false)
    usres: string array # include user id (override global settings)
    timestamp: bool # show timestamp (default: false)
  - id: string
    header: string
    no_header: bool
    usres: string array

Example:

output: ./20240808.md
since: 1
users: [user_id_1, user_id_2]
channels:
  - id: CXXXXXXA
    header: HEADER1
  - id: CXXXXXXB
    timestamp: true
./slack2md \
    --token your_slack_token_with_read_scope \
    --config config.yaml

then 20240808.md ceated with below content

# HEADER1

Message

Reply


# CXXXXXXB Channel Name

15:04
Message

Supported

  • Message
  • Reply
  • RichText
    • Preformatted
    • List(bullet, ordered)
    • Style
    • Link
    • Quote

Not currently supported

  • Paging
    • using api default limit(100 per channel)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Slack2md

func Slack2md(
	token string,
	configPath string,
)

Types

type ChannelConfig

type ChannelConfig struct {
	Id        string   `yaml:"id"`
	Header    string   `yaml:"header"`
	NoHeader  bool     `yaml:"no_header"`
	Users     []string `yaml:"users"`
	Timestamp bool     `yaml:"timestamp"`
}

type Message

type Message struct {
	// contains filtered or unexported fields
}

type RichTextList

type RichTextList struct {
	Type     string                `json:"type"`
	Elements []RichTextListSection `json:"elements"`
	Style    string                `json:"style"`
	Indent   int                   `json:"indent"`
	Border   int                   `json:"border"`
}

type RichTextListSection

type RichTextListSection struct {
	Type     string                       `json:"type"`
	Elements []RichTextListSectionElement `json:"elements"`
}

type RichTextListSectionElement

type RichTextListSectionElement struct {
	Type  string                          `json:"type"`
	Text  string                          `json:"text"`
	Url   string                          `json:"url"`
	Style *slack.RichTextSectionTextStyle `json:"style"`
}

type RichTextPreformatted

type RichTextPreformatted struct {
	Type     string                        `json:"type"`
	Elements []RichTextPreformattedElement `json:"elements"`
}

type RichTextPreformattedElement

type RichTextPreformattedElement struct {
	Type   string `json:"type"`
	Text   string `json:"text"`
	Url    string `json:"url"`
	Border int64  `json:"border"`
}

type RichTextQuote

type RichTextQuote struct {
	Type     string                 `json:"type"`
	Elements []RichTextQuoteElement `json:"elements"`
}

type RichTextQuoteElement

type RichTextQuoteElement struct {
	Type  string                          `json:"type"`
	Text  string                          `json:"text"`
	Style *slack.RichTextSectionTextStyle `json:"style"`
}

type Slack2mdConfg

type Slack2mdConfg struct {
	Output         string          `yaml:"output"`
	Since          int             `yaml:"since"`
	Users          []string        `yaml:"users"`
	ChannelConfigs []ChannelConfig `yaml:"channels"`
}

type SlackMessage

type SlackMessage struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis
cmd
slack2md command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL