public override async Task <Status> Handle(BtwArchMiscellaneousAction action, CancellationToken cancellationToken) { await NavigatorContext.GetTelegramClient().SendTextMessageAsync(NavigatorContext.GetTelegramChat() !, "`Btw I run on Arch Linux.`", ParseMode.Markdown, replyToMessageId: action.Message.MessageId, cancellationToken: cancellationToken); return(Success()); }
public override async Task <Status> Handle(MataloCommandAction action, CancellationToken cancellationToken) { if (action.IsReply) { var insult = await _insultService.GetInsult(cancellationToken); if (!string.IsNullOrWhiteSpace(insult)) { await NavigatorContext.GetTelegramClient().SendTextMessageAsync(NavigatorContext.GetTelegramChat() !, insult, replyToMessageId: action.Message.ReplyToMessage?.MessageId, cancellationToken: cancellationToken); } } else { var answer = await _yesNoService.GetNoImage(cancellationToken); if (!string.IsNullOrWhiteSpace(answer)) { await NavigatorContext.GetTelegramClient().SendVideoAsync(NavigatorContext.GetTelegramChat() !, answer, replyToMessageId: action.Message.MessageId, cancellationToken: cancellationToken); } } return(Success()); }
public override async Task <Status> Handle(AboutCommandAction action, CancellationToken cancellationToken) { await NavigatorContext.GetTelegramClient().SendTextMessageAsync(NavigatorContext.GetTelegramChat() !, CoreResources.AboutText, ParseMode.Markdown, cancellationToken: cancellationToken); return(Success()); }
public override async Task <Status> Handle(GoAheadMiscellaneousAction action, CancellationToken cancellationToken) { await NavigatorContext.GetTelegramClient().SendVideoAsync(NavigatorContext.GetTelegramChat() !, CoreLinks.GoAhead, cancellationToken: cancellationToken, caption: "SSSSSSSSSSSUCK YOUR OWN COCKKKKK"); return(Success()); }
public override async Task <Status> Handle(TortureMiscellaneousAction action, CancellationToken cancellationToken) { var choice = RandomProvider.GetThreadRandom().Next(0, 4); switch (choice) { case 0: await NavigatorContext.GetTelegramClient().SendVideoAsync(NavigatorContext.GetTelegramChat() !, CoreLinks.CbtExplanation, cancellationToken: cancellationToken); break; case 1: await NavigatorContext.GetTelegramClient().SendTextMessageAsync(NavigatorContext.GetTelegramChat() !, "And make it snappy", cancellationToken: cancellationToken); await NavigatorContext.GetTelegramClient().SendVideoAsync(NavigatorContext.GetTelegramChat() !, CoreLinks.Conke, cancellationToken: cancellationToken); break; case 2: await NavigatorContext.GetTelegramClient().SendVideoAsync(NavigatorContext.GetTelegramChat() !, CoreLinks.MegatronCbtImmediate, cancellationToken: cancellationToken); break; case 3: await NavigatorContext.GetTelegramClient().SendVideoAsync(NavigatorContext.GetTelegramChat() !, CoreLinks.MegatronCbtExperience, cancellationToken: cancellationToken); break; } return(Success()); }
public override async Task <Status> Handle(BottomifyCommandAction action, CancellationToken cancellationToken) { string?bottomifiedText; if (action.IsReply && !string.IsNullOrWhiteSpace(action.Message.ReplyToMessage?.Text)) { bottomifiedText = Common.Helper.Bottomify.EncodeString(action.Message.ReplyToMessage.Text); await NavigatorContext.GetTelegramClient().SendTextMessageAsync(NavigatorContext.GetTelegramChat() !, bottomifiedText, replyToMessageId: action.Message.ReplyToMessage.MessageId, cancellationToken: cancellationToken); return(Success()); } var input = action.Message.Text.Remove(0, action.Message.Text.IndexOf(' ') + 1); if (!string.IsNullOrWhiteSpace(input) && !input.StartsWith(action.Command)) { bottomifiedText = Common.Helper.Bottomify.EncodeString(input); await NavigatorContext.GetTelegramClient().SendTextMessageAsync(NavigatorContext.GetTelegramChat() !, bottomifiedText, cancellationToken: cancellationToken); return(Success()); } bottomifiedText = Common.Helper.Bottomify.EncodeString(Lines[RandomProvider.GetThreadRandom().Next(0, Lines.Length)]); await NavigatorContext.GetTelegramClient().SendTextMessageAsync(NavigatorContext.GetTelegramChat() !, bottomifiedText, cancellationToken: cancellationToken); return(Success()); }
public JumpCache(IServiceProvider services) { _api = (EVEStandardAPI)services.GetService(typeof(EVEStandardAPI)); _tranquilityDbContext = (TranquilityContext)services.GetService(typeof(TranquilityContext)); _navigatorDbContext = (NavigatorContext)services.GetService(typeof(NavigatorContext)); _solarSystemRepository = new SolarSystemRepository(); }
public override async Task <Status> Handle(QuoteCommandAction action, CancellationToken cancellationToken) { var image = await _inspiroService.GetInspiroImage(cancellationToken); await NavigatorContext.GetTelegramClient().SendPhotoAsync(NavigatorContext.GetTelegramChat() !, image, cancellationToken: cancellationToken); return(Success()); }
public override async Task <Status> Handle(BuelingMiscellaneousAction action, CancellationToken cancellationToken) { await NavigatorContext.GetTelegramClient().SendTextMessageAsync(NavigatorContext.GetTelegramChat() !, "Did some carbon based life form just mention...", cancellationToken: cancellationToken); await NavigatorContext.GetTelegramClient().SendStickerAsync(NavigatorContext.GetTelegramChat() !, "CAACAgQAAxkBAAJJpl6bSONlqhE0C21-0T9V9YHxfqPKAAKZBgACL9trAAHwqRcYUmB_gRgE", cancellationToken: cancellationToken); return(Success()); }
public override async Task <Status> Handle(UwuMiscellaneousAction action, CancellationToken cancellationToken) { var randomSticker = Stickers[RandomProvider.GetThreadRandom().Next(0, Stickers.Length)]; await NavigatorContext.GetTelegramClient().SendStickerAsync(NavigatorContext.GetTelegramChat() !, randomSticker, cancellationToken: cancellationToken); return(Success()); }
protected override Task <object> ArgsBuilder() { return(Task.FromResult <object>(new { context = NavigatorContext, client = NavigatorContext.GetTelegramClient(), chat = new ChatId(NavigatorContext.GetTelegramChat().Id), })); }
public override async Task <Status> Handle(QuestionsInteractiveAction action, CancellationToken cancellationToken) { string response; var cacheKey = $"_{nameof(QuestionsInteractiveActionHandler)}_{NavigatorContext.GetTelegramChat().Id}"; var cacheValue = await _distributedCache.GetStringAsync(cacheKey, cancellationToken); if (int.TryParse(cacheValue, out var questionsAsked)) { response = questionsAsked switch {
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.Configure <CookiePolicyOptions>(options => { // This lambda determines whether user consent for non-essential cookies is needed for a given request. options.CheckConsentNeeded = context => true; options.MinimumSameSitePolicy = SameSiteMode.None; }); // Add cookie authentication and set the login url services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme) .AddCookie(options => { options.LoginPath = "/Auth/Login"; }); if (File.Exists(SecretsFileName) == false) { throw new InvalidOperationException("You need to have a secrets file setup"); } var secrets = JsonConvert.DeserializeObject <Secrets>(File.ReadAllText(SecretsFileName)); // Register your application at: https://developers.eveonline.com/applications to obtain client ID and secret key and add them to user secrets // by right-clicking the solution and selecting Manage User Secrets. // Also, modify the callback URL in appsettings.json to match with your environment. // Initialize the client var esiClient = new EVEStandardAPI( "EVEAsset.Navigator", // User agent DataSource.Tranquility, // Server [Tranquility/Singularity] TimeSpan.FromSeconds(30), // Timeout Configuration["SSOCallbackUrl"], secrets.ClientId, secrets.SecretKey); // Register with DI container services.AddSingleton(esiClient); // Session is required services.AddSession(); services.AddMemoryCache(); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); var tranquilityContext = new TranquilityContext(new DbContextOptions <TranquilityContext>()); tranquilityContext.ConfigureServices(services, secrets.SdeConnectionString); var navigatorContext = new NavigatorContext(new DbContextOptions <NavigatorContext>()); navigatorContext.ConfigureServices(services, secrets.NavigatorConnectionString); services.AddSingleton(typeof(TranquilityContext), tranquilityContext); services.AddSingleton(typeof(NavigatorContext), navigatorContext); services.AddSingleton <IUniverseCache, UniverseCache>(); services.AddSingleton <IStaticDataRepository, StaticDataRepository>(); services.AddSingleton <IJumpCache, JumpCache>(); }
public override async Task <Status> Handle(RandomWordFallbackAction action, CancellationToken cancellationToken) { var gifUrl = await _giphyService.Get(action.Word, cancellationToken); if (gifUrl is not null) { await NavigatorContext.GetTelegramClient().SendAnimationAsync(NavigatorContext.GetTelegramChat() !, new InputOnlineFile(gifUrl), cancellationToken: cancellationToken); } return(Success()); }
public override async Task <Status> Handle(MegatronMiscellaneousAction action, CancellationToken cancellationToken) { if (RandomProvider.GetThreadRandom().NextDouble() <= 0.5d) { await NavigatorContext.GetTelegramClient().SendVideoAsync(NavigatorContext.GetTelegramChat() !, CoreLinks.MegatronCbtExperience, cancellationToken: cancellationToken); } else { await NavigatorContext.GetTelegramClient().SendVideoAsync(NavigatorContext.GetTelegramChat() !, CoreLinks.MegatronCbtImmediate, cancellationToken: cancellationToken); } return(Success()); }
public override async Task <Status> Handle(NginxMiscellaneousAction action, CancellationToken cancellationToken) { var bytes = Convert.FromBase64String(CoreResources.NginxImage); await using (var stream = await new StreamContent(new MemoryStream(bytes)).ReadAsStreamAsync()) { await NavigatorContext.GetTelegramClient().SendPhotoAsync(NavigatorContext.GetTelegramChat() !, new InputMedia(stream, "nginx.jpg"), cancellationToken: cancellationToken); } return(Success()); }
public override async Task <Status> Handle(SuccMiscellaneousAction action, CancellationToken cancellationToken) { if (RandomProvider.GetThreadRandom().NextDouble() < 0.8d) { await NavigatorContext.GetTelegramClient().SendVideoAsync(NavigatorContext.GetTelegramChat() !, CoreLinks.Succ, cancellationToken: cancellationToken); } else { await NavigatorContext.GetTelegramClient().SendVideoAsync(NavigatorContext.GetTelegramChat() !, CoreLinks.SuccWithTeeth, cancellationToken: cancellationToken); } return(Success()); }
public override async Task <Status> Handle(SourceMiscellaneousAction action, CancellationToken cancellationToken) { if (RandomProvider.GetThreadRandom().NextDouble() <= 0.5d) { await NavigatorContext.GetTelegramClient().SendPhotoAsync(NavigatorContext.GetTelegramChat() !, CoreLinks.Source, cancellationToken: cancellationToken, replyToMessageId: action.Message.MessageId); } else { await NavigatorContext.GetTelegramClient().SendPhotoAsync(NavigatorContext.GetTelegramChat() !, CoreLinks.SourceChad, cancellationToken: cancellationToken, replyToMessageId: action.Message.MessageId); } return(Success()); }
public override async Task <Status> Handle(LetsMiscellaneousAction action, CancellationToken cancellationToken) { var stickerList = LetsGoHelper.LetsGoStickers; var randomSticker = stickerList[RandomProvider.GetThreadRandom().Next(0, stickerList.Length)]; await NavigatorContext.GetTelegramClient().SendTextMessageAsync(NavigatorContext.GetTelegramChat() !, "F*****G", cancellationToken: cancellationToken); await NavigatorContext.GetTelegramClient().SendTextMessageAsync(NavigatorContext.GetTelegramChat() !, "GO", cancellationToken: cancellationToken); await NavigatorContext.GetTelegramClient().SendStickerAsync(NavigatorContext.GetTelegramChat() !, randomSticker, cancellationToken: cancellationToken); return(Success()); }
public override async Task <Status> Handle(CagasteMiscellaneousAction action, CancellationToken cancellationToken) { if (RandomProvider.GetThreadRandom().NextDouble() <= 0.5d) { await NavigatorContext.GetTelegramClient().SendPhotoAsync(NavigatorContext.GetTelegramChat() !, CoreLinks.CagasteGoku, cancellationToken: cancellationToken); } else { await NavigatorContext.GetTelegramClient().SendPhotoAsync(NavigatorContext.GetTelegramChat() !, CoreLinks.CagasteShark, cancellationToken: cancellationToken); } return(Success()); }
public override async Task <Status> Handle(TraktorMiscellaneousAction action, CancellationToken cancellationToken) { if (RandomProvider.GetThreadRandom().NextDouble() <= 0.2d) { await NavigatorContext.GetTelegramClient().SendVideoAsync(NavigatorContext.GetTelegramChat() !, CoreLinks.BuenoFlipao, cancellationToken: cancellationToken); } else { await NavigatorContext.GetTelegramClient().SendVideoAsync(NavigatorContext.GetTelegramChat() !, CoreLinks.Traktor, cancellationToken: cancellationToken); } return(Success()); }
public override async Task <Status> Handle(UpctMiscellaneousAction action, CancellationToken cancellationToken) { var stickerString = RandomProvider.GetThreadRandom().NextDouble() > 0.2d ? "CAACAgQAAxkBAAJNW16eEHOauvBkLuaD-jL95s86vn2qAAJuAwACmOejAAEys6bCdTOD7RgE" : "CAACAgQAAxkBAAJNXV6eEJLQHwl-8el7YOYYJUF9l8ymAAJZAgACkNStBjfoiv3ywvd8GAQ"; await NavigatorContext.GetTelegramClient().SendStickerAsync(NavigatorContext.GetTelegramChat() !, stickerString, cancellationToken: cancellationToken); if (RandomProvider.GetThreadRandom().NextDouble() > 0.8d) { await NavigatorContext.GetTelegramClient().SendTextMessageAsync(NavigatorContext.GetTelegramChat() !, "cAmPuS dE eXcElEnCiA iNtErNaCiOnAl", cancellationToken: cancellationToken); } return(Success()); }
public override async Task <Status> Handle(NFTMiscellaneousAction action, CancellationToken cancellationToken) { var nft = new List <string> { CoreLinks.NFT, CoreLinks.NFToad, CoreLinks.NFTractor, CoreLinks.NFTattoo, CoreLinks.NFTu }.GetRandomFromList(); await NavigatorContext.GetTelegramClient().SendPhotoAsync(NavigatorContext.GetTelegramChat() !, nft, cancellationToken: cancellationToken); return(Success()); }
public override async Task <Status> Handle(IpadMiscellaneousAction action, CancellationToken cancellationToken) { if (RandomProvider.GetThreadRandom().NextDouble() >= 0.5) { await NavigatorContext.GetTelegramClient().SendPhotoAsync(NavigatorContext.GetTelegramChat() !, CoreLinks.Ipad, "tEnGo Un IpAd", cancellationToken: cancellationToken); } else { var bytes = Convert.FromBase64String(CoreResources.IpadAudio); await using var stream = await new StreamContent(new MemoryStream(bytes)).ReadAsStreamAsync(); await NavigatorContext.GetTelegramClient().SendVoiceAsync(NavigatorContext.GetTelegramChat() !, new InputMedia(stream, "ipad"), duration: 5, cancellationToken: cancellationToken); } return(Success()); }
public override async Task <Status> Handle(BadBotInteractiveAction action, CancellationToken cancellationToken) { var reactions = new List <string> { "Sowwry uwu", "Perdoooooooon", "... :(", "Habla con mis dueños para que me arreglen òwó", "Acho que no es mi culpa, me programaron así" }; var response = reactions.GetRandomFromList(); await NavigatorContext.GetTelegramClient().SendTextMessageAsync(NavigatorContext.GetTelegramChat() !, response, cancellationToken: cancellationToken); return(Success()); }
public override async Task <Status> Handle(LigmaMiscellaneousAction action, CancellationToken cancellationToken) { if (RandomProvider.GetThreadRandom().NextDouble() >= 0.75) { var bytes = Convert.FromBase64String(CoreResources.LigmaHardAudio); await using var stream = await new StreamContent(new MemoryStream(bytes)).ReadAsStreamAsync(); await NavigatorContext.GetTelegramClient().SendVoiceAsync(NavigatorContext.GetTelegramChat() !, new InputMedia(stream, LIGMA_TEXT.ToUpper()), duration: 4, cancellationToken: cancellationToken); } else { var bytes = Convert.FromBase64String(CoreResources.LigmaSoftAudio); await using var stream = await new StreamContent(new MemoryStream(bytes)).ReadAsStreamAsync(); await NavigatorContext.GetTelegramClient().SendVoiceAsync(NavigatorContext.GetTelegramChat() !, new InputMedia(stream, LIGMA_TEXT), duration: 3, cancellationToken: cancellationToken); } return(Success()); }
public override async Task <Status> Handle(DefaultInlineAction action, CancellationToken cancellationToken) { var responses = new List <InlineQueryResultArticle>(); foreach (var(id, title, url) in Links) { responses.Add(new InlineQueryResultArticle(id, title, new InputTextMessageContent(url)) { Url = url, HideUrl = true, Description = url, ThumbUrl = "https://fosc.space/img/Logo-invert.webp" }); } await NavigatorContext.GetTelegramClient().AnswerInlineQueryAsync(action.InlineQuery.Id, responses, cancellationToken: cancellationToken); return(Success()); }
public override async Task <Status> Handle(PingInteractiveAction action, CancellationToken cancellationToken) { var requestTime = action.Timestamp; var messageTime = action.Message.Date; var delaySinceMessageWasSent = requestTime - messageTime; if (delaySinceMessageWasSent.TotalSeconds < 12) { await NavigatorContext.GetTelegramClient().SendTextMessageAsync(NavigatorContext.GetTelegramChat() !, $"🟩 toy refinisimo bro. Delay: {delaySinceMessageWasSent.TotalSeconds}s", cancellationToken: cancellationToken, replyToMessageId: action.Message.MessageId); } else if (delaySinceMessageWasSent.TotalSeconds < 30) { await NavigatorContext.GetTelegramClient().SendTextMessageAsync(NavigatorContext.GetTelegramChat() !, $"🟧 toy F bro. Delay: {delaySinceMessageWasSent.TotalSeconds}s", cancellationToken: cancellationToken, replyToMessageId: action.Message.MessageId); } else { await NavigatorContext.GetTelegramClient().SendTextMessageAsync(NavigatorContext.GetTelegramChat() !, $"🟥 toy joya sosio arreglame ya por dio. Delay: {delaySinceMessageWasSent.TotalSeconds}s", cancellationToken: cancellationToken, replyToMessageId: action.Message.MessageId); } return(Success()); }
public override async Task <Status> Handle(DefaultFallbackAction action, CancellationToken cancellationToken) { if (!string.IsNullOrWhiteSpace(action.Message.Text) && Bottomify.IsEncoded(action.Message.Text)) { await NavigatorContext.GetTelegramClient().SendTextMessageAsync(NavigatorContext.GetTelegramChat() !, $"`Fellow humans I have decoded these words of wisdom:` \n_{Bottomify.DecodeString(action.Message.Text)}_", ParseMode.Markdown, cancellationToken: cancellationToken); } if (RandomProvider.GetThreadRandom().Next(0, 600) < 598) { return(Success()); } var sentence = string.Empty; var odds = RandomProvider.GetThreadRandom().Next(0, 20); if (odds >= 0 && odds < 5) { sentence = await _lipsumService.GetBacon(cancellationToken : cancellationToken); } else if (odds >= 5 && odds < 10) { sentence = await _lipsumService.GetMetaphorSentence(cancellationToken : cancellationToken); } else if (action.Message.Text?.Split(' ').Length > 3) { sentence = MockFilter.Apply(action.Message.Text); } if (!string.IsNullOrWhiteSpace(sentence)) { await NavigatorContext.GetTelegramClient().SendTextMessageAsync(NavigatorContext.GetTelegramChat() !, sentence, ParseMode.Markdown, replyToMessageId: action.Message.MessageId, cancellationToken: cancellationToken); } return(Success()); }
static void Main(string[] args) { int[] arr1 = { 31, 15, 10, 2, 4, 2, 14, 23, 12, 66 }; StrategySort sort = new SelectionSort(); Context context = new Context(sort, arr1); context.Sort(); context.PrintArray(); int[] arr2 = { 1, 5, 10, 2, 4, 12, 14, 23, 12, 66 }; sort = new InsertionSort(); context = new Context(sort, arr2); context.Sort(); context.PrintArray(); int[] arr3 = { 1, 15, 19, 25, 34, 12, 17, 32, 12, 6 }; sort = new BubbleSort(); context = new Context(sort, arr3); context.Sort(); context.PrintArray(); Console.WriteLine(); string start = "ул. Советская"; string finish = "ул. Ленина"; StrategyNavigator nav = new CarGo(); NavigatorContext cont = new NavigatorContext(nav, start, finish); cont.Go(); nav = new FootGo(); cont = new NavigatorContext(nav, start, finish); cont.Go(); nav = new BikeGo(); cont = new NavigatorContext(nav, start, finish); cont.Go(); Console.ReadKey(); }