private async Task ProcessRaffleDraw(List <string> args) { try { var winner = await _raffleService.EndRaffle(_event.Message.ChannelId); if (winner != 0) { _response = $":tada: RNGesus blesses you, child! Congratulations <@{winner}> :confetti_ball:"; } else { _response = $"There are no more participants."; } } catch (RaffleException ex) { _response = ex.Message; } finally { await _messageService.SendMessage(_event.Message.ChannelId, new OutgoingMessage { Content = _response }); } }
public async Task <RaffleRest> EndRaffle(string raffleId, string message, string signature) { Console.WriteLine("Requesting end auction"); (bool valid, string pubkey) = await _lndService.VerifyMessage(message, signature); if (valid && pubkey == AuthorizedPubkey) { var res = await _raffleService.EndRaffle(raffleId); var raffle = new RaffleRest { FinishedAt = DateTime.FromFileTimeUtc(res.FinishedAt), StartedAt = DateTime.FromFileTimeUtc(res.StartedAt), Id = res.Id.ToString() }; return(raffle); } return(new RaffleRest()); }