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