summaryrefslogtreecommitdiffstats
path: root/bridge/slack
diff options
context:
space:
mode:
authorDuco van Amstel <duco.vanamstel@gmail.com>2018-11-15 19:43:43 +0000
committerWim <wim@42.be>2018-11-15 20:43:43 +0100
commitce21ba154585395e792c059ac156299071405247 (patch)
treef76f4617cc2c099a9a2e97bc85fce28cf04010b1 /bridge/slack
parentc89085bf44333b4decd75e30cec5849dca859938 (diff)
downloadmatterbridge-msglm-ce21ba154585395e792c059ac156299071405247.tar.gz
matterbridge-msglm-ce21ba154585395e792c059ac156299071405247.tar.bz2
matterbridge-msglm-ce21ba154585395e792c059ac156299071405247.zip
Fix golint linter issues and enable it in CI (#593)
Diffstat (limited to 'bridge/slack')
-rw-r--r--bridge/slack/handlers.go14
-rw-r--r--bridge/slack/legacy.go6
-rw-r--r--bridge/slack/slack.go8
3 files changed, 14 insertions, 14 deletions
diff --git a/bridge/slack/handlers.go b/bridge/slack/handlers.go
index ef7364f6..d4e5e464 100644
--- a/bridge/slack/handlers.go
+++ b/bridge/slack/handlers.go
@@ -22,7 +22,7 @@ func (b *Bslack) handleSlack() {
time.Sleep(time.Second)
b.Log.Debug("Start listening for Slack messages")
for message := range messages {
- if message.Event != config.EVENT_USER_TYPING {
+ if message.Event != config.EventUserTyping {
b.Log.Debugf("<= Sending message from %s on %s to gateway", message.Username, b.Account)
}
@@ -199,18 +199,18 @@ func (b *Bslack) handleStatusEvent(ev *slack.MessageEvent, rmsg *config.Message)
return true
case sChannelJoin, sChannelLeave:
rmsg.Username = sSystemUser
- rmsg.Event = config.EVENT_JOIN_LEAVE
+ rmsg.Event = config.EventJoinLeave
case sChannelTopic, sChannelPurpose:
- rmsg.Event = config.EVENT_TOPIC_CHANGE
+ rmsg.Event = config.EventTopicChange
case sMessageDeleted:
- rmsg.Text = config.EVENT_MSG_DELETE
- rmsg.Event = config.EVENT_MSG_DELETE
+ rmsg.Text = config.EventMsgDelete
+ rmsg.Event = config.EventMsgDelete
rmsg.ID = "slack " + ev.DeletedTimestamp
// If a message is being deleted we do not need to process
// the event any further so we return 'true'.
return true
case sMeMessage:
- rmsg.Event = config.EVENT_USER_ACTION
+ rmsg.Event = config.EventUserAction
}
return false
}
@@ -256,7 +256,7 @@ func (b *Bslack) handleTypingEvent(ev *slack.UserTypingEvent) (*config.Message,
return &config.Message{
Channel: channelInfo.Name,
Account: b.Account,
- Event: config.EVENT_USER_TYPING,
+ Event: config.EventUserTyping,
}, nil
}
diff --git a/bridge/slack/legacy.go b/bridge/slack/legacy.go
index a7e7f01f..be372edd 100644
--- a/bridge/slack/legacy.go
+++ b/bridge/slack/legacy.go
@@ -8,15 +8,15 @@ import (
"github.com/nlopes/slack"
)
-type BslackLegacy struct {
+type BLegacy struct {
*Bslack
}
func NewLegacy(cfg *bridge.Config) bridge.Bridger {
- return &BslackLegacy{Bslack: newBridge(cfg)}
+ return &BLegacy{Bslack: newBridge(cfg)}
}
-func (b *BslackLegacy) Connect() error {
+func (b *BLegacy) Connect() error {
b.RLock()
defer b.RUnlock()
if b.GetString(incomingWebhookConfig) != "" {
diff --git a/bridge/slack/slack.go b/bridge/slack/slack.go
index 1f51de95..0a5d824f 100644
--- a/bridge/slack/slack.go
+++ b/bridge/slack/slack.go
@@ -185,12 +185,12 @@ func (b *Bslack) Reload(cfg *bridge.Config) (string, error) {
func (b *Bslack) Send(msg config.Message) (string, error) {
// Too noisy to log like other events
- if msg.Event != config.EVENT_USER_TYPING {
+ if msg.Event != config.EventUserTyping {
b.Log.Debugf("=> Receiving %#v", msg)
}
// Make a action /me of the message
- if msg.Event == config.EVENT_USER_ACTION {
+ if msg.Event == config.EventUserAction {
msg.Text = "_" + msg.Text + "_"
}
@@ -270,7 +270,7 @@ func (b *Bslack) sendRTM(msg config.Message) (string, error) {
if err != nil {
return "", fmt.Errorf("could not send message: %v", err)
}
- if msg.Event == config.EVENT_USER_TYPING {
+ if msg.Event == config.EventUserTyping {
if b.GetBool("ShowUserTyping") {
b.rtm.SendMessage(b.rtm.NewTypingMessage(channelInfo.ID))
}
@@ -312,7 +312,7 @@ func (b *Bslack) sendRTM(msg config.Message) (string, error) {
}
func (b *Bslack) deleteMessage(msg *config.Message, channelInfo *slack.Channel) (bool, error) {
- if msg.Event != config.EVENT_MSG_DELETE {
+ if msg.Event != config.EventMsgDelete {
return false, nil
}