@@ -54,7 +54,7 @@ public async Task ListDevicesAsync(CommandContext ctx,
5454
5555 var devices = Device . GetAll ( ) ;
5656 var keys = devices . Keys . ToList ( ) ;
57- var pages = SplitPages ( ) ;
57+ var pages = SplitDevicePages ( ) ;
5858 for ( var i = 0 ; i < pages . Count ; i ++ )
5959 {
6060 var msg = pages [ i ] ;
@@ -373,30 +373,32 @@ public async Task ResignPoGoAsync(CommandContext ctx,
373373 [ Description ( "iPhone names i.e. `iPhoneAB1SE`. Comma delimiter supported `iPhoneAB1SE,iPhoneCD2SE`" ) , RemainingText ]
374374 string phoneNames = Strings . All )
375375 {
376- // if (!HasRequiredRoles(ctx.Member))
377- // {
378- // await ctx.RespondAsync($":no_entry: {ctx.User.Username} Unauthorized permissions.");
379- // return;
380- // }
376+ if ( ! HasRequiredRoles ( ctx . Member ) )
377+ {
378+ await ctx . RespondAsync ( $ ":no_entry: { ctx . User . Username } Unauthorized permissions.") ;
379+ return ;
380+ }
381381
382- // if (!IsValidChannel(ctx.Channel.Id))
383- // return;
382+ if ( ! IsValidChannel ( ctx . Channel . Id ) )
383+ return ;
384384
385385 var deployer = new IpaDeployer ( _dep . Config . Developer , _dep . Config . ProvisioningProfile )
386386 {
387387 ResignApp = true ,
388388 } ;
389389 await ctx . RespondAsync ( "Starting resign..." ) ;
390- var result = deployer . Resign ( megaLink , version ) ;
391- if ( ! result )
390+ if ( ! deployer . Resign ( megaLink , version ) )
392391 {
393392 await ctx . RespondAsync ( $ "Failed to resign IPA") ;
394393 return ;
395394 }
396- await ctx . RespondAsync ( $ "Resign complete, deploying ...") ;
395+ await ctx . RespondAsync ( $ "Resign complete, starting deployment to { phoneNames } ...") ;
397396
398- deployer . Deploy ( deployer . SignedReleaseFileName , phoneNames ) ;
399- await ctx . RespondAsync ( $ "Deploy complete") ;
397+ var result = deployer . Deploy ( deployer . SignedReleaseFileName , phoneNames ) ;
398+ var successful = result . Item1 . Count > 0 ? $ "Successfully deployed app to:\n { string . Join ( ", " , result . Item1 ) } " : null ;
399+ var failed = result . Item2 . Count > 0 ? $ "Failed to deploy app to:\n { string . Join ( ", " , result . Item2 ) } " : null ;
400+ // TODO: Check for content length over 2048 and split messages if so
401+ await ctx . RespondAsync ( $ "{ successful } \n { failed } ") ;
400402 }
401403
402404 [
@@ -407,14 +409,14 @@ public async Task DeployPoGoAsync(CommandContext ctx,
407409 [ Description ( "iPhone names i.e. `iPhoneAB1SE`. Comma delimiter supported `iPhoneAB1SE,iPhoneCD2SE`" ) , RemainingText ]
408410 string phoneNames = Strings . All )
409411 {
410- // if (!HasRequiredRoles(ctx.Member))
411- // {
412- // await ctx.RespondAsync($":no_entry: {ctx.User.Username} Unauthorized permissions.");
413- // return;
414- // }
412+ if ( ! HasRequiredRoles ( ctx . Member ) )
413+ {
414+ await ctx . RespondAsync ( $ ":no_entry: { ctx . User . Username } Unauthorized permissions.") ;
415+ return ;
416+ }
415417
416- // if (!IsValidChannel(ctx.Channel.Id))
417- // return;
418+ if ( ! IsValidChannel ( ctx . Channel . Id ) )
419+ return ;
418420
419421 var devices = Device . GetAll ( ) ;
420422 var deployAppDevices = new List < string > ( phoneNames . RemoveSpaces ( ) ) ;
@@ -443,11 +445,19 @@ public async Task DeployPoGoAsync(CommandContext ctx,
443445 _logger . Info ( $ "Deploying to device { device . Name } ({ device . Uuid } )...") ;
444446 var output = Shell . Execute ( "ios-deploy" , args , out var exitCode , true ) ;
445447 _logger . Debug ( $ "{ device . Name } ({ device . Uuid } ) Deployment output: { output } ") ;
446- if ( output . Length > 2000 )
448+ var success = output . ToLower ( ) . Contains ( $ "[100%] installed package { appPath } ") ;
449+ if ( success )
450+ {
451+ await ctx . RespondAsync ( $ "Deployed { appPath } to { device . Name } ({ device . Uuid } ) successfully.") ;
452+ }
453+ else
447454 {
448- output = string . Join ( "" , output . TakeLast ( 1900 ) ) ;
455+ if ( output . Length > 2000 )
456+ {
457+ output = string . Join ( "" , output . TakeLast ( 1900 ) ) ;
458+ }
459+ await ctx . RespondAsync ( $ "Failed to deploy { appPath } to { device . Name } ({ device . Uuid } )\n Output: { output } ") ;
449460 }
450- await ctx . RespondAsync ( $ "Deployed Pokemon Go to { device . Name } ({ device . Uuid } )\r \n Output: { output } ") ;
451461 }
452462 } ) ;
453463 }
@@ -511,7 +521,7 @@ private bool IsValidChannel(ulong channelId)
511521 return _dep . Config . ChannelIds . Count == 0 || _dep . Config . ChannelIds . Contains ( channelId ) ;
512522 }
513523
514- private List < string > SplitPages ( )
524+ private List < string > SplitDevicePages ( )
515525 {
516526 var devices = Device . GetAll ( ) ;
517527 var keys = devices . Keys . ToList ( ) ;
0 commit comments