-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(gitlab: events): add wiki_page/update - fired when wiki page is …
…updated
- Loading branch information
1 parent
308e38a
commit 34870e8
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const EventResponse = require('../EventResponse'); | ||
|
||
class WikiPageUpdate extends EventResponse { | ||
constructor(...args) { | ||
super(...args, { | ||
description: 'This event is fired when a wiki page is updated', | ||
}); | ||
} | ||
|
||
embed(data) { | ||
const page = data.object_attributes; | ||
return { | ||
color: 0x29BB9C, | ||
title: `Updated wiki page \`${page.title}\``, | ||
description: page.content, | ||
}; | ||
} | ||
|
||
text(data) { | ||
const actor = data.user.name; | ||
const page = data.object_attributes; | ||
return [ | ||
`📰 **${actor}** updated wiki page **${page.title}**`, | ||
` ${page.content.slice(0, 100).replace(/\n/g, ' ')}`, | ||
`<${page.url}>`, | ||
].join('\n'); | ||
} | ||
} | ||
|
||
module.exports = WikiPageUpdate; |