File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ const topics = require.main.require('./src/topics');
1313const user = require . main . require ( './src/user' ) ;
1414const messaging = require . main . require ( './src/messaging' ) ;
1515const api = require . main . require ( './src/api' ) ;
16+ const privileges = require . main . require ( './src/privileges' ) ;
1617
1718const plugin = module . exports ;
1819
@@ -42,6 +43,10 @@ plugin.actionMentionsNotify = async function (hookData) {
4243 return ;
4344 }
4445 if ( notification . tid && notification . bodyLong . startsWith ( `@${ chatgptusername } ` ) ) {
46+ const canReply = await privileges . topics . can ( 'topics:reply' , notification . tid , chatgptUid ) ;
47+ if ( ! canReply ) {
48+ return ;
49+ }
4550 const message = notification . bodyLong . replace ( new RegExp ( `^@${ chatgptusername } ` ) , '' ) ;
4651 if ( message . length ) {
4752 const response = await chatComplete ( message ) ;
You can’t perform that action at this time.
0 commit comments