File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33[ ![ npm] ( https://img.shields.io/npm/v/nodebb-plugin-discord-notification.svg )] ( https://www.npmjs.com/package/nodebb-plugin-discord-notification ) [ ![ npm downloads] ( https://img.shields.io/npm/dt/nodebb-plugin-discord-notification.svg )] ( https://www.npmjs.com/package/nodebb-plugin-discord-notification ) ![ NodeBB Compatibility] ( https://packages.nodebb.org/api/v1/plugins/nodebb-plugin-discord-notification/compatibility.png )
44
5- Send notifications of new posts and topics via [ Discord] ( https://discordapp .com/ ) webhook.
5+ Send notifications of new posts and topics via [ Discord] ( https://discord .com/ ) webhook.
66
77It’s like [ NodeBB Slack] ( https://github.com/pichalite/nodebb-plugin-slack-extended ) plugin, but for Discord. Fancy rich embeds included.
88
99## Configuration
1010
11111 . Install the plugin and activate it.
12122 . Create a Discord webhook (Server Settings &rarr ; Webhooks).
13- You’ll get an URL like ` https://discordapp .com/api/webhooks/<Webhook ID>/<Webhook Token> ` .
13+ You’ll get an URL like ` https://discord .com/api/webhooks/<Webhook ID>/<Webhook Token> ` .
14143 . Fill in ** Webhook URL** field on the plugin settings page.
15154 . Restart NodeBB.
1616
Original file line number Diff line number Diff line change 2222 topicsOnly : '' ,
2323 messageContent : ''
2424 } ,
25- regex : / h t t p s : \/ \/ d i s c o r d a p p \. c o m \/ a p i \/ w e b h o o k s \/ ( [ 0 - 9 ] + ?) \/ ( .+ ?) $ /
25+ regex : / h t t p s : \/ \/ d i s c o r d (?: a p p ) ? \. c o m \/ a p i \/ w e b h o o k s \/ ( [ 0 - 9 ] + ?) \/ ( .+ ?) $ /
2626 } ;
2727
2828 plugin . init = function ( params , callback ) {
8989 var messageContent = plugin . config [ 'messageContent' ] || '' ;
9090
9191 // Make the rich embed:
92- var embed = new Discord . RichEmbed ( )
92+ var embed = new Discord . MessageEmbed ( )
9393 . setColor ( data . category . bgColor )
9494 . setURL ( forumURL + '/topic/' + data . topic . slug )
9595 . setTitle ( data . category . name + ': ' + data . topic . title )
9999
100100 // Send notification:
101101 if ( hook ) {
102- hook . sendMessage ( messageContent , { embeds : [ embed ] } ) . catch ( console . error ) ;
102+ hook . send ( messageContent , { embeds : [ embed ] } ) . catch ( console . error ) ;
103103 }
104104 }
105105 } ) ;
Original file line number Diff line number Diff line change 2424 "license" : " MIT" ,
2525 "main" : " library.js" ,
2626 "dependencies" : {
27- "discord.js" : " ^11.1 .0"
27+ "discord.js" : " ^12.3 .0"
2828 },
2929 "nbbpm" : {
3030 "compatibility" : " ^1.11.0"
You can’t perform that action at this time.
0 commit comments