mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-06-27 06:29:24 +00:00
Fix golint linter issues and enable it in CI (#593)
This commit is contained in:
@ -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
|
||||
}
|
||||
|
||||
|
@ -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) != "" {
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user