Example #1
0
        protected async Task <StateResult> Step3(Message message, string text, TelegramBotClient bot, bool batchMode)
        {
            var userId = base.GetUserId(message);
            var chatId = base.GetChatId(message);

            if (!batchMode)
            {
                var raid    = this.getCurrentManualRaidQuery.Execute(new GetCurrentManualRaidRequest(UserId: userId));
                var gyms    = this.getActiveGymsByChatQuery.Execute(new GetActiveGymsByChatRequest(ChatId: raid.ChatId ?? 0));
                var special = this.getSpecialGymsQuery.Execute(new GetSpecialGymsForChatsRequest(ChatIds: new[] { raid.ChatId ?? 0 }));

                StringBuilder msg = new StringBuilder();

                int i = 0;
                foreach (var gym in gyms)
                {
                    var gymName = special.FirstOrDefault(x => x.GymId == gym.Id && x.Type == (int)GymType.AlternativeName)?.Data ?? gym.Name;
                    var line    = $"{i} - {gymName}";
                    if (line.Length + msg.Length > 4096)
                    {
                        await bot.SendTextMessageAsync(chatId, msg.ToString());

                        msg.Clear();
                    }

                    msg.AppendLine(line);
                    i++;
                }

                await bot.SendTextMessageAsync(chatId, msg.ToString());
            }

            return(StateResult.AwaitUserAt(4));
        }
        protected async Task <StateResult> Step0(Message message, string text, TelegramBotClient bot, bool batchMode)
        {
            var chatId = base.GetChatId(message);

            StringBuilder msg           = new StringBuilder("Du hast für folgende Bosse Marker gesetzt:");
            var           currentBosses = this.getRaidBossPreferencesQuery.Execute(new GetRaidBossPreferencesRequest(ChatId: chatId));

            msg.AppendLine();
            if (currentBosses.Count() == 0)
            {
                msg.AppendLine("Keine");
            }
            else
            {
                foreach (var boss in currentBosses)
                {
                    msg.AppendLine($"{boss.PokeId}");
                }
            }

            msg.AppendLine("Du kannst 'x' antworten, dann wird nichts geändert.");
            msg.Append("Poke-Id, die de- / aktiviert werden soll:");

            await bot.SendTextMessageAsync(chatId, msg.ToString()).ConfigureAwait(false);

            return(StateResult.AwaitUserAt(1));
        }
        protected async Task <StateResult> Step7(Message message, string text, TelegramBotClient bot, bool batchMode)
        {
            var chatId = base.GetChatId(message);
            await bot.SendTextMessageAsync(chatId, "Titel (Max 40):").ConfigureAwait(false);

            return(StateResult.AwaitUserAt(8));
        }
Example #4
0
        protected async Task <StateResult> Step0(Message message, string text, TelegramBotClient bot, bool batchMode)
        {
            var userId = base.GetUserId(message);
            var chatId = base.GetChatId(message);

            var currentChatSettings = this.getCurrentChatSettingsQuery.Execute(new GetCurrentChatSettingsRequest(ChatId: chatId));
            var gyms    = this.getGymsByChatQuery.Execute(new GetGymsByChatRequest(Chat: currentChatSettings));
            var special = this.getSpecialGymsQuery.Execute(new GetSpecialGymsForChatsRequest(ChatIds: new[] { chatId }));

            StringBuilder msg = new StringBuilder("Bitte wähle ein Gym\r\n");

            int i = 0;

            foreach (var gym in gyms)
            {
                var line = $"{i} - {(special.Any(x => x.GymId == gym.Id && x.Type == (int)GymType.Exclude) ? "X " : "")}{(special.Any(x => x.GymId == gym.Id && x.Type == (int)GymType.ExRaid) ? "+ " : "")}{gym.Name}";
                if (line.Length + msg.Length > 4096)
                {
                    await bot.SendTextMessageAsync(chatId, msg.ToString());

                    msg.Clear();
                }

                msg.AppendLine(line);
                i++;
            }

            await bot.SendTextMessageAsync(chatId, msg.ToString());

            return(StateResult.AwaitUserAt(1));
        }
        protected async Task <StateResult> Step6(Message message, string text, TelegramBotClient bot, bool batchMode)
        {
            var chatId = base.GetChatId(message);
            await bot.SendTextMessageAsync(chatId, "Poke-Id:");


            return(StateResult.AwaitUserAt(7));
        }
        protected async Task <StateResult> Step9(Message message, string text, TelegramBotClient bot, bool batchMode)
        {
            var chatId = base.GetChatId(message);
            await bot.SendTextMessageAsync(chatId, "Termin (yyyy.mm.dd hh:mm):").ConfigureAwait(false);


            return(StateResult.AwaitUserAt(10));
        }
