Exemplo n.º 1
0
 public override void HandleMessage(ChatMessage chatMessage, TwitchClient twitchClient, Character activePlayer)
 {
     lock (messageHandlingLock)
     {
         string streamDeckCommand = StripCommandsFromMessage(chatMessage.Message, out string commands);
         foreach (IDungeonMasterCommand dungeonMasterCommand in Commands)
         {
             if (dungeonMasterCommand.Matches(streamDeckCommand))
             {
                 if (dungeonMasterCommand is SelectShortcutCommand shortcutCommand)
                 {
                     int playerId = DungeonMasterApp.GetPlayerIdFromName(shortcutCommand.playerInitial);
                     activePlayer = DungeonMasterApp.GetPlayerFromId(playerId);
                 }
                 Expressions.Do(commands, activePlayer);
                 dungeonMasterCommand.Execute(DungeonMasterApp, chatMessage);
                 return;
             }
         }
     }
 }