parent
8af708b00b
commit
fd5d8bdf8a
@ -35,7 +35,7 @@ Setup
|
|||||||
1. Get a slack token, click [here](https://api.slack.com/docs/oauth-test-tokens)
|
1. Get a slack token, click [here](https://api.slack.com/docs/oauth-test-tokens)
|
||||||
|
|
||||||
2. Create a `.slack-term` file, and place it in your home directory. Below is
|
2. Create a `.slack-term` file, and place it in your home directory. Below is
|
||||||
an an example file, you can leave out the `OPTIONAL` parts, you are only
|
an example file, you can leave out the `OPTIONAL` parts, you are only
|
||||||
required to specify a `slack_token`. Remember that your file should be
|
required to specify a `slack_token`. Remember that your file should be
|
||||||
a valid json file so don't forget to remove the comments.
|
a valid json file so don't forget to remove the comments.
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ Setup
|
|||||||
"sidebar_width": 1,
|
"sidebar_width": 1,
|
||||||
|
|
||||||
// OPTIONAL: turn on desktop notifications for all incoming messages, set
|
// OPTIONAL: turn on desktop notifications for all incoming messages, set
|
||||||
// the value as: "all", and for only mentions and im messages set the
|
// the value as: "all". For only mentions and im messages set the
|
||||||
// value as: "mention", default is turned off: ""
|
// value as: "mention", default is turned off: ""
|
||||||
"notify": "",
|
"notify": "",
|
||||||
|
|
||||||
@ -112,7 +112,8 @@ Setup
|
|||||||
"message": {
|
"message": {
|
||||||
"time": "",
|
"time": "",
|
||||||
"name": "",
|
"name": "",
|
||||||
"text": ""
|
"text": "",
|
||||||
|
"time_format": "15:04"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -139,7 +140,7 @@ $ slack-term -config [path-to-config-file]
|
|||||||
Default Key Mapping
|
Default Key Mapping
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
Below are the default key-mapping for `slack-term`, you can change them
|
Below are the default key-mappings for `slack-term`, you can change them
|
||||||
in your `slack-term.json` file.
|
in your `slack-term.json` file.
|
||||||
|
|
||||||
| mode | key | action |
|
| mode | key | action |
|
||||||
|
@ -19,6 +19,8 @@ type Message struct {
|
|||||||
StyleTime string
|
StyleTime string
|
||||||
StyleName string
|
StyleName string
|
||||||
StyleText string
|
StyleText string
|
||||||
|
|
||||||
|
FormatTime string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Chat is the definition of a Chat component
|
// Chat is the definition of a Chat component
|
||||||
@ -54,7 +56,11 @@ func (c *Chat) Buffer() termui.Buffer {
|
|||||||
if (msg.Time != time.Time{} && msg.Name != "") {
|
if (msg.Time != time.Time{} && msg.Name != "") {
|
||||||
// Time
|
// Time
|
||||||
cells = append(cells, termui.DefaultTxBuilder.Build(
|
cells = append(cells, termui.DefaultTxBuilder.Build(
|
||||||
fmt.Sprintf("[[%s]](%s) ", msg.Time.Format("15:04"), msg.StyleTime),
|
fmt.Sprintf(
|
||||||
|
"[[%s]](%s) ",
|
||||||
|
msg.Time.Format(msg.FormatTime),
|
||||||
|
msg.StyleTime,
|
||||||
|
),
|
||||||
termui.ColorDefault, termui.ColorDefault)...,
|
termui.ColorDefault, termui.ColorDefault)...,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -125,6 +125,7 @@ func getDefaultConfig() Config {
|
|||||||
},
|
},
|
||||||
Message: Message{
|
Message: Message{
|
||||||
Time: "",
|
Time: "",
|
||||||
|
TimeFormat: "15:04",
|
||||||
Name: "",
|
Name: "",
|
||||||
Text: "",
|
Text: "",
|
||||||
},
|
},
|
||||||
|
@ -19,6 +19,7 @@ type Message struct {
|
|||||||
Time string `json:"time"`
|
Time string `json:"time"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Text string `json:"text"`
|
Text string `json:"text"`
|
||||||
|
TimeFormat string `json:"time_format"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Channel struct {
|
type Channel struct {
|
||||||
|
@ -459,6 +459,7 @@ func (s *SlackService) CreateMessage(message slack.Message) []components.Message
|
|||||||
StyleTime: s.Config.Theme.Message.Time,
|
StyleTime: s.Config.Theme.Message.Time,
|
||||||
StyleName: s.Config.Theme.Message.Name,
|
StyleName: s.Config.Theme.Message.Name,
|
||||||
StyleText: s.Config.Theme.Message.Text,
|
StyleText: s.Config.Theme.Message.Text,
|
||||||
|
FormatTime: s.Config.Theme.Message.TimeFormat,
|
||||||
}
|
}
|
||||||
|
|
||||||
msgs = append(msgs, msg)
|
msgs = append(msgs, msg)
|
||||||
@ -531,6 +532,7 @@ func (s *SlackService) CreateMessageFromMessageEvent(message *slack.MessageEvent
|
|||||||
StyleTime: s.Config.Theme.Message.Time,
|
StyleTime: s.Config.Theme.Message.Time,
|
||||||
StyleName: s.Config.Theme.Message.Name,
|
StyleName: s.Config.Theme.Message.Name,
|
||||||
StyleText: s.Config.Theme.Message.Text,
|
StyleText: s.Config.Theme.Message.Text,
|
||||||
|
FormatTime: s.Config.Theme.Message.TimeFormat,
|
||||||
}
|
}
|
||||||
|
|
||||||
msgs = append(msgs, msg)
|
msgs = append(msgs, msg)
|
||||||
@ -666,6 +668,7 @@ func (s *SlackService) CreateMessageFromAttachments(atts []slack.Attachment) []c
|
|||||||
StyleTime: s.Config.Theme.Message.Time,
|
StyleTime: s.Config.Theme.Message.Time,
|
||||||
StyleName: s.Config.Theme.Message.Name,
|
StyleName: s.Config.Theme.Message.Name,
|
||||||
StyleText: s.Config.Theme.Message.Text,
|
StyleText: s.Config.Theme.Message.Text,
|
||||||
|
FormatTime: s.Config.Theme.Message.TimeFormat,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -678,6 +681,7 @@ func (s *SlackService) CreateMessageFromAttachments(atts []slack.Attachment) []c
|
|||||||
StyleTime: s.Config.Theme.Message.Time,
|
StyleTime: s.Config.Theme.Message.Time,
|
||||||
StyleName: s.Config.Theme.Message.Name,
|
StyleName: s.Config.Theme.Message.Name,
|
||||||
StyleText: s.Config.Theme.Message.Text,
|
StyleText: s.Config.Theme.Message.Text,
|
||||||
|
FormatTime: s.Config.Theme.Message.TimeFormat,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -690,6 +694,7 @@ func (s *SlackService) CreateMessageFromAttachments(atts []slack.Attachment) []c
|
|||||||
StyleTime: s.Config.Theme.Message.Time,
|
StyleTime: s.Config.Theme.Message.Time,
|
||||||
StyleName: s.Config.Theme.Message.Name,
|
StyleName: s.Config.Theme.Message.Name,
|
||||||
StyleText: s.Config.Theme.Message.Text,
|
StyleText: s.Config.Theme.Message.Text,
|
||||||
|
FormatTime: s.Config.Theme.Message.TimeFormat,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user