Add support for slack username circumfix. Closes #10
This commit is contained in:
parent
304dc2e25f
commit
f914695801
|
@ -55,6 +55,7 @@ UseTLS=false
|
||||||
SkipTLSVerify=true
|
SkipTLSVerify=true
|
||||||
nick="matterbot"
|
nick="matterbot"
|
||||||
channel="#matterbridge"
|
channel="#matterbridge"
|
||||||
|
UseSlackCircumfix=false
|
||||||
|
|
||||||
[mattermost]
|
[mattermost]
|
||||||
#url is your incoming webhook url (account settings - integrations - incoming webhooks)
|
#url is your incoming webhook url (account settings - integrations - incoming webhooks)
|
||||||
|
|
|
@ -15,6 +15,7 @@ type Config struct {
|
||||||
Nick string
|
Nick string
|
||||||
Password string
|
Password string
|
||||||
Channel string
|
Channel string
|
||||||
|
UseSlackCircumfix bool
|
||||||
}
|
}
|
||||||
Mattermost struct {
|
Mattermost struct {
|
||||||
URL string
|
URL string
|
||||||
|
|
|
@ -5,6 +5,7 @@ UseTLS=false
|
||||||
SkipTLSVerify=true
|
SkipTLSVerify=true
|
||||||
nick="matterbot"
|
nick="matterbot"
|
||||||
channel="#matterbridge"
|
channel="#matterbridge"
|
||||||
|
UseSlackCircumfix=false
|
||||||
|
|
||||||
[mattermost]
|
[mattermost]
|
||||||
url="http://yourdomain/hooks/yourhookkey"
|
url="http://yourdomain/hooks/yourhookkey"
|
||||||
|
|
|
@ -103,8 +103,13 @@ func (b *Bridge) SendType(nick string, message string, channel string, mtype str
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Bridge) handleMatter() {
|
func (b *Bridge) handleMatter() {
|
||||||
|
var username string
|
||||||
for {
|
for {
|
||||||
message := b.m.Receive()
|
message := b.m.Receive()
|
||||||
|
username = message.UserName + ": "
|
||||||
|
if b.Config.IRC.UseSlackCircumfix {
|
||||||
|
username = "<" + message.UserName + "> "
|
||||||
|
}
|
||||||
cmd := strings.Fields(message.Text)[0]
|
cmd := strings.Fields(message.Text)[0]
|
||||||
switch cmd {
|
switch cmd {
|
||||||
case "!users":
|
case "!users":
|
||||||
|
@ -116,7 +121,7 @@ func (b *Bridge) handleMatter() {
|
||||||
}
|
}
|
||||||
texts := strings.Split(message.Text, "\n")
|
texts := strings.Split(message.Text, "\n")
|
||||||
for _, text := range texts {
|
for _, text := range texts {
|
||||||
b.i.Privmsg(b.getIRCChannel(message.Token), message.UserName+": "+text)
|
b.i.Privmsg(b.getIRCChannel(message.Token), username+text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue