mirror of
https://github.com/pinpox/gitea-matrix-bot
synced 2024-11-22 19:31:58 +01:00
fix some html templates
This commit is contained in:
parent
bb79e34417
commit
8c50a35e37
@ -18,7 +18,7 @@ type GiteaBot struct {
|
||||
}
|
||||
|
||||
//NewGiteaBot creates a new bot form user credentials
|
||||
func NewGiteaBot(user, pass, host, string, DBPath string) *GiteaBot {
|
||||
func NewGiteaBot(user, pass, host string, DBPath string) *GiteaBot {
|
||||
|
||||
bot, err := matrixbot.NewMatrixBot(user, pass, "gitea")
|
||||
|
||||
|
52
listener.go
52
listener.go
@ -101,39 +101,39 @@ func generateHTMLMessage(data GiteaPostData, eventHeader string) (string, error)
|
||||
mesgTemplates := map[string]string{
|
||||
|
||||
"push": "pushed " + strconv.Itoa(len(data.Commits)) + " commit(s) to {{.Repository.Name}}",
|
||||
"issues.assigned": "assigned issue <b>#{{Issue.Number}}</b> <i>{{.Issue.Title}}</i> to {{}}",
|
||||
"issues.closed": "closed issue <b>#{{Issue.Number}}</b> <i>{{.Issue.Title}}</i>",
|
||||
"issues.demilestoned": "removed milestone TODO from issue <b>#{{Issue.Number}}</b> <i>{{.Issue.Title}}</i>",
|
||||
"issues.edited": "edited issue <b>#{{Issue.Number}}</b> <i>{{.Issue.Title}}</i>",
|
||||
"issues.label_cleared": "cleared labels from issue <b>#{{Issue.Number}}</b> <i>{{.Issue.Title}}</i>",
|
||||
"issues.label_updated": "updated labels of issue <b>#{{Issue.Number}}</b> <i>{{.Issue.Title}}</i>",
|
||||
"issues.milestoned": "added issue <b>#{{Issue.Number}}</b> <i>{{.Issue.Title}}</i> to milestone TODO",
|
||||
"issues.opened": "opened issue <b>#{{Issue.Number}}</b> <i>{{.Issue.Title}}</i>",
|
||||
"issues.reopened": "re-opened issue <b>#{{Issue.Number}}</b> <i>{{.Issue.Title}}</i>",
|
||||
"issues.synchronized": "synchronized issue <b>#{{Issue.Number}}</b> <i>{{.Issue.Title}}</i>",
|
||||
"issues.unassigned": "removed assignee from issue <b>#{{Issue.Number}}</b> <i>{{.Issue.Title}}</i>",
|
||||
"issues.assigned": "assigned issue <b>#{{.Issue.Number}}</b> <i>{{.Issue.Title}}</i> to {{}}",
|
||||
"issues.closed": "closed issue <b>#{{.Issue.Number}}</b> <i>{{.Issue.Title}}</i>",
|
||||
"issues.demilestoned": "removed milestone TODO from issue <b>#{{.Issue.Number}}</b> <i>{{.Issue.Title}}</i>",
|
||||
"issues.edited": "edited issue <b>#{{.Issue.Number}}</b> <i>{{.Issue.Title}}</i>",
|
||||
"issues.label_cleared": "cleared labels from issue <b>#{{.Issue.Number}}</b> <i>{{.Issue.Title}}</i>",
|
||||
"issues.label_updated": "updated labels of issue <b>#{{.Issue.Number}}</b> <i>{{.Issue.Title}}</i>",
|
||||
"issues.milestoned": "added issue <b>#{{.Issue.Number}}</b> <i>{{.Issue.Title}}</i> to milestone TODO",
|
||||
"issues.opened": "opened issue <b>#{{.Issue.Number}}</b> <i>{{.Issue.Title}}</i>",
|
||||
"issues.reopened": "re-opened issue <b>#{{.Issue.Number}}</b> <i>{{.Issue.Title}}</i>",
|
||||
"issues.synchronized": "synchronized issue <b>#{{.Issue.Number}}</b> <i>{{.Issue.Title}}</i>",
|
||||
"issues.unassigned": "removed assignee from issue <b>#{{.Issue.Number}}</b> <i>{{.Issue.Title}}</i>",
|
||||
"fork": "forked repository {{.Repository.Parent.FullName}} to {{.Repository.FullName}}",
|
||||
"pull_request.assigned": "assigned pull-request <b>#{{PullRequest.Number}}</b> <i>#{{PullRequest.Title}}</i> to {{.PullRequest.Assignee.FullName}}",
|
||||
"pull_request.closed": "closed pull-request <b>#{{PullRequest.Number}}</b> <i>#{{PullRequest.Title}}</i>",
|
||||
"pull_request.demilestoned": "removed milestone TODO from pull-request <b>#{{PullRequest.Number}}</b> <i>#{{PullRequest.Title}}</i>",
|
||||
"pull_request.edited": "edited pull-request <b>#{{PullRequest.Number}}</b> <i>#{{PullRequest.Title}}</i>",
|
||||
"pull_request.label_cleared": "removed labels from pull-request <b>#{{PullRequest.Number}}</b> <i>#{{PullRequest.Title}}</i>",
|
||||
"pull_request.label_updated": "updated labels from pull-request <b>#{{PullRequest.Number}}</b> <i>#{{PullRequest.Title}}</i>",
|
||||
"pull_request.milestoned": "added pull-request <b>#{{PullRequest.Number}}</b> <i>#{{PullRequest.Title}}</i> to milestone TODO",
|
||||
"pull_request.opened": "opened pull-request <b>#{{PullRequest.Number}}</b> <i>#{{PullRequest.Title}}</i>",
|
||||
"pull_request.reopened": "re-opened pull-request <b>#{{PullRequest.Number}}</b> <i>#{{PullRequest.Title}}</i>",
|
||||
"pull_request.synchronized": "synchronized pull-request <b>#{{PullRequest.Number}}</b> <i>#{{PullRequest.Title}}</i>",
|
||||
"pull_request.unassigned": "removed assinee from pull-request <b>#{{PullRequest.Number}}</b> <i>#{{PullRequest.Title}}</i>",
|
||||
"pull_request.assigned": "assigned pull-request <b>#.PullRequest.Number}}</b> <i>#{{PullRequest.Title}}</i> to {{.PullRequest.Assignee.FullName}}",
|
||||
"pull_request.closed": "closed pull-request <b>#.PullRequest.Number}}</b> <i>#{{PullRequest.Title}}</i>",
|
||||
"pull_request.demilestoned": "removed milestone TODO from pull-request <b>#.PullRequest.Number}}</b> <i>#{{PullRequest.Title}}</i>",
|
||||
"pull_request.edited": "edited pull-request <b>#.PullRequest.Number}}</b> <i>#{{PullRequest.Title}}</i>",
|
||||
"pull_request.label_cleared": "removed labels from pull-request <b>#.PullRequest.Number}}</b> <i>#{{PullRequest.Title}}</i>",
|
||||
"pull_request.label_updated": "updated labels from pull-request <b>#.PullRequest.Number}}</b> <i>#{{PullRequest.Title}}</i>",
|
||||
"pull_request.milestoned": "added pull-request <b>#.PullRequest.Number}}</b> <i>#{{PullRequest.Title}}</i> to milestone TODO",
|
||||
"pull_request.opened": "opened pull-request <b>#.PullRequest.Number}}</b> <i>#{{PullRequest.Title}}</i>",
|
||||
"pull_request.reopened": "re-opened pull-request <b>#.PullRequest.Number}}</b> <i>#{{PullRequest.Title}}</i>",
|
||||
"pull_request.synchronized": "synchronized pull-request <b>#.PullRequest.Number}}</b> <i>#{{PullRequest.Title}}</i>",
|
||||
"pull_request.unassigned": "removed assinee from pull-request <b>#.PullRequest.Number}}</b> <i>#{{PullRequest.Title}}</i>",
|
||||
"issue_comment.created": "commented on issue <b>#{{.Issue.Number}}</b> <i>{{.Issue.Title}}</i>:<br> <pre><code class='language-markdown'>{{.Comment.Body}}</code></pre>",
|
||||
"issue_comment.deleted": "deleted commented on <b>#{{Issue.Number}}</b> <i>{{.Issue.Title}}</i>",
|
||||
"issue_comment.deleted": "deleted commented on <b>#{{.Issue.Number}}</b> <i>{{.Issue.Title}}</i>",
|
||||
"repository.created": "created repository {{}}",
|
||||
"repository.deleted": "deleted repository {{}}",
|
||||
"release.published": "published release {{}}",
|
||||
"release.updated": "updated release {{}}",
|
||||
"release.deleted": "deleted release {{}}",
|
||||
"pull_request_aproved": "approved pull request <b>#{{PullRequest.Number}}</b> <i>#{{PullRequest.Title}}</i>",
|
||||
"pull_request_rejected": "rejected pull request <b>#{{PullRequest.Number}}</b> <i>#{{PullRequest.Title}}</i>",
|
||||
"pull_request_comment": "commented on pull request <b>#{{PullRequest.Number}}</b> <i>#{{PullRequest.Title}}</i>: <pre><code class='language-markdown'>{{.Comment.Body}}</code><pre>",
|
||||
"pull_request_aproved": "approved pull request <b>#.PullRequest.Number}}</b> <i>#{{PullRequest.Title}}</i>",
|
||||
"pull_request_rejected": "rejected pull request <b>#.PullRequest.Number}}</b> <i>#{{PullRequest.Title}}</i>",
|
||||
"pull_request_comment": "commented on pull request <b>#.PullRequest.Number}}</b> <i>#{{PullRequest.Title}}</i>: <pre><code class='language-markdown'>{{.Comment.Body}}</code><pre>",
|
||||
}
|
||||
|
||||
switch eventHeader {
|
||||
|
2
main.go
2
main.go
@ -51,6 +51,8 @@ func init() {
|
||||
dbPath := cfg.Section("bot").Key("db_path").String()
|
||||
|
||||
//Set up the bot
|
||||
|
||||
// func NewGiteaBot(user, pass, host, string, DBPath string) *GiteaBot {
|
||||
mygiteabot = NewGiteaBot(matrixUser, matrixPass, matrixHost, dbPath)
|
||||
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user