Example #7
0
        protected async Task <StateResult> Step9(Message message, string text, TelegramBotClient bot, bool batchMode)
        {
            var currentSettings = this.getCurrentChatSettingsQuery.Execute(new DataAccess.Queries.Raid.GetCurrentChatSettingsRequest(ChatId: message.Chat.Id));

            await bot.SendTextMessageAsync(message.Chat.Id, $"Aktueller Wert {currentSettings?.RaidLevel ?? 1} \n\rMinimum Raid-Level", replyMarkup : new ForceReplyMarkup());

            return(StateResult.AwaitUserAt(10));
        }
        protected async Task <StateResult> Step0(Message message, string text, TelegramBotClient bot, bool batchMode)
        {
            await bot.SendTextMessageAsync(message.Chat.Id, "Wo bist du?", replyMarkup : new ReplyKeyboardMarkup(new[] { new KeyboardButton("Send Position")
                                                                                                                         {
                                                                                                                             RequestLocation = true
                                                                                                                         } })).ConfigureAwait(false);

            return(StateResult.AwaitUserAt(1));
        }
Example #9
0
        protected async Task <StateResult> Step7(Message message, string text, TelegramBotClient bot, bool batchMode)
        {
            var currentSettings = this.getCurrentChatSettingsQuery.Execute(new DataAccess.Queries.Raid.GetCurrentChatSettingsRequest(ChatId: message.Chat.Id));
            var west            = _Helper.GetWest(currentSettings)?.ToString(CultureInfo.InvariantCulture) ?? "-";

            await bot.SendTextMessageAsync(message.Chat.Id, $"Aktueller Wert {west} \n\rKoordinate, die nach Westen begrenzt", replyMarkup : new ForceReplyMarkup());

            return(StateResult.AwaitUserAt(8));
        }
Example #10
0
        protected async Task <StateResult> Step7(Message message, string text, TelegramBotClient bot, bool batchMode)
        {
            if (!batchMode)
            {
                var chatId = base.GetChatId(message);
                await bot.SendTextMessageAsync(chatId, "Minuten bis zum Start/Ende").ConfigureAwait(false);
            }

            return(StateResult.AwaitUserAt(8));
        }
Example #11
0
        protected async Task <StateResult> Step9(Message message, string text, TelegramBotClient bot, bool batchMode)
        {
            if (!batchMode)
            {
                var chatId = base.GetChatId(message);
                await bot.SendTextMessageAsync(chatId, "Raidlevel");
            }

            return(StateResult.AwaitUserAt(10));
        }
Example #12
0
        protected async Task <StateResult> Step1(Message message, string text, TelegramBotClient bot, bool batchMode)
        {
            var currentSettings = this.getCurrentChatSettingsQuery.Execute(new DataAccess.Queries.Raid.GetCurrentChatSettingsRequest(ChatId: message.Chat.Id));

            var north = _Helper.GetNorth(currentSettings)?.ToString(CultureInfo.InvariantCulture) ?? "-";
            // TODO: leer -> alte koordinate zählt + Größenbegrenzung

            await bot.SendTextMessageAsync(message.Chat.Id, $"Aktueller Wert {north} \n\rKoordinate, die nach Norden begrenzt", replyMarkup : new ForceReplyMarkup());

            return(StateResult.AwaitUserAt(2));
        }
        protected async Task <StateResult> Step1(Message message, string text, TelegramBotClient bot, bool batchMode)
        {
            var userId = base.GetUserId(message);
            var chatId = base.GetChatId(message);

            if (!batchMode)
            {
                await bot.SendTextMessageAsync(chatId, "Bitte gib die Raid-Id an:.").ConfigureAwait(false);
            }

            return(StateResult.AwaitUserAt(2));
        }
Example #14
0
        protected async Task <StateResult> Step3(Message message, string text, TelegramBotClient bot, bool batchMode)
        {
            var userId = base.GetUserId(message);
            var chatId = base.GetChatId(message);

            var currentSettings = this.getCurrentUserSettingsQuery.Execute(new DataAccess.Queries.Raid.GetCurrentUserSettingsRequest(UserId: userId));
            var team            = currentSettings.Team?.ToString() ?? "";

            await bot.SendTextMessageAsync(chatId, $"Team: {team} \n\r(1-Blau, 2-Rot, 3-Gelb)");

            return(StateResult.AwaitUserAt(4));
        }
