forked from jshiffer/matterbridge
Make gocritic linter happy
This commit is contained in:
parent
8d117cb0a4
commit
399789811e
@ -234,7 +234,7 @@ func (b *Bdiscord) messageUpdate(s *discordgo.Session, m *discordgo.MessageUpdat
|
||||
// only when message is actually edited
|
||||
if m.Message.EditedTimestamp != "" {
|
||||
b.Log.Debugf("Sending edit message")
|
||||
m.Content = m.Content + b.GetString("EditSuffix")
|
||||
m.Content += b.GetString("EditSuffix")
|
||||
b.messageCreate(s, (*discordgo.MessageCreate)(m))
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ func SplitStringLength(input string, length int) string {
|
||||
a := []rune(input)
|
||||
str := ""
|
||||
for i, r := range a {
|
||||
str = str + string(r)
|
||||
str += string(r)
|
||||
if i > 0 && (i+1)%length == 0 {
|
||||
str += "\n"
|
||||
}
|
||||
|
@ -63,8 +63,7 @@ func New(cfg *bridge.Config) bridge.Bridger {
|
||||
}
|
||||
|
||||
func (b *Birc) Command(msg *config.Message) string {
|
||||
switch msg.Text {
|
||||
case "!users":
|
||||
if msg.Text == "!users" {
|
||||
b.i.Handlers.Add(girc.RPL_NAMREPLY, b.storeNames)
|
||||
b.i.Handlers.Add(girc.RPL_ENDOFNAMES, b.endNames)
|
||||
b.i.Cmd.SendRaw("NAMES " + msg.Channel)
|
||||
@ -237,7 +236,7 @@ func (b *Birc) Send(msg config.Message) (string, error) {
|
||||
}
|
||||
if len(b.Local) < b.MessageQueue {
|
||||
if len(b.Local) == b.MessageQueue-1 {
|
||||
text = text + " <message clipped>"
|
||||
text += " <message clipped>"
|
||||
}
|
||||
b.Local <- config.Message{Text: text, Username: msg.Username, Channel: msg.Channel, Event: msg.Event}
|
||||
} else {
|
||||
|
@ -234,11 +234,11 @@ func (b *Bmatrix) handleDownloadFile(rmsg *config.Message, content map[string]in
|
||||
if msgtype == "m.image" {
|
||||
mext, _ := mime.ExtensionsByType(mtype)
|
||||
if len(mext) > 0 {
|
||||
name = name + mext[0]
|
||||
name += mext[0]
|
||||
}
|
||||
} else {
|
||||
// just a default .png extension if we don't have mime info
|
||||
name = name + ".png"
|
||||
name += ".png"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -303,7 +303,7 @@ func (b *Btelegram) handleDownload(message *tgbotapi.Message, rmsg *config.Messa
|
||||
urlPart := strings.Split(url, "/")
|
||||
name = urlPart[len(urlPart)-1]
|
||||
if !strings.HasSuffix(name, ".webp") {
|
||||
name = name + ".webp"
|
||||
name += ".webp"
|
||||
}
|
||||
text = " " + url
|
||||
}
|
||||
@ -338,7 +338,7 @@ func (b *Btelegram) handleDownload(message *tgbotapi.Message, rmsg *config.Messa
|
||||
name = urlPart[len(urlPart)-1]
|
||||
text = " " + url
|
||||
if !strings.HasSuffix(name, ".ogg") {
|
||||
name = name + ".ogg"
|
||||
name += ".ogg"
|
||||
}
|
||||
}
|
||||
if message.Audio != nil {
|
||||
@ -356,7 +356,7 @@ func (b *Btelegram) handleDownload(message *tgbotapi.Message, rmsg *config.Messa
|
||||
// use the URL instead of native upload
|
||||
if b.GetBool("UseInsecureURL") {
|
||||
b.Log.Debugf("Setting message text to :%s", text)
|
||||
rmsg.Text = rmsg.Text + text
|
||||
rmsg.Text += text
|
||||
return nil
|
||||
}
|
||||
// if we have a file attached, download it (in memory) and put a pointer to it in msg.Extra
|
||||
|
@ -481,7 +481,7 @@ func (gw *Gateway) handleFiles(msg *config.Message) {
|
||||
ext := filepath.Ext(fi.Name)
|
||||
fi.Name = fi.Name[0 : len(fi.Name)-len(ext)]
|
||||
fi.Name = reg.ReplaceAllString(fi.Name, "_")
|
||||
fi.Name = fi.Name + ext
|
||||
fi.Name += ext
|
||||
|
||||
sha1sum := fmt.Sprintf("%x", sha1.Sum(*fi.Data))[:8]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user