99 * DS207: Consider shorter variations of null checks
1010 * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
1111 */
12- const { Adapter, Robot, TextMessage, EnterMessage, LeaveMessage} = require ( 'hubot' ) ;
12+ const { Adapter, Robot, TextMessage, EnterMessage, LeaveMessage} = require ( 'hubot/es2015 ' ) ;
1313const { JID , Stanza, Client, parse, Element} = require ( 'node-xmpp-client' ) ;
1414const uuid = require ( 'uuid' ) ;
1515const util = require ( 'util' ) ;
1616
1717class XmppBot extends Adapter {
18- static initClass ( ) {
19-
20- this . prototype . reconnectTryCount = 0 ;
21- this . prototype . currentIqId = 1001 ;
22- this . prototype . joining = [ ] ;
23- this . prototype . joined = [ ] ;
24- }
25-
2618 constructor ( robot ) {
27- {
28- // Hack: trick Babel/TypeScript into allowing this before super.
29- if ( false ) { super ( ) ; }
30- let thisFn = ( ( ) => { return this ; } ) . toString ( ) ;
31- let thisName = thisFn . match ( / r e t u r n (?: _ a s s e r t T h i s I n i t i a l i z e d \( ) * ( \w + ) \) * ; / ) [ 1 ] ;
32- eval ( `${ thisName } = this;` ) ;
33- }
34- this . error = this . error . bind ( this ) ;
35- this . online = this . online . bind ( this ) ;
36- this . ping = this . ping . bind ( this ) ;
37- this . read = this . read . bind ( this ) ;
38- this . readIq = this . readIq . bind ( this ) ;
39- this . readMessage = this . readMessage . bind ( this ) ;
40- this . readPresence = this . readPresence . bind ( this ) ;
41- this . offline = this . offline . bind ( this ) ;
42- this . checkCanStart = this . checkCanStart . bind ( this ) ;
43- this . robot = robot ;
19+ super ( robot )
4420
4521 // Flag to log a warning message about group chat configuration only once
4622 this . anonymousGroupChatWarningLogged = false ;
4723
4824 // Store the room JID to private JID map.
4925 // Key is the room JID, value is the private JID
5026 this . roomToPrivateJID = { } ;
51-
52- // http://stackoverflow.com/a/646643
53- if ( String . prototype . startsWith == null ) { String . prototype . startsWith = function ( s ) { return this . slice ( 0 , s . length ) === s ; } ; }
5427 }
5528
5629 run ( ) {
@@ -592,7 +565,11 @@ class XmppBot extends Adapter {
592565 }
593566 }
594567}
595- XmppBot . initClass ( ) ;
568+
569+ XmppBot . prototype . reconnectTryCount = 0 ;
570+ XmppBot . prototype . currentIqId = 1001 ;
571+ XmppBot . prototype . joining = [ ] ;
572+ XmppBot . prototype . joined = [ ] ;
596573
597574exports . use = robot => new XmppBot ( robot ) ;
598575
@@ -605,4 +582,4 @@ function __guardMethod__(obj, methodName, transform) {
605582}
606583function __guard__ ( value , transform ) {
607584 return ( typeof value !== 'undefined' && value !== null ) ? transform ( value ) : undefined ;
608- }
585+ }
0 commit comments