Example #15
0
        protected async Task <StateResult> Step1(Message message, string text, TelegramBotClient bot, bool batchMode)
        {
            var userId = base.GetUserId(message);
            var chatId = base.GetChatId(message);

            var currentSettings = this.getCurrentUserSettingsQuery.Execute(new DataAccess.Queries.Raid.GetCurrentUserSettingsRequest(UserId: userId));

            var name = currentSettings?.IngameName ?? "";

            await bot.SendTextMessageAsync(chatId, $"Trainername: {name}");

            return(StateResult.AwaitUserAt(2));
        }
Example #16
0
        protected async Task <StateResult> Step5(Message message, string text, TelegramBotClient bot, bool batchMode)
        {
            var userId = base.GetUserId(message);
            var chatId = base.GetChatId(message);

            var currentSettings = this.getCurrentUserSettingsQuery.Execute(new DataAccess.Queries.Raid.GetCurrentUserSettingsRequest(UserId: userId));

            var level = currentSettings.Level?.ToString() ?? "";

            await bot.SendTextMessageAsync(chatId, $"Level: {level}");

            return(StateResult.AwaitUserAt(6));
        }
        protected async Task <StateResult> Step3(Message message, string text, TelegramBotClient bot, bool batchMode)
        {
            var userId = base.GetUserId(message);
            var chatId = base.GetChatId(message);

            var msg = new StringBuilder("Aktion ausführen:");

            msg.AppendLine();
            msg.AppendLine("1 - Löschen");
            msg.AppendLine("2 - Poke-Id anpassen");
            // msg.AppendLine("3 - Ort anpassen");
            // msg.AppendLine("4 - Startzeit verschieben");
            // msg.AppendLine("5 - Level anpassen");

            await bot.SendTextMessageAsync(chatId, msg.ToString()).ConfigureAwait(false);

            return(StateResult.AwaitUserAt(4));
        }
Example #18
0
        protected async Task <StateResult> Step0(Message message, string text, TelegramBotClient bot, bool batchMode)
        {
            var chatId = base.GetChatId(message);

            // FOR DEBUG
            return(await this.Step1(message, text, bot, batchMode));

            var msg = new StringBuilder("Schwierigkeitsgrad:");

            msg.AppendLine();
            msg.AppendLine("1 - Einfach");
            msg.AppendLine("2 - Mittel");
            msg.AppendLine("3 - Schwer");

            await bot.SendTextMessageAsync(chatId, msg.ToString()).ConfigureAwait(false);

            return(StateResult.AwaitUserAt(1));
        }
Example #19
0
        protected async Task <StateResult> Step1(Message message, string text, TelegramBotClient bot, bool batchMode)
        {
            var userId = base.GetUserId(message);
            var chatId = base.GetChatId(message);

            var chats = this.getActiveChatsForUser.Execute(new GetActiveChatsForUserRequest(UserId: userId, BotId: nimRaidBot.BotId));

            if (chats.Count() == 0)
            {
                await bot.SendTextMessageAsync(chatId, $"Für den Befehl musst du mindestens in einer Gruppe Mitglied sein.").ConfigureAwait(false);

                return(StateResult.Finished);
            }

            StringBuilder msg = new StringBuilder();

            for (int i = 0; i < chats.Count(); i++)
            {
                msg.AppendLine($"{i} - {chats[i].Name}");
            }

            if (chats.Count() > 1)
            {
                if (!batchMode)
                {
                    await bot.SendTextMessageAsync(chatId, $"Bitte wähle eine Gruppe\n\r{msg.ToString()}").ConfigureAwait(false);
                }

                return(StateResult.AwaitUserAt(2));
            }
            else
            {
                if (!batchMode)
                {
                    await bot.SendTextMessageAsync(chatId, $"Folgende Gruppe wird verwendet\n\r{msg.ToString()}").ConfigureAwait(false);
                }

                setChatForManualRaidCommand.Execute(new SetChatForManualRaidAndInitializeRequest(UserId: userId, ChatId: chats.First().ChatId));
                return(await this.Step3(message, text, bot, batchMode));
            }
        }