@@ -1904,9 +1904,15 @@ export const polkasafeSlackBotCommands = functions.https.onRequest(async (req, r
1904
1904
try {
1905
1905
// slack needs an acknowledgement response within 3 seconds
1906
1906
res . status ( 200 ) . end ( ) ;
1907
- const { command, text, user_id } = req . body ;
1907
+ const { command, text, user_id : slackUserId , channel_id } = req . body ;
1908
1908
functions . logger . info ( 'polkasafeSlackBotCommands req :' , { req } ) ;
1909
1909
1910
+ if ( ! channel_id && ! slackUserId ) {
1911
+ return ;
1912
+ }
1913
+
1914
+ const user_id = channel_id || slackUserId ;
1915
+
1910
1916
if ( command == '/polkasafe-add' ) {
1911
1917
await sendSlackMessage ( NOTIFICATION_SOURCE . POLKASAFE , String ( user_id ) , 'Adding address...' ) ;
1912
1918
@@ -2697,9 +2703,15 @@ export const polkassemblySlackBotCommands = functions.https.onRequest(async (req
2697
2703
try {
2698
2704
// slack needs an acknowledgement response within 3 seconds
2699
2705
res . status ( 200 ) . end ( ) ;
2700
- const { command, text, user_id } = req . body ;
2706
+ const { command, text, user_id : slackUserId , channel_id } = req . body ;
2701
2707
functions . logger . info ( 'polkassemblySlackBotCommands req :' , { req } ) ;
2702
2708
2709
+ if ( ! slackUserId && ! channel_id ) {
2710
+ return ;
2711
+ }
2712
+
2713
+ const user_id = channel_id || slackUserId ;
2714
+
2703
2715
if ( command == '/polkassembly-add' ) {
2704
2716
await sendSlackMessage ( NOTIFICATION_SOURCE . POLKASSEMBLY , String ( user_id ) , 'Adding username...' ) ;
2705
2717
0 commit comments