mirror of
https://salsa.debian.org/mdosch/feed-to-muc.git
synced 2024-11-13 01:36:49 +01:00
Moved reply strings in variable.
This commit is contained in:
parent
0d5b08147d
commit
0e7f42fcc1
1 changed files with 18 additions and 15 deletions
|
@ -261,38 +261,40 @@ func processStanzas(client *xmpp.Client, muc string, mucNick string, feeds []str
|
|||
|
||||
// Reply with a short summary of available commands for `help`.
|
||||
case "help":
|
||||
|
||||
reply := ": The following commands are available:\n" +
|
||||
"\"feeds\": List feeds I'm following.\n" +
|
||||
"\"source\": Show source code URL."
|
||||
|
||||
if v.Type == "groupchat" {
|
||||
_, err = client.Send(xmpp.Chat{Remote: muc,
|
||||
Type: "groupchat", Text: strings.Split(v.Remote, "/")[1] +
|
||||
": The following commands are available:\n" +
|
||||
"\"feeds\": List feeds I'm following.\n" +
|
||||
"\"source\": Show source code URL."})
|
||||
Type: "groupchat", Text: strings.Split(v.Remote, "/")[1] + ": " + reply})
|
||||
if err != nil {
|
||||
log.Fatal("Error: Failed sending message to MUC:", err)
|
||||
}
|
||||
} else if v.Type == "chat" {
|
||||
_, err = client.Send(xmpp.Chat{Remote: v.Remote,
|
||||
Type: "chat", Text: "The following commands are available:\n" +
|
||||
"\"feeds\": List feeds I'm following.\n" +
|
||||
"\"source\": Show source code URL."})
|
||||
Type: "chat", Text: reply})
|
||||
if err != nil {
|
||||
log.Fatal("Error: Failed sending message to ", v.Remote, ": ", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Reply with repo address for `source`.
|
||||
case "source":
|
||||
|
||||
reply := "My source can be found at " +
|
||||
"https://salsa.debian.org/mdosch-guest/feed-to-muc"
|
||||
|
||||
if v.Type == "groupchat" {
|
||||
_, err = client.Send(xmpp.Chat{Remote: muc,
|
||||
Type: "groupchat", Text: strings.Split(v.Remote, "/")[1] +
|
||||
": My source can be found at " +
|
||||
"https://salsa.debian.org/mdosch-guest/feed-to-muc"})
|
||||
Type: "groupchat", Text: strings.Split(v.Remote, "/")[1] + ": " + reply})
|
||||
if err != nil {
|
||||
log.Fatal("Error: Failed sending message to MUC:", err)
|
||||
}
|
||||
} else if v.Type == "chat" {
|
||||
_, err = client.Send(xmpp.Chat{Remote: v.Remote,
|
||||
Type: "chat", Text: "My source can be found at " +
|
||||
"https://salsa.debian.org/mdosch-guest/feed-to-muc"})
|
||||
Type: "chat", Text: reply})
|
||||
if err != nil {
|
||||
log.Fatal("Error: Failed sending message to ", v.Remote, ": ", err)
|
||||
}
|
||||
|
@ -305,16 +307,17 @@ func processStanzas(client *xmpp.Client, muc string, mucNick string, feeds []str
|
|||
feedList = feedList + feed + "\n"
|
||||
}
|
||||
|
||||
reply := "Feeds I'm following:\n" + feedList
|
||||
|
||||
if v.Type == "groupchat" {
|
||||
_, err = client.Send(xmpp.Chat{Remote: muc,
|
||||
Type: "groupchat", Text: strings.Split(v.Remote, "/")[1] +
|
||||
": Feeds I'm following:\n" + feedList})
|
||||
Type: "groupchat", Text: strings.Split(v.Remote, "/")[1] + ": " + reply})
|
||||
if err != nil {
|
||||
log.Fatal("Error: Failed sending message to MUC:", err)
|
||||
}
|
||||
} else if v.Type == "chat" {
|
||||
_, err = client.Send(xmpp.Chat{Remote: v.Remote,
|
||||
Type: "chat", Text: "Feeds I'm following:\n" + feedList})
|
||||
Type: "chat", Text: reply})
|
||||
if err != nil {
|
||||
log.Fatal("Error: Failed sending message to ", v.Remote, ": ", err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue