This repository was archived by the owner on Sep 11, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -1014,22 +1014,24 @@ export const Commands = [
10141014 new Command ( {
10151015 command : "msg" ,
10161016 description : _td ( "Sends a message to the given user" ) ,
1017- args : "<user-id> <message>" ,
1017+ args : "<user-id> [ <message>] " ,
10181018 runFn : function ( roomId , args ) {
10191019 if ( args ) {
10201020 // matches the first whitespace delimited group and then the rest of the string
10211021 const matches = args . match ( / ^ ( \S + ?) (?: + ( .* ) ) ? $ / s) ;
10221022 if ( matches ) {
10231023 const [ userId , msg ] = matches . slice ( 1 ) ;
1024- if ( msg && userId && userId . startsWith ( "@" ) && userId . includes ( ":" ) ) {
1024+ if ( userId && userId . startsWith ( "@" ) && userId . includes ( ":" ) ) {
10251025 return success ( ( async ( ) => {
10261026 const cli = MatrixClientPeg . get ( ) ;
10271027 const roomId = await ensureDMExists ( cli , userId ) ;
10281028 dis . dispatch ( {
10291029 action : 'view_room' ,
10301030 room_id : roomId ,
10311031 } ) ;
1032- cli . sendTextMessage ( roomId , msg ) ;
1032+ if ( msg ) {
1033+ cli . sendTextMessage ( roomId , msg ) ;
1034+ }
10331035 } ) ( ) ) ;
10341036 }
10351037 }
You can’t perform that action at this time.
0 commit comments