public async Task Attack(Interaction interaction) { var user = _userRepository.GetUser(interaction.UserId); var monster = _monsterRepository.GetMonster(int.Parse(interaction.Value)); var response = await _combatService.AttackMonster(user, monster, interaction.ChannelId); await _slack.SendEphemeralMessage(response.Message, user.Id, interaction.ChannelId); await _slack.UpdateInteractionMessage(new MonsterMenu(monster).Blocks, interaction.ResponseUrl); }
public async Task Buy(Interaction interaction) { var user = _userRepository.GetUser(interaction.UserId); var shopId = interaction.BlockId.Split(":").First(); var shop = _shopRepository.GetShop(shopId); var response = _shopService.Buy(user, interaction.Value); await _slack.SendEphemeralMessage(response.Message, user.Id, interaction.ChannelId); await _slack.UpdateInteractionMessage(new ShopMenu(shop, user, _itemRepository, _governmentService).Blocks, interaction.ResponseUrl); }
public async Task Use(Interaction interaction) { var user = _userRepository.GetUser(interaction.UserId); var command = new Command { ChannelId = interaction.ChannelId, Text = interaction.Value.Split(":").Last(), UserId = interaction.UserId }; var message = _inventoryCommands.Use(command).Message; await _slack.SendEphemeralMessage(message, interaction.UserId, interaction.ChannelId); await _slack.UpdateInteractionMessage(new InventoryMenu(user.InventoryItems).Blocks, interaction.ResponseUrl); }
private async Task UpdateMonsterAttackBlocks(SpawnedMonster spawnedMonster, string url) { if (spawnedMonster.IsDead()) { await _slack.DeleteInteractionMessage(url); } else { await _slack.UpdateInteractionMessage(new MonsterMenu(spawnedMonster).Blocks, url); } }
public async Task AttributeStatPoint(Interaction interaction) { var user = _userRepository.GetUser(interaction.UserId); if (user.FreeStatsPoints <= 0) { await _slack.SendEphemeralMessage(DougMessages.NoMoreStatsPoints, user.Id, interaction.ChannelId); return; } _statsRepository.AttributeStatPoint(user.Id, interaction.Value); await _slack.UpdateInteractionMessage(new StatsMenu(user).Blocks, interaction.ResponseUrl); }
public async Task ShowCraftingMenu(Interaction interaction) { var user = _userRepository.GetUser(interaction.UserId); await _slack.UpdateInteractionMessage(new CraftingMenu(user.InventoryItems).Blocks, interaction.ResponseUrl); }