container23 / caml

A simple service and Discord Bot for performing a wallet, address and name check against the US FINCEN AML list
https://caml.container23.com/
Creative Commons Attribution 4.0 International
1 stars 2 forks source link

Bot crash on DM #15

Closed danOO7 closed 1 year ago

danOO7 commented 1 year ago

When DM the bot this will crash with the error below. Steps to reproduce:

Right click on bot Message write /test

{"level":30,"time":1673884652389,"pid":31169,"hostname":"dwa16","msg":"New Interaction: Type: 2, ID: 1064574149634310256"}
/home/dbu/projects/kycaml-bot/dist/api/handlers/interactions.js:48
    const userId = req.body.member.user.id;
                                   ^

TypeError: Cannot read properties of undefined (reading 'user')
    at handleTestCommand (/home/dbu/projects/kycaml-bot/dist/api/handlers/interactions.js:48:36)
    at handleInteractions (/home/dbu/projects/kycaml-bot/dist/api/handlers/interactions.js:34:24)
    at Layer.handle [as handle_request] (/home/dbu/projects/kycaml-bot/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/dbu/projects/kycaml-bot/node_modules/express/lib/router/route.js:144:13)
    at Route.dispatch (/home/dbu/projects/kycaml-bot/node_modules/express/lib/router/route.js:114:3)
    at Layer.handle [as handle_request] (/home/dbu/projects/kycaml-bot/node_modules/express/lib/router/layer.js:95:5)
    at /home/dbu/projects/kycaml-bot/node_modules/express/lib/router/index.js:284:15
    at Function.process_params (/home/dbu/projects/kycaml-bot/node_modules/express/lib/router/index.js:346:12)
    at next (/home/dbu/projects/kycaml-bot/node_modules/express/lib/router/index.js:280:10)
    at /home/dbu/projects/kycaml-bot/node_modules/body-parser/lib/read.js:137:5

Node.js v18.12.1
make: *** [Makefile:22: start] Error 1
ysfdev2 commented 1 year ago

Good catch, I fix this issue on PR https://github.com/container23/kycaml-bot/pull/24. Thanks!