File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed
Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,9 @@ export class CopBot {
4848 }
4949
5050 console . log ( 'Received webhook body:' , update ) ;
51+ if ( ! update || ! update . id ) {
52+ throw new Error ( 'Missing required field: id' ) ;
53+ }
5154 await this . _bot . handleUpdate ( update ) ;
5255 res . statusCode = 200 ;
5356 res . end ( ) ;
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ export function ReplyToBot() {
1919 return createDecorator ( async ( ctx , next , close ) => {
2020 const reply = new BotReply ( ctx ) ;
2121 const replyMessage = ctx . message ?. reply_to_message ?. from ! ;
22- if ( replyMessage . id ! === ctx . me . id ) {
22+ if ( replyMessage && replyMessage . id ! === ctx . me . id ) {
2323 const randomMessage = jokeMessage ( ) ;
2424 await reply . textReply ( randomMessage ) ;
2525 close ( ) ;
You can’t perform that action at this time.
0 commit comments