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');
13
13
const user = require . main . require ( './src/user' ) ;
14
14
const messaging = require . main . require ( './src/messaging' ) ;
15
15
const api = require . main . require ( './src/api' ) ;
16
+ const privileges = require . main . require ( './src/privileges' ) ;
16
17
17
18
const plugin = module . exports ;
18
19
@@ -42,6 +43,10 @@ plugin.actionMentionsNotify = async function (hookData) {
42
43
return ;
43
44
}
44
45
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
+ }
45
50
const message = notification . bodyLong . replace ( new RegExp ( `^@${ chatgptusername } ` ) , '' ) ;
46
51
if ( message . length ) {
47
52
const response = await chatComplete ( message ) ;
You can’t perform that action at this time.
0 commit comments