@@ -226,7 +226,10 @@ async function shouldProcessLineEvent(
226226 allowTextCommands : true ,
227227 hasControlCommand : hasControlCommand ( rawText , cfg ) ,
228228 } ) ;
229- return { allowed : true , commandAuthorized : commandGate . commandAuthorized } ;
229+ return {
230+ allowed : true ,
231+ commandAuthorized : isNonTextLineMessageEvent ( event ) ? true : commandGate . commandAuthorized ,
232+ } ;
230233 }
231234
232235 if ( dmPolicy === "disabled" ) {
@@ -263,7 +266,10 @@ async function shouldProcessLineEvent(
263266 allowTextCommands : true ,
264267 hasControlCommand : hasControlCommand ( rawText , cfg ) ,
265268 } ) ;
266- return { allowed : true , commandAuthorized : commandGate . commandAuthorized } ;
269+ return {
270+ allowed : true ,
271+ commandAuthorized : isNonTextLineMessageEvent ( event ) ? true : commandGate . commandAuthorized ,
272+ } ;
267273}
268274
269275/** Extract raw text from a LINE message or postback event for command detection. */
@@ -281,6 +287,12 @@ function resolveEventRawText(event: MessageEvent | PostbackEvent): string {
281287 return "" ;
282288}
283289
290+ function isNonTextLineMessageEvent (
291+ event : MessageEvent | PostbackEvent ,
292+ ) : event is MessageEvent & { message : Exclude < MessageEvent [ "message" ] , { type : "text" } > } {
293+ return event . type === "message" && event . message . type !== "text" ;
294+ }
295+
284296async function handleMessageEvent ( event : MessageEvent , context : LineHandlerContext ) : Promise < void > {
285297 const { cfg, account, runtime, mediaMaxBytes, processMessage } = context ;
286298 const message = event . message ;
0 commit comments