@@ -624,7 +624,7 @@ export const Commands = [
624
624
! isCurrentLocalRoom ( cli ) ,
625
625
runFn : function ( cli , roomId , threadId , widgetUrl ) {
626
626
if ( ! widgetUrl ) {
627
- return reject ( new UserFriendlyError ( "Please supply a widget URL or embed code " ) ) ;
627
+ return reject ( new UserFriendlyError ( "slash_command|addwidget_missing_url " ) ) ;
628
628
}
629
629
630
630
// Try and parse out a widget URL from iframes
@@ -635,15 +635,15 @@ export const Commands = [
635
635
if ( iframe ?. tagName . toLowerCase ( ) === "iframe" ) {
636
636
logger . log ( "Pulling URL out of iframe (embed code)" ) ;
637
637
if ( ! iframe . hasAttribute ( "src" ) ) {
638
- return reject ( new UserFriendlyError ( "iframe has no src attribute " ) ) ;
638
+ return reject ( new UserFriendlyError ( "slash_command|addwidget_iframe_missing_src " ) ) ;
639
639
}
640
640
widgetUrl = iframe . getAttribute ( "src" ) ! ;
641
641
}
642
642
}
643
643
}
644
644
645
645
if ( ! widgetUrl . startsWith ( "https://" ) && ! widgetUrl . startsWith ( "http://" ) ) {
646
- return reject ( new UserFriendlyError ( "Please supply a https:// or http:// widget URL " ) ) ;
646
+ return reject ( new UserFriendlyError ( "slash_command|addwidget_invalid_protocol " ) ) ;
647
647
}
648
648
if ( WidgetUtils . canUserModifyWidgets ( cli , roomId ) ) {
649
649
const userId = cli . getUserId ( ) ;
@@ -665,7 +665,7 @@ export const Commands = [
665
665
666
666
return success ( WidgetUtils . setRoomWidget ( cli , roomId , widgetId , type , widgetUrl , name , data ) ) ;
667
667
} else {
668
- return reject ( new UserFriendlyError ( "You cannot modify widgets in this room. " ) ) ;
668
+ return reject ( new UserFriendlyError ( "slash_command|addwidget_no_permissions " ) ) ;
669
669
}
670
670
} ,
671
671
category : CommandCategories . admin ,
@@ -749,7 +749,7 @@ export const Commands = [
749
749
} ) ,
750
750
new Command ( {
751
751
command : "discardsession" ,
752
- description : _td ( "Forces the current outbound group session in an encrypted room to be discarded " ) ,
752
+ description : _td ( "slash_command|discardsession " ) ,
753
753
isEnabled : ( cli ) => ! isCurrentLocalRoom ( cli ) ,
754
754
runFn : function ( cli , roomId ) {
755
755
try {
@@ -764,7 +764,7 @@ export const Commands = [
764
764
} ) ,
765
765
new Command ( {
766
766
command : "remakeolm" ,
767
- description : _td ( "Developer command: Discards the current outbound group session and sets up new Olm sessions " ) ,
767
+ description : _td ( "slash_command|remakeolm " ) ,
768
768
isEnabled : ( cli ) => {
769
769
return SettingsStore . getValue ( "developerMode" ) && ! isCurrentLocalRoom ( cli ) ;
770
770
} ,
@@ -856,7 +856,7 @@ export const Commands = [
856
856
} ) ,
857
857
new Command ( {
858
858
command : "tovirtual" ,
859
- description : _td ( "Switches to this room's virtual room, if it has one " ) ,
859
+ description : _td ( "slash_command|tovirtual " ) ,
860
860
category : CommandCategories . advanced ,
861
861
isEnabled ( cli ) : boolean {
862
862
return ! ! LegacyCallHandler . instance . getSupportsVirtualRooms ( ) && ! isCurrentLocalRoom ( cli ) ;
@@ -865,7 +865,7 @@ export const Commands = [
865
865
return success (
866
866
( async ( ) : Promise < void > => {
867
867
const room = await VoipUserMapper . sharedInstance ( ) . getVirtualRoomForRoom ( roomId ) ;
868
- if ( ! room ) throw new UserFriendlyError ( "No virtual room for this room " ) ;
868
+ if ( ! room ) throw new UserFriendlyError ( "slash_command|tovirtual_not_found " ) ;
869
869
dis . dispatch < ViewRoomPayload > ( {
870
870
action : Action . ViewRoom ,
871
871
room_id : room . roomId ,
@@ -878,7 +878,7 @@ export const Commands = [
878
878
} ) ,
879
879
new Command ( {
880
880
command : "query" ,
881
- description : _td ( "Opens chat with the given user " ) ,
881
+ description : _td ( "slash_command|query " ) ,
882
882
args : "<user-id>" ,
883
883
runFn : function ( cli , roomId , threadId , userId ) {
884
884
// easter-egg for now: look up phone numbers through the thirdparty API
@@ -893,7 +893,7 @@ export const Commands = [
893
893
if ( isPhoneNumber ) {
894
894
const results = await LegacyCallHandler . instance . pstnLookup ( userId ) ;
895
895
if ( ! results || results . length === 0 || ! results [ 0 ] . userid ) {
896
- throw new UserFriendlyError ( "Unable to find Matrix ID for phone number " ) ;
896
+ throw new UserFriendlyError ( "slash_command|query_not_found_phone_number " ) ;
897
897
}
898
898
userId = results [ 0 ] . userid ;
899
899
}
@@ -949,13 +949,13 @@ export const Commands = [
949
949
} ) ,
950
950
new Command ( {
951
951
command : "holdcall" ,
952
- description : _td ( "Places the call in the current room on hold " ) ,
952
+ description : _td ( "slash_command|holdcall " ) ,
953
953
category : CommandCategories . other ,
954
954
isEnabled : ( cli ) => ! isCurrentLocalRoom ( cli ) ,
955
955
runFn : function ( cli , roomId , threadId , args ) {
956
956
const call = LegacyCallHandler . instance . getCallForRoom ( roomId ) ;
957
957
if ( ! call ) {
958
- return reject ( new UserFriendlyError ( "No active call in this room " ) ) ;
958
+ return reject ( new UserFriendlyError ( "slash_command|no_active_call " ) ) ;
959
959
}
960
960
call . setRemoteOnHold ( true ) ;
961
961
return success ( ) ;
@@ -964,13 +964,13 @@ export const Commands = [
964
964
} ) ,
965
965
new Command ( {
966
966
command : "unholdcall" ,
967
- description : _td ( "Takes the call in the current room off hold " ) ,
967
+ description : _td ( "slash_command|unholdcall " ) ,
968
968
category : CommandCategories . other ,
969
969
isEnabled : ( cli ) => ! isCurrentLocalRoom ( cli ) ,
970
970
runFn : function ( cli , roomId , threadId , args ) {
971
971
const call = LegacyCallHandler . instance . getCallForRoom ( roomId ) ;
972
972
if ( ! call ) {
973
- return reject ( new UserFriendlyError ( "No active call in this room " ) ) ;
973
+ return reject ( new UserFriendlyError ( "slash_command|no_active_call " ) ) ;
974
974
}
975
975
call . setRemoteOnHold ( false ) ;
976
976
return success ( ) ;
@@ -979,24 +979,24 @@ export const Commands = [
979
979
} ) ,
980
980
new Command ( {
981
981
command : "converttodm" ,
982
- description : _td ( "Converts the room to a DM " ) ,
982
+ description : _td ( "slash_command|converttodm " ) ,
983
983
category : CommandCategories . other ,
984
984
isEnabled : ( cli ) => ! isCurrentLocalRoom ( cli ) ,
985
985
runFn : function ( cli , roomId , threadId , args ) {
986
986
const room = cli . getRoom ( roomId ) ;
987
- if ( ! room ) return reject ( new UserFriendlyError ( "Could not find room " ) ) ;
987
+ if ( ! room ) return reject ( new UserFriendlyError ( "slash_command|could_not_find_room " ) ) ;
988
988
return success ( guessAndSetDMRoom ( room , true ) ) ;
989
989
} ,
990
990
renderingTypes : [ TimelineRenderingType . Room ] ,
991
991
} ) ,
992
992
new Command ( {
993
993
command : "converttoroom" ,
994
- description : _td ( "Converts the DM to a room " ) ,
994
+ description : _td ( "slash_command|converttoroom " ) ,
995
995
category : CommandCategories . other ,
996
996
isEnabled : ( cli ) => ! isCurrentLocalRoom ( cli ) ,
997
997
runFn : function ( cli , roomId , threadId , args ) {
998
998
const room = cli . getRoom ( roomId ) ;
999
- if ( ! room ) return reject ( new UserFriendlyError ( "Could not find room " ) ) ;
999
+ if ( ! room ) return reject ( new UserFriendlyError ( "slash_command|could_not_find_room " ) ) ;
1000
1000
return success ( guessAndSetDMRoom ( room , false ) ) ;
1001
1001
} ,
1002
1002
renderingTypes : [ TimelineRenderingType . Room ] ,
@@ -1007,7 +1007,7 @@ export const Commands = [
1007
1007
new Command ( {
1008
1008
command : "me" ,
1009
1009
args : "<message>" ,
1010
- description : _td ( "Displays action " ) ,
1010
+ description : _td ( "slash_command|me " ) ,
1011
1011
category : CommandCategories . messages ,
1012
1012
hideCompletionAfterSpace : true ,
1013
1013
} ) ,
0 commit comments