Skip to content
Snippets Groups Projects
Commit 90857f1c authored by Tulir Asokan's avatar Tulir Asokan :cat2:
Browse files

Add help and better startup log

parent 4e1dfb07
Branches
Tags
No related merge requests found
......@@ -35,6 +35,11 @@ func initGitlabClient() {
if err != nil {
panic(err)
}
user, _, err := git.Users.CurrentUser()
if err != nil {
panic(err)
}
fmt.Printf("Logged into GitLab at %s as %s\n", git.BaseURL().Hostname(), user.Name)
}
func handleGitlabCommand(room *mautrix.Room, command string, args ...string) {
......@@ -59,5 +64,14 @@ func handleGitlabCommand(room *mautrix.Room, command string, args ...string) {
commit.AuthorName,
commit.CommittedDate.Format("Jan _2, 2006 15:04:05"),
strings.Replace(commit.Message, "\n", "<br/>", -1)))
case "help":
room.SendHTML(`<pre>
Commands are prefixed with !gitlab
- ping - Ping the bot
- commit &lt;repo&gt; &lt;hash&gt; - Get details about a specific commit
- help - Show this help page.
</pre>`)
default:
room.Send("Unknown command. Type !gitlab help for help.")
}
}
......@@ -58,6 +58,7 @@ func startWebhook() func() {
server.Handler = mux
fmt.Println("Listening to GitLab webhooks at", *gitlabListenAddr+*gitlabListenPath)
err := server.ListenAndServe()
if err != nil {
fmt.Println(err)
......
......@@ -36,7 +36,7 @@ func startMatrix() func() {
if err != nil {
panic(err)
}
fmt.Println("Connected to", *homeserver, "as", *username)
fmt.Println("Connected to Matrix homeserver at", *homeserver, "as", *username)
stop := make(chan bool, 1